CFD with FreeCAD!

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Of course. As I mentioned in the CoP thread, this was just a start with CFD, not the final answer. I spent 30 years doing automotive CFD. I set up this model with methods used in industry. Yes, URANS sucks. DDES is a good choice for transient accuracy, while RKE and k-omega sst are good for steady-state. We would do a lot of what-if studies quickly in steady state, and then final confirmations with DDES.

While the Cfd workbench makes the setup easy, the user still needs to understand how to properly run a CFD model. I am just thrilled that this model meshed, ran, and converged without blowing up. On the first try.

Remember AeroCFD from the AeroRocket guy? That was limited to 2D, symmetric, Euler flows, I think. Other CFD discussions on the forum usually involved somebody messing around at their workplace with spendy commercial software. FreeCAD is full 3D Navier Stokes simulations that seemingly run robustly on a home computer. That puts a powerful tool within reach of hobbyists. See the readme for a list of capabilities:

https://github.com/jaheyns/CfdOF
Can you do some lessons on CFD basics?
 
I asked for math in the other thread on short rockets and got it here.
I'm EE and work with an ME who specializes in Fans and Airflow. He calls himself a fan geek.
I'm going to gently slosh this onto his desk and see what happens.
Fluid dynamics, I hope.

Cheers / Robert
 
While the Cfd workbench makes the setup easy, the user still needs to understand how to properly run a CFD model. I am just thrilled that this model meshed, ran, and converged without blowing up. On the first try.
Figuring out how to make this sort of thing bullet-proof enough to be usable by people who don't have the experience to dial it in is going to be a big problem for making CFD a standard solution for the general rocket designing public.

That said, this looks _way_ easier and more capable than I was expecting. The state of the art really has improved since last I was paying attention. We all definitely need to start paying attention to this...
 
Downloading Sim Flow and install seems easy enough, but I can't get it to run. I'm trying the NACA 0012 airfoil, but perhaps this is too ambitious. I see it is 200,000 cells and Sim Flow looks like it is directing me for a 30-day trial. This is the second time I tried downloading and installing. The first time I did not see the desktop icon, but now I see. The 2 simple cases like the "can" are not there now.
 
Update. I got the MPI CFD runs working. (This was not really a FreeCAD problem but more of an issue on my system.)

I ran this simulation on 4 cores to the same level convergence as Post #1. Took 1.5 hours vs. 3.0+ hours on one core. Not bad.

This will certainly speed up future studies. đź‘Ť
 
Well, I meshed the 90-degree bend pipe flow using the Sim Flow recommended tutorial on my old clunker home PC with Windows 10. Seemed easy enough and fast enough. I thought it was funny that Sim Flow asked if I was using a serial processor. This is different from 14 years ago in the office when we would specify the number of cpu's on the Linux.
 
Last edited:
I ran the Sim flow pipe flow tutorial on my PC with the solver and my one cpu and watched the Residuals go down just like the old days at work. It only took about 476 seconds, so I assume it was a relatively small problem. The post processing with Paraview was possible, but I had difficulty. There is a tutorial for Paraview.
 
I ran the Sim flow pipe flow tutorial on my PC with the solver and my one cpu and watched the Residuals go down just like the old days at work. It only took about 476 seconds, so I assume it was a relatively small problem. The post processing with Paraview was possible, but I had difficulty. There is a tutorial for Paraview.

What prompted you to use Sim Flow? Are you using the trial or paid version? The trial version is limited to 200k nodes. I am using 2M nodes in FreeCAD.

What are you using to create geometry? The nice thing about FreeCAD/CfdOF is that the geometry and CFD are integrated together, so you can design and test seamlessly.
 
What prompted you to use Sim Flow? Are you using the trial or paid version? The trial version is limited to 200k nodes. I am using 2M nodes in FreeCAD.

What are you using to create geometry? The nice thing about FreeCAD/CfdOF is that the geometry and CFD are integrated together, so you can design and test seamlessly.
Perhaps, I need to start over. I think I did a search for OpenFoam GUI and I got to the OpenFOAM GUI-Sim Flow CFD website. That site directed me to download the Windows(64-bit) Sim Flow 4.0 (supports Open Foam 1812), which you are right is only 200k nodes. The Sim Flow tutorials have a mesh generator in the Sim Flow program. I am wondering how to download FreeCAD/CfdOF ?
 
