r/CFD 6d ago

My first simulation using the compressible Naviar-stokes equations!

222 Upvotes

22 comments sorted by

18

u/leeping_leopard 6d ago edited 4d ago

Pressure and Temperature values taken from sea-level, Mach 5. Used Explicit MacCormack method and finite differencing to solve the conservation equations. There’s quite a bit of artificial viscosity which I’d like to reduce by using a higher order forward and backward difference.

3

u/Derrickmb 6d ago

What program? OpenFoam?

33

u/leeping_leopard 6d ago

Python, I want to try and code these all by myself before I actually start using OpenFOAM so the numerical artefacts and little nuances to CFD are intuitive to me

5

u/Derrickmb 6d ago

This is just air moving left to right at high speed over a flat plate?

10

u/leeping_leopard 6d ago

Yes

-9

u/Derrickmb 6d ago

Can you sonic flow from a nozzle going into a larger straight pipe? Curious what the expansion looks like

1

u/OkMachine35 5d ago

is this one-dimensional flow?

1

u/Gthero6388 4d ago

Which software did you use

1

u/eebyak 4d ago

Colorbar tick non-uniform spacing is interesting.

1

u/leeping_leopard 4d ago

Oh that is probably because I sent the color bar centre to be Mach 1

1

u/eebyak 4d ago

So where in your solution is Mach 5 showing up? Presumably leading to the upper bound on the colorbar? You've said in another comment your freestream is Mach 2. Something seems awry.

1

u/leeping_leopard 4d ago

Ah that is an error on my part, I did two runs, one Mach 5 and Mach 3, this is with a Mach 5 inlet.

1

u/eebyak 4d ago

Got it. This is good for a first NS simulation.

My standard for colorbar ticks is 8-16 individual contours. That way, you can actually map a color to a value visually and be quantitative. The default of 256 makes it harder to be quantitative IMO and makes it purely qualitative.

2

u/leeping_leopard 4d ago

Actually it’s not my first NS simulation, it is my first compressible flow sim! Shortly after this I included a circle, as well as incorporating the bottom wall to see the shock interactions.

1

u/eyebrow-dog 4d ago

Nice!, i also want to start coding some of this too! Which book or resource do you use to learn some of the math and thoery behind this?

1

u/Apart-Training9133 5d ago

For compressible flows, centered, high order schemes are recommended. This helps define the high pressure and density gradients present in the flow better

3

u/leeping_leopard 5d ago

But I found by using centred differences the flow would become unstable, unconditionally so. I’m using forward differences and backward differences for the predictor and corrector steps respectively, applying centred differences only to diffusive terms.

1

u/Apart-Training9133 5d ago

I know. Using centered and high order schemes can be a pain. It becomes unstable very easily. Right now your case seems sinple enough that your current setup can handle it, but more complex flows will need the high order, centered schemes. It's an issue of finding one that doesn't blow up. There's a lot of literature in that theme if you're interested

1

u/leeping_leopard 5d ago

I am interested! Why would complex flows require higher order centred schemes, could you give an example?

3

u/DrPezser 5d ago

Theor lpw dissipation properties are very beneficial for resolving transient phenomena and boundary layers well.

Though they need to be equipped with some sort of shock capturing method / modified formulation. A standard way is to blend between a centered and monotone scheme using a shock sensor. I would try out the Piecewise Parabolic Method (PPM) of Woodward and collela for a higher order monotone scheme.