https://linen.dev logo
Benchy Ma=5
# meshing
f
Let's talk here more about this
s
I set my ouet to be inletOutlet
f
Sounds good then I would not understand why it would crash if you get all your mesh qualities out the way.
run a potentialFoam to test first 🙂
Often those results already look nice although there is no vorticity
s
Does potential foam work at mach 5 given its incompressible?
f
No it doesnt work
But it does work
It is incompressible and the there is no vorticity but atleast will give you a result, and if it diverges it is a VERY high chance your URANS will also crash
Start simple, get more complex later
s
Alright, I’ll run it once I get a chance, thank you!
f
Or simpleFoam if you prefer that
s
It seems like the best way to prevent the dimples is to use a uniform number of level’s across the surface. I’m going to use 3 levels, which gets me about 1 million cells, for now, but for my final simulation I’ll aim for either 16 million or 32 million depending on if I want to run it on my laptop or desktop
s
You can use
setTurbulenceFields
for compressible initiation: https://doc.openfoam.com/2306/tools/pre-processing/field/setTurbulenceFields/
what's your strategy for boundary layers and y+ management, by the way? Gonna take some thin cells at Mach 5
OK, 5e-5 first layer height for y+ ~200 isn't too bad
f
He doesnt know about that yet, so therefore I said just run it 🤣
If your want prettiest picture just do a DNS 🤓
If he really wants to get good results he probably needs to send it over to a HPC to run it in a clueter
I run 20 million cells on 32 cores, but i do solve 8 fields that are coupled. And it is steady state, so i am reckoning it is going to take pretty long
If you want pretty pictures I was thinking just use laminar😏 like you will get some nice vorticity , it isn’t accurate but o well, a Ma 5 stationary Benchy isnt either
s
I'll try out potentialFoam first then try
setTurbulenceFields
is it keeps crashing, thank you!
How important is turbulence modeling at mach 5, I thought flow would be mostly laminar? My goal is to get a pretty picture but it would be cool to have some accuracy so it's a accurate pretty picture 😅
f
Reynolds number
s
I would just use the length of the benchy for my characteristic length, 1750 m/s as velocity, and 300 K for temperature, right? Then just use 18.45 Pa s x 10e-6 for dynamic viscosity
f
1750 m/s 🙂
I do not know the turbulent regimes for external flows, but they are probably somewhere to be found
s
I got a Reynolds number of 6,696,166, so my airflow may be a bit turbulent, just barely over 2900 🫠 So umm, how does one do a DNS simulation?
f
2900 for a sphere right>
simulations take up a few months on a good HPC
Simulation cost can range in the thousands
You can do URANS.

https://www.youtube.com/watch?v=fdzocBOkVMc▾