As you know the Fatboy with zero AofA can be reduced by factor of 3 by putting in planes of symmetry boundaries 120 degrees apart. Of course, this cannot be done for a non-zero AofA. Then the full 3D model must be used.
 
I finally got the FreeCAD to work for the backward step shown in the second tutorial in Post #13. Thanks to Buckeye for all his work. Also, thanks to Boatgeek for his help. I deleted all the constraints in Sketch of FreeCAD. Perhaps, that helped. At first I used the meshing option from the CfdOF pull-down. These meshing routines did not work and I wasted a lot of time. Finally, I found the mesh bottom on the tool-bar that looked like a globe. I am concerned about the turbulent models. I don't know if they are using wall functions for the turbulence models.
 
I am concerned about the turbulent models. I don't know if they are using wall functions for the turbulence models.

You will have to dig into the OpenFOAM source code. My results include a turbulent viscosity variable (nut), which I believe requires wall functions.
 
You will have to dig into the OpenFOAM source code. My results include a turbulent viscosity variable (nut), which I believe requires wall functions.
It sounds like FreeCAD is using wall functions. I assume that it is doing this automatically. As I recall Sim Flow had the option to turn on/off wall functions. I see no on such provision in the FreeCAD CfdOF. When using wall functions, the user makes cells next to the wall on the order of y+= 30. I found some information on the FreeCAD forums. One user years ago wanted to have wall cells on the order of y+=1 and integrate through the viscous layer, inertial sub-layer, etc. to capture the hear transfer coefficient from the turbulent model. Some of the same issues come up for low Reynolds number or viscous flow. Dave Wilcox (unfortunately passed away a few years ago) was a promoter of the k-omega model and wrote a book on the subject. Dave used wall functions, of course, but claimed that his k-omega could go all the way down successfully to a wall y+=1, if the user made the grid small enough. I found a few things on the forum:

https://forum.freecad.org/viewtopic.php?t=32888

https://www.cfd-online.com/Forums/openfoam-solving/86855-near-wall-treatment-k-omega-sst.html

https://forum.freecad.org/viewtopic.php?t=85760
 
Last edited:
After some effort I got the Tutorial #9 to work for vortex shedding behind a 2D cylinder for laminar flow using URANS. Apparently, the code and the procedure has changed since this tutorial was written. The 2D version is now found in 'extrusion' in the mesh refinement option. Also, I extended the extrusion for 30 mm, which is the thickness of the 2D cube. I found this information for doing this in FreeCAD CFD forum:

https://forum.freecad.org/viewtopic.php?t=66741&sid=b3f4a6c5fd55644202809e6cd9346ba2

A special thanks goes to Buckeye. Even after doing this procedure the simulation still didn't work. The code wanted no spaces in the boundary condition names. It was that simple. I thought the error was talking about some kind of spaces in the mesh.
 
Last edited:
When I bring a "previous" successful FreeCAD CFD run to look at the results in Paraview, I see the latest Paraview results for the last successful case I ran. How do I select the Paraview results I want?
 
I finally managed to get some results! Now we clean up the model a little bit and work on a few options. One unusual thing I noticed on this and another test simulation is that the inlet flow is explicitly parallel to rocket CL, but it clearly shows that the wake is lower than rocket CL on the left. I need to do a little troubleshooting on that. The image below is velocity magnitude, and ignore the fact that the fins are barely attached to the rocket. I'm working on that too.

1709700678699.png

@Buckeye, what Paraview settings did you use to generate the images like the third one here?
 
