# Numerical calculation of velocity and pressure distribution

I have a copy of this old NASA document that came up with a way to calculate the velocity and pressure distribution around an oscillating airfoil. I understand basically that it calculates through a range of angles and time steps what the flow of air is doing around an airfoil. With help on this forum from kll, we came up with a sketch to draw an airfoil and adjust the shape. Here’s the link to that discussion:
Trying to use modelX() but built a spiral galaxy of points - #7 by HackinHarry

What fun is it if you can’t accurately simulate the flow of air over it? I tried pixelflow to do that and a professor of aerodynamics laughed at it and said it makes nice hollywood style special effects but it isnt accurate at all. That got me interested and I found the paper laying out a computer method to do it accurately. It involves the solution of navier-stokes. I’m no mathematician but I read it and I think it can be done in processing with a matrix library. I know there are examples like LilyPad but it is for a fluid like water which is a slightly different problem than for air. The paper was written when a main frame had 64k of memory and they used tricks with magnetic tape to do the calculations. I believe a computer running processing can probably do it faster, but I don’t really know where to start.

One of the first things they do in the paper is make a grid that surrounds an obstacle(cylinder or airfoil). They make calculations inside these cells of the grid and they set initial conditions and put it all into several matrices and inverses of matrices and vectors and make a big matrix.

Here’s the paper:

There are a few flowcharts in the appendix that describe the process used. I guess I should start with “start” and go directly to Assemble S*, W*, P*, then Find Inverses for S*, W*, P* ?

Any help or nudge is welcome. I will post code as I make it, but need a shove I guess.

1 Like

I’ve looked at those equations and looked at them over and over. A mesh is needed around the obstacle. The authors of the paper use triangles and calculations are made in each triangle, I think, maybe. So, step one of the flow chart is only step one once a mesh is created.

How do I create a mesh around an airfoil?

Hi @HackinHarry ,

I don’t really know how it works but your question is not related to Processing but more on mathematics and physics.

Anyway a quick search on internet gives me this link which looks like what you are searching for :

Well, thanks, I can’t get to the processing part of the puzzle just yet. I’m looking at LilyPad again. The github page says it solves Navier-Stokes accurately. Thanks for the links.

1 Like

Saying something solves Navier-Stokes is a mighty claim worthy of a prize that has yet to be claimed. LilyPad probably solves it to some degree that is acceptable and practical but not strict or something, or the author would win the prize. I know it makes nice moving graphics that look like fluid interacting with a solid.

I have tried to get it to show flow around a symmetrical NACA foil and the nondimensional parameters keep making that difficult for me. I try one way and the flow doesn’t hit the foil. I try another way and I get nothing at all, or an undulating foil that looks like a fish swimming. I try to take the wave motion out and it just looks wrong.

I’ll just keep reading the classical fluid dynamics reference that LIlyPad’s author provides on the github.

1 Like

I don’t know how I did it, but I played with an example again and this time I modified the right parameters and got the flow to hit the foil and got a foil big enough to see and in the window. It’s kinda like a monkey banging on a typewriter long enough has a probability to actually produce a literary classic.

While I’m in monkey mode, the goal is actually to take my NACA4Series processing code and add a fluid flow. I would like to adapt that NASA paper, but for now I have something that is more likely to work, in my lifetime.

2 Likes

Here’s another shot. This is the flow after using the mouse to jiggle the solid(airfoil)around. I am trying to figure out how to change the angle of attack.

2 Likes

Hi @HackinHarry ,

Nice experiments, congrats!

Oh, this is just the beginning of a long trek. I can’t see how to change AoA but I can rotate, so I did it real, real slow.

And here’s a plot of pressure. This looks like how a cartesian grid is used in CFD. I’m not sure but I think LilyPad has some sort of grid class that I need to understand.

1 Like

I figured out how to change angle of attack, one degree at a time.

Big whoop, still need to figure out how to modify the NACA class so I can add a cambered foil.

1 Like