its like yo uwant to do this but why
s
Am I reading this right, 2.58 billion cells? I’ll do urans, that makes most sense for this. Since I plan to do a propeller simulation for a drone later, will urans still be accurate enough, or will I need to look into something more accurate like LES? I’m assuming DNS is not an option.
Does the object impact when a Reynolds number correlates to laminar or turbulent flow? Online I keep seeing that 2900 or above means turbulent flow
f
LES will take also take a long time
It does matter, but to some extend.
You can look at flow over a flat plate
or flow over a square cylinder I was looking at but I couldnt cleearly find a number
You dont need accurate results, so why not just keep it simple 😭
You cannot verifiy it it doesnt matter what you do
s
That’s true. Will using urans or just assuming laminar flow affect what the simulation looks like, since the goal is to just make a good looking simulation?
f
Using Urans will add some more diffusion, so I think you might even see less vortices. Laminar will also be much cheaper to compute 2 less transport equations
s
I’ll just use laminar then. Seems most logical here. I’m currently trying to get potentialFoam running, I’ll let you know when/if it runs once I get it configured. Thank you so much!
CFD is so fascinating but it sure loves being extremely computationally expensive! I have a feeling I'll be a owner of a threadripper sooner later, I've been wanting to make a homelab 🙂
f
it is just solving a linear equation
Ax = b
The bigger the A the bigger the multiplications, the less diagonal dominant the longer convergence for Krylov space solvers (or any matrix solver)
s
But it's solving a linear equation trillions of times. I've been thinking, gpu acceleration makes a lot more sense, wouldn't it? I'm also tempted to try to get a FPGA development board for various things, such as possibly CFD
f
You get more cores, but the cores also require enough memory
Besides CFD doesnt scale linearly, there is overhead in communicating between processor patches
You can just rent some space on a cluster and run your simulations on it
Or if you are in university often they have it themselves or you can get access on request
My university only have some EPYC chips that run 2.3 GHz max 128 cores but everyone of the faculty is on 5 of these machines, so yeah... Go figure
But ofcourse if you have abour 2-3k to spend and the power cost is cheap and the heat output and the noise, then it can be be worth. But I see more cons then pros
s
I'll definitely be renting for some of my drone simulations I'll be doing later, since those will be extremely turbulent. I'm not in a university unfortunatly. I'm tempted to get one of the extremely old quad socket motherboards for like $50 on eBay. Can easily fit 64 cores at 2.4 GHz, but with an extremely old instruction set. It will still have the same performance as a modern low end threadripper for a fraction of the cost. The only problem is the 700 watts or so the system would need, so if it's running 24/7 it's cheaper to buy modern day hardware due to electricity. I might also just try to get a cheap used 3-5 year old Threadripper from eBay. Not the newest of hardware, so it will still use up a good bit of electricity, but not nearly as bad. I don't have the disposable money right now though
f
Yes it sounds really fun to do that, I was thinking of something like that too. But it is cheaper to just run set time on a cluster.
Cost starts piling up when simulations take months
y
It's been a long time i didn't check benchmarks, but usually EPYC performs better than trhreadrippers for OpenFOAM There are some resources here: https://openbenchmarking.org/test/pts/openfoam
s
Interesting! Thank you for that. Also, I've gotten potentialFoam to run and right now I'm waiting on rhoCentralFoam. It's going to be a while though, as theres a whole lot of cells! 😅
It's going to take 6 days to run, and I still need to crank the mesh quality the heck up 🫠
f
It will probably take much longer, as the flow has not reached the refined cells yet, and the flow hasnt reached any constrictions which would lead to increased velocities, higher then the inlet. If you use constant Courant number. Just a notice it might take double the time then you expect now.
s
Oh no, how much do clusters cost? I'm also going to increase my courrent number from 0.2 to 0.5 to get it to run faster. Since
potentialFoam
is incompressible, it drops the speed to 20m/s across the mesh. I'm going to try to use
applyBoundaryLayer
to reduce the speed near the walls, so that way hopefully I can reduce the total simulation time. The simulation also doesn't need to converge to a steady state, since the goal is to just get a pretty photo
f
Technically turbulent flow is faster near the walls 🙂 due to enhanced mixing
s
Yeah but if I initialize everything at mach 5 it crashes as it makes a ridiculous;y high pressure near areas going directly into a wall and pulls the pressure into the negatives on parts were the flow is going away from the walls
My brain is about to go numb thinking about how long this simulation is going to take 😂
f
initialize it with the potential flow 🙂
or 0 velocity
s
When using potentialFoam the speed dropped to 20m/s, I'm trying to avoid initializing at 0 so the simulation will run faster. If I intialize at zero then I have to wait for the fluid to travel all of the way across plus some extra time forthings to stabilize enough to get a good picture
f
yes you intialize it somewhere
you want to go to steady state somewhere right
s
Do you know why the speed dropped to 20m/s when using potentialFoam? Thats pretty slow to be initializing things at, because a large pressure wave will form unless the speed is slowly ramped
f
What was the inlet velocity
It is pure benoulli equation pretty much (I tihnk)
s
1750m/s, I intialized the internal mesh at that as well
f
Yeah dont do that but it shouldnt matter
Initialize with 0 and does your solution converge?
s
Now everything is at zero. Heres the potentialFoam output:
Copy code
Create time

Create mesh for time = 0


potentialFlow: Operating solver in PISO mode

Reading velocity field U

Constructing pressure field p

Constructing velocity potential field Phi

No MRF models present


Calculating potential flow
DICPCG:  Solving for Phi, Initial residual = 1, Final residual = 9.75277e-07, No Iterations 380
Continuity error = 0.0107862
Interpolated velocity error = 4.62282e-05
ExecutionTime = 3.56 s  ClockTime = 4 s