I finally managed to get some results! Now we clean up the model a little bit and work on a few options. One unusual thing I noticed on this and another test simulation is that the inlet flow is explicitly parallel to rocket CL, but it clearly shows that the wake is lower than rocket CL on the left. I need to do a little troubleshooting on that. The image below is velocity magnitude, and ignore the fact that the fins are barely attached to the rocket. I'm working on that too.
Take this with a grain of salt - I'm a structures guy and don't do any CFD professionally - but the little I've played with my company's tool testing airfoils, your simulation boundaries (and most of the other pics I've seen in these threads lately) seem way too close to your rocket.
 
Take this with a grain of salt - I'm a structures guy and don't do any CFD professionally - but the little I've played with my company's tool testing airfoils, your simulation boundaries (and most of the other pics I've seen in these threads lately) seem way too close to your rocket.
That’s a good thing to mention. Up to now, I was focused on getting a run that I could look at easily and see how the results look without breaking the computational time bank. For example, this one ran in about 5 minutes. I’ll do some sensitivity work on mesh size and domain size later on. I know that I need to do better mesh refinement as well.
 
I finally managed to get some results! Now we clean up the model a little bit and work on a few options. One unusual thing I noticed on this and another test simulation is that the inlet flow is explicitly parallel to rocket CL, but it clearly shows that the wake is lower than rocket CL on the left. I need to do a little troubleshooting on that. The image below is velocity magnitude, and ignore the fact that the fins are barely attached to the rocket. I'm working on that too.

View attachment 634161

@Buckeye, what Paraview settings did you use to generate the images like the third one here?

Nice start! I don't really see the wake as being too low. Optical illusion? Is your mesh asymmetric?

The 3rd image in my post is a slice with Representation > Surface LIC

Line Integral Convolution is an imaging technique to view vector fields. It is a quick and dirty way of viewing velocity streamlines.
 
When I bring a "previous" successful FreeCAD CFD run to look at the results in Paraview, I see the latest Paraview results for the last successful case I ran. How do I select the Paraview results I want?

This occurs probably because CfdOF is always writing to your temp folder by default. This sucks. For each new simulation, I manually change the folder to something else:

Edit > Preferences > CfdOF > Default output directory

Paraview is not for the faint of heart, but there are a lot of YouTube tutorials.

I was a long time EnSight user, so I am still learning the Paraview conventions. File I/O is particularly annoying.

When you click the Paraview button in CfdOF after the simulation is complete, it executes Paraview from the case folder with a script called "pvScript.py." You can replicate that same process on any previous case.

What I do now is click the Paraview button upon simulation completion. After the model/script loads, I immediately File > Save State. Then File > Load State when I want to load up that model/results in the future. Save State will also save all your work in the pipeline.
 
Last edited:
Take this with a grain of salt - I'm a structures guy and don't do any CFD professionally - but the little I've played with my company's tool testing airfoils, your simulation boundaries (and most of the other pics I've seen in these threads lately) seem way too close to your rocket.

Good observation. Do you have a recommendation?

In my model, the (frontal area of the rocket)/(frontal area of the domain) < 1.0%. I prefer 0.1%, but this was my first test case, so I wanted a reasonable run time.

Applying continuity correction on the 1% blockage, there would be 1% overshoot in velocity magnitude, and about 2% overshoot in force. So instead of Cd = 0.506, corrected Cd = 0.496. Probably close enough for what we are doing here.

Force correction = (1 - BlockageRatio)^2

Definitely need to keep blockage in mind when pitching the model.
 
Good observation. Do you have a recommendation?

In my model, the (frontal area of the rocket)/(frontal area of the domain) < 1.0%. I prefer 0.1%, but this was my first test case, so I wanted a reasonable run time.
No recommendation from me on this. I imagine it would depend on velocity, angle of attack etc. - probably there are plenty of Google hits. Definitely appreciate aiming for reasonable run times.

As @boatgeek mentions, if I were working on this, before I drew any conclusions from my model I would fire off a couple models with larger volumes to understand any error from this effect. Probably one which has dimensions ~2x, and another much larger. You should be able to plot various points (not sure what's used for CFD, I would just pick a parameter you're after like cd) as a function of your boundary dimensions/volume etc and see it converge (not necessarily the right answer, just not dependent on volume anymore) as it gets larger.

Nice job with this!
 
No recommendation from me on this. I imagine it would depend on velocity, angle of attack etc. - probably there are plenty of Google hits. Definitely appreciate aiming for reasonable run times.

As @boatgeek mentions, if I were working on this, before I drew any conclusions from my model I would fire off a couple models with larger volumes to understand any error from this effect. Probably one which has dimensions ~2x, and another much larger. You should be able to plot various points (not sure what's used for CFD, I would just pick a parameter you're after like cd) as a function of your boundary dimensions/volume etc and see it converge (not necessarily the right answer, just not dependent on volume anymore) as it gets larger.

Nice job with this!

Thanks.

Mesh independence analysis is a career in itself. Domain size is probably the least of the concerns, since the domain can be increased with a (relatively) few more big cells at the extremities. A continuity correction, like I mentioned, can also be applied. Surface mesh, boundary layer mesh, and wake volume mesh resolution are always the big questions, and those cells add up fast. Most of the best practices are tribal knowledge.

Yep, a couple mesh iterations to begin is always a good thing to do. I did about 20 on this model, judging goodness mostly by eye and a few by result sensitivity. OpenFOAM and other geometric meshes are good for this, as you can simply change one number (the base mesh size), and all the refinement regions will adjust proportionally.

Eventually, you have to shoot the CFD analyst and move on to using the results for something practical.
 
Nice start! I don't really see the wake as being too low. Optical illusion? Is your mesh asymmetric?

The 3rd image in my post is a slice with Representation > Surface LIC

Line Integral Convolution is an imaging technique to view vector fields. It is a quick and dirty way of viewing velocity streamlines.
Thanks! I had a slightly asymmetric mesh right behind the rocket, and it's clear that the fins need some refinement. I also re-ran the analysis with the CL face as a symmetry constraint instead of a slip wall. That helped reduce the asymmetric flow just aft of the rocket, but didn't eliminate it entirely. It's possible that the body tube, fins, and/or nose cone are not exactly in line with rocket CL. FreeCAD has a mildly annoying "feature" where you can accidentally change positions or orientations of geometry by scrolling while over an input field.

Mesh:
1709814411341.png

Flow:
1709814316233.png

I think I've gone about as far as is useful with this model, so I'll start up with a "real" simulation model where I can correct the fin locations, do a nicer refinement near the rocket, and do some mesh size studies. Looking at the flow lines, I'm pretty happy with the domain size, though I will test some bigger fields.
 
Good observation. Do you have a recommendation?

In my model, the (frontal area of the rocket)/(frontal area of the domain) < 1.0%. I prefer 0.1%, but this was my first test case, so I wanted a reasonable run time.

Applying continuity correction on the 1% blockage, there would be 1% overshoot in velocity magnitude, and about 2% overshoot in force. So instead of Cd = 0.506, corrected Cd = 0.496. Probably close enough for what we are doing here.

Force correction = (1 - BlockageRatio)^2

Definitely need to keep blockage in mind when pitching the model.

Correction. My domain is actually closer to 0.1% as I like. 1500 mm x 1500 mm, and the FatBoy is 66 mm diameter. So, that blockage works out to be 0.15%.

Corrected Cd goes from 0.506 to 0.504.

I am working on some AoA models, so the domain will get bigger to keep a similar blockage.
 
Working on a first "real" simulation. I was surprised at how thin the layers at the rocket surface needed to be to get to a y+on the order of 10. I also wasn't very successful in getting multiple polygon mesh refinements to work like you had done. I could get one box inside the main model, plus a "distance form the rocket surface" one to work. Finally, I just love it when residuals do this kind of thing. It is still working, so we'll see what it comes up with. The domain is 1500x1500 with a 100mm-diameter rocket, so we're looking at ~0.4% obstruction.

1710185750080.png
 
I ended up having to abandon the simulation above and model it with a thicker boundary layer. That model was going weird, like drag forces in the range of 1E110 N. I did get it running, and saw the same asymmetry as above. Arrgh. Then inspiration struck and I went looking for a gravity term. Huzzah! I was applying gravity, in the negative Y direction, which would explain airflow appearing to flow down to the left (+Y is up on those views, airflow from the left). So I deleted gravity from the model and got...

Exactly the same flow asymmetry. Double arrgh. You can see that the wake is about even with the top of the body tube on the top of the rocket, and substantially below it on the bottom.
1710211691956.png
I should probably try a repeat with modeling the entire domain instead of assuming symmetry about centerline. That will double computation time, but maybe there's something weird about the constraint that's messing me up.

On a sanity check, I did see that my domain looks to be a reasonable size. The incoming velocity is 300 m/s, to match the OpenRocket CP calculation of Mach 0.3. At the edges of the domain, the velocities vary less than +/- 1 m/s from that incoming speed.
 
Back
Top