No progress. I’m faced with a broken computer. I’m running linux in a container on chromebook. It breaks a little worse with each google mandated update. A month ago I was still able to run Lilypad because it didn’t rely on P3D/OpenGL. Not now, now it’s saying I’m out of space on the drive and have to set the limit higher but that change is permanent. I can’t start linux because it complains about no X. I want to backup my junk because it isn’t all junk. I can’t do that because the backup drive isn’t formatted for linux.

Anyway, that’s why I haven’t made a single line of code in 2 months. This project is just pie in the sky fantasy.

The chromebook front has changed again. At the worst, the only thing that worked was the xterm. I used that to copy my work to an external drive. Each day would pass and I would contemplate the nuke option and starting over. Then, another update. As of now, processing once again starts up, as do other cool programs like Stellarium, CRRCsim, and Netbeans. The problem with processing 3.5.3 is that any sketch that uses P3D/OpenGL still causes a fatal error. If I go back to processing-2.2.1, P3D/OpenGL works but my sketches don’t because I am using libraries that aren’t compatible.

Once I get this straight, if ever, I will return to this pipe dream of a project.

Well, I’m back to this puzzle. Some people do jigsaw puzzles and I don’t but probably should. I need to build a triangle grid still that connects to the foil and then use the coordinates for each triangle to define where the calculations are made. I should probably reexamine the LilyPad code and see how it relates to the paper I’m reading again.

I can’t use BDIM like LilyPad if I want to reconstruct how the NASA paper calculates things. Here’s a shot of the grid the paper uses. I have no idea how to construct it. It looks like the background in the Processing splash screen.

I found a mesh program called Triangle. The plan is to use it to build a mesh around a NACA airfoil. No matter what CFD method or approach is used, all methods require a mesh. I tried an example and read some explanations. The only problem is all examples take some shape and fill it with triangles and I want to fill the exterior and leave the shape devoid of “Delauney triangulation” for the fairly obvious reason that the calculations need to be made in the boundary region and beyond.

I’m getting somewhere now maybe. I took the very basic box example and tried one of the command line switches that constrains the area of a triangle and I get a mesh around the outside of the inner box. The next step is to use airfoil coordinates in a box and construct the triangles around the foil. There’s still some hope for this dope.

T

I’m focused on this Triangle program now to get the triangle mesh around a foil, like in the NASA paper. As the post above shows it’s possible to draw a mesh around an object. I intend to take the .ele file of the mesh and use it in a processing sketch. Today, I used my processing NACA4Series foil shape manipulation sketch to draw a foil and then save the coordinates. I read up on the Triangle documentation and edited the foil file and then used Triangle to make a .poly file. I’m getting closer to writing something in processing.

When I triangulate it, I get triangles on the inside however. I need some sort of box around the foil like the box with a hole example.

I just simply added some coordinates for the corners of a box around the foil. The trick now is to not add triangles inside the foil. I do get triangles on the outside though and that’s good.

I still haven’t mastered the lingo used by the Triangle program. If I were to make a triangle mesh around a foil, then I need the coordinates for the vertices and that’s what I would use in a processing program. Something occurred to me though and that’s that the mesh in the NASA paper shows a flat line with lots of triangles around it. It would be far more efficient if I could create the mesh in my NACA4Series program.

Hey, that’s processing. My existing program starts as a flat line and I just need to draw a mesh of triangles around the flat line. It would be very cool to have the mesh bend and stretch with changes in camber and thickness. Here’s a shot of the NACA4Series on startup and after adding camber and thickness.

As I mentioned above, it would be cool to construct a mesh around the 0% camber and 0% thickness flat line and then have the mesh bend and grow with changes added with the sliders. So, I went back to the original code which used points. I’m able to draw a second foil around the first, kinda like concentric foils except they aren’t exactly concentric. The two foils are more like a perspective view When the foils are symmetric(no camber), they are concentric enough but when I add lots of camber with the camber slider, that’s when I get the perspective effect.

Here are the screenshots that show what I’m struggling with. I’d like the outer foil points to react like theyre connected but without crossing the inside foil. Anyone have any suggestions besides give up;)?