End
https://cdn.discordapp.com/attachments/1436466305937969253/1437553815309258884/image.png?ex=6913a9d2&is=69125852&hm=67fcbedab9306c0f0570302952299b83298e84153659a4460c1d0ab6b6475e6b&
f
Try simpleFoam instead
What are the boundary conditions for p and U
p here is btw not the pressureFied although it is said but is the velocity potential but simular to pressure
Bit weird it says it that way
s
p is initialized as 101325 throughout, with 101325 as the inlet and outlet. For U I'm using 0 for everything with 1750 for the inlet and outlet. Heres p:
Copy code
internalField   uniform 101325;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 101325;
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform 101325;
    }
    front
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
    benchy
    {
        type            zeroGradient;
    }
}
Heres U:
Copy code
internalField   uniform (0 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (1750 0 0);
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform (1750 0 0);
    }
    front
    {
        type            slip;
    }
    walls
    {
        type            zeroGradient;
    }
    benchy
    {
        type            noSlip;
    }
}
So the p file in the 0 folder is not pressure, but rather velocity potential?
f
yes make it 0
Internalfield and the boundary
And do not use inletOutlet (possible you can)
The value of the pressure doesnt matter anyway 🙂
In incompressible flows
NVS only has the grad p
Been digging into the potential flow recently but then not for fluids 🙂
s
So like this?
Copy code
boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 0;
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform 0;
    }
    front
    {
        type            zeroGradient;
    }
    walls
    {
        type            zeroGradient;
    }
    benchy
    {
        type            zeroGradient;
    }
}
Should I use zeroGradient instead of inletOutlet?
f
I think that might help
Also for the velocity
The outlet for the velocity potential should be 0
Otherwise you get a problem
then the matrix equation isnt unique bladie bla
And violate the weakform anyway
s
Do I need to reset the pressure to 101325 before running rhoCentralFoam?
So something like this?
Copy code
inlet
{
    type            fixedValue;
    value           uniform 0;
}
outlet
{
    type            fixedValue;
    inletValue      uniform 0;
}
f
Oef yeah add up the entire field
Actually
You only use U
Or did the source code do some reconstruction of the pressure, not sure
But anyways then if it does you need to add up 1 atm indeed
No velocity potential inlet is zeroGradient
I have to go now you can always go to openfoam github to tutorials/basic/potentialFoam
s
Thank you so much!
y
If you are only interested in steady state, try running rhoCentralFoam with localEuler to use local timestepping and speedup convergence
f
no he wants a video
Ahh i get what you mean
y
oh alright, then he must suffer the long run 😅
Also, it's been mentioned before but you would probably get results faster with hisa rather than rhoCentralFoam
s
I mainly just want a photo, but a video would be cool
f
then run steady state
s
I’ll definitely try that, thank you!
f
with some intialization it is much faster
although there doesnt exist a steady state but that doesnt matter
s
If there is no steady state, then how would it work?
f
it is some sort of average of the transient state
If you find a nice resource on it I would love to read on it, because it is still on my list
it just resolve the equations if there was no time derivative
s
That would be good enough for this. I think I’ll look into running it as steady state. Thank you for the recommendation!
y
that's why I was mentioning localEuler (rhoCentralFoam is transient and there is no steady alternative solver)
s
Thank you!
f
comes from the contuinity equation
$\frac{\partial \rho}{\partial t} + \nabla \cdot \mathbf{u} = 0$
f
@superspacehog how is your benchy
s
Haven’t been able to work on it much, I’ve gotten busy. The several GB worth of storage the incomplete simulation files takes up keeps reminding me to finish it at some point 😅
I think I'll move away to another project. I don't really have much free time (school) and at this point most of my problems are just related to initializing a mach 5 simulation. I want to design a custom silencer for my 3d printer's psu fan so I'm going to start working on trying to simualte acoustics with a compressible simulation.
f
Not sure why you would want to simulate it only for the reason of doing a simulation because it is fun
but replacing a psu fan maybe not the smartest idea 🙂
so I get the idea of building an enclosure
s
To optimize canceling out the sound waves (and learning smoothing even if that fails). I currently don't feel like dealing with replacing the fan so I'm building a part to go on as a silencer. Then at some point if I do replace the fan then it will be even quieter. I can also then design similar silencers for other fans around the printer. I'm hoping my simulating the silencer/enclosure I can see how the soundwaves are cancelling out to further optimize it. The only problem I see is that I will need a ridiculously fine mesh! (And probably a lot more ram and patience, perhaps even some cluster credits)
f
man you got yourself again a very difficult problem
how will you accurately simulate the noise coming from the fan itself, you would need to simulate the rotation of the fan
s
I would cheat a little. I would use a microphone to record the waveform of the fan noise. Then, use the waveform and rapidly adjust the pressure of the fan hole to fake the audio. I wouldn’t bother with simulating airflow as the main source of noise is from the fan within the psu, not the airflow externally.
f
you have to be bit careful with boundary conditions in this case as defining two static pressure dirichlett boundaries will diverge, governed by the weak form. You rather have to use something like a stagnation pressure, or by that matter something that relates the given pressure input data to fluid velocity. Probably there are some BC that do that internally
s
I'll check out the options then to find a method that will work for my use case. Thank you!