CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Searching for feedback when solving 2D flow around a cylinder.

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By BadOwl
  • 1 Post By BadOwl

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 13, 2025, 14:13
Default Searching for feedback when solving 2D flow around a cylinder.
  #1
New Member
 
Join Date: Jan 2025
Posts: 7
Rep Power: 2
BadOwl is on a distinguished road
hi,


as a total beginner to the world of cfd (and the world of aerodynamics in general), i am trying to get started by computing the drag coefficient of a 2D cylinder.

i chose this problem as i want to solve external flow around aircrafts at high angles of attack, which involves boundary layer separation. Hence i think this problem is a good starting point.

As i have little confidence in what i am doing, ill first try to present the details of my thought process and what i modeled before presenting the issue. So if i made mistakes, i would be very happy to hear feedback from anyone.


I am using FreeCAD CFDof workbench for convenience



Geometry:
i used a cylinder of diameter 0.1m, exposed to 3 m/s of air at 15°C, which should give a Reynolds number ~ 2E4.
Believing what i read, this corresponds to a fully turbulent vortex shedding of frequency of around 5.9 Hz.
Hence i chose to use a transient RANS model.

Side question : Is it possible to use a steady-state in this situation to compute average drag or shoud i instead, average the results of the transient simulation.


Boundary conditions:

Inlet : I used an inlet of height 1.8m with uniform velocity and zero gradient pressure
For the turbilence parameters at the inlet, i used 2% turbulence intensity and a characteristic length of 12.5mm
Outlet : I used a total pressure outlet with pressure set to 0
Top and bottom were defined as slip walls. I tried open BC on these but it did not seem to change anything
Sides :defined as empty

Cylinder : For the cylinder i used a no slip boundary condition. + wall function.


Side question : As i am going for a y+ = 1 I tried using no wall functions, however, as i am using CFDof (one of freecad's workbenches for interfacing with openFOAM), the created mesh case always has wall functions selected. I tried removing them by setting the values of k, epsilon and omega but openFOAM crashed. I also read on a forum that this was not a problem if wall functions were used with a y+ of 1 but i am not sure about that.) Is there a problem here?

(Used wall functions are : EpsilonWallFunction, KqWallFunction, nutKWallFunction.)


Meshing process:I used cfmesh with a base element size of 20mm and 2 refinement zones:
- one zone to capture the wakes and the flow arond the cylinder
- One boundary layer zone.


For a first initial guess, i used a flat plate estimation for the first cell thickness and then used the openFOAM yPlus reporting function to refine the mesh.
Without surprise, the lowest y+ around the cylinder was lower than the estimated value. (Estimated : 100um, "real" : 50um)



However, when solving (using k-omegaSST as k-epsilon seems to be a bad choice for such flows), i observed that the residuals look verry "jittery", which does not look good, (but perhaps it's not an issue because this is a transient simulation?)



The drag coefficient seems to converge to an average value of 0.9, which is quite far from the expected value of 1.1 at the reynolds this simulation is running at.



If anyone has any feedback on what i am doing, i would really like hearing from you
BadOwl is offline   Reply With Quote

Old   January 14, 2025, 06:56
Default
  #2
New Member
 
Join Date: Jan 2025
Posts: 7
Rep Power: 2
BadOwl is on a distinguished road
ok so i have lade a few mistakes when posting for the first time.
1. i included images but these got lost for some reason,. I will try to include images here using an external site.


In the meantime i have understood some of my mistakes. One being that i did not fully understand how to control the boundary layer thickness with cfmesh.


Hence, i was able to mesh the boundary layer of the cylinder more accurately, which led to better results BUT i ran into a behavior i dont understand yet.


I measured the boundary layer thickness on paraview to be around 2.3 mm.

In the image attached, i managed to mesh the boundary layers with a first cell height of approximately 85um, (giving a maximum y+ ~ 1.18) + 15 layers with a growth factor of 1.05 giving an inflation layer 2mm thick, close (enough?) to the boundary layer thickness i measured on paraview.


The CD's average value was 1.13, much closer to the 1.17 i was expecting at this reynolds.) However, signs of instability are showing in the solution. What would be the explanation here?





Drag & lift coefficients function of time https://postimg.cc/VdbTc5p8
Inflation layer : https://postimg.cc/Z0KnjvnV
FreeCAD file : https://filebin.net/ncvxa3tdlflzskj7
Tobermory likes this.

Last edited by BadOwl; January 14, 2025 at 07:01. Reason: typo
BadOwl is offline   Reply With Quote

Old   January 14, 2025, 07:13
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 792
Rep Power: 14
Tobermory will become famous soon enough
Code:
However, signs of instability are showing in the solution. What would be the explanation here
If you mean the sinusoidal-like variation in the lift/drag traces, then that is the vortex shedding off the back of the cylinder - you are predicting just over 6 cycles a second, which is pretty damn close to your theoretical value of 5.9Hz.

I'd say you are doing remarkably well for a CFD/fluids newbie! This is not a trivial test case.

PS. a puzzle for you - why are the Cd oscillations twice the frequency of the Cl oscillations? Try plotting contours of the wake, and if you can animate them ... you'll start to get a feel for what's going on.
Tobermory is offline   Reply With Quote

Old   January 14, 2025, 08:20
Default
  #4
New Member
 
Join Date: Jan 2025
Posts: 7
Rep Power: 2
BadOwl is on a distinguished road
Thanks a lot for your reply, a little boost in confience is always nice



Quote:
Originally Posted by Tobermory View Post
Code:
However, signs of instability are showing in the solution. What would be the explanation here
If you mean the sinusoidal-like variation in the lift/drag traces, then that is the vortex shedding off the back of the cylinder.

It's kinda hard to see on the plot because it's on the verge of diverging outright but if you look closely at 0.3s you can see a high frequency oscillation in the solution. This oscillation can also be seen (although much smaller) on the CD plot when the drag oscillation is "going up".


As for your bonus question, i would say (and sorry in advance if i lack the technical vocabulary) that:
- When a vortex is forming behind the cylinder, it creates a pressure drop that causes an increase of drag, so for each vortex shed, there is a positive drag increase.
However, for the lift, it is increased by vortices forming on the bottom of the cylinder. As the vortice grows, it creates a more profiled shape (almost wing like) for the airflow, but as it is slightly on the bottom of the cylinder, this offsets the profile towards a positive AoA, hence positive lift and vice versa for the top vortices.


Hence, there is one maximum in lift coefficient every two vortices shed.
Tobermory likes this.

Last edited by BadOwl; January 14, 2025 at 08:23. Reason: typo
BadOwl is offline   Reply With Quote

Old   January 14, 2025, 10:22
Default
  #5
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 792
Rep Power: 14
Tobermory will become famous soon enough
Aaah - I see now; I guess the Cl trace (t>2) may also be a bit noisy. Keep an eye on the Courant number - if that gets too high, then the solution will degrade and the run may even diverge.

Also, for a transient run, it's worth checking how far the residuals fall in each time step: remember, you are trying to iterate down to a "good-enough" solution at each timestep ... if the residuals for a variable have only reduced slightly, then you may need to allow for more iterations per time step or reduce the time step to give the solver an easier time.

And as for the shedding frequency, yes - absolutely right.
Tobermory is offline   Reply With Quote

Old   January 14, 2025, 11:26
Default
  #6
New Member
 
Join Date: Jan 2025
Posts: 7
Rep Power: 2
BadOwl is on a distinguished road
ok so i looked into the control dict and it seems i was inadvertently using a simulation with adaptive time step based on a maximum courant number of 5, perhaps this is a bit high but i'm not sure. (i have read that OpenFOAM was able to manage even higher values)
In doubt, i set the value to 1 (and 0.5). Of course, it did put my computer on it's knees but it did not change anything. Hence i belive the problem comes from the mesh.


I tried a different strategy (which seems very wrong but trying wont hurt). I made the mesh coarser (to reduce the courant number) and, in order to still get a somewhat smooth transition between the boundary layer and the rest of the mesh, i used a lot of layers (40) while keeping the expansion ratio and first cell height identical.


This mesh yielded a less noisy solution (although this time the drag coefficient is really off, which does not surprise me).
I dont belivethis way of meshing problems is a good idea as it creates thin cells outside the boundary layer region.






Do you know good open ressources on good practices for meshing boudary layers when simulating flow separation?


https://postimg.cc/pmjHb1HX
BadOwl is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rhoSimpleFoam High Pressure Cell Crashes Simulation NorthCFD OpenFOAM Running, Solving & CFD 0 March 3, 2023 06:02
#0 prinStack(Foam::Ostream&)sh:1 addr2lin: not found addr2line failed jerrry51 OpenFOAM Running, Solving & CFD 0 September 2, 2022 15:33
Help sought on axial compressor simulation jyotir OpenFOAM Running, Solving & CFD 0 November 17, 2021 11:49
pimpleFoam: turbulence->correct(); is not executed when using residualControl hfs OpenFOAM Running, Solving & CFD 3 October 29, 2013 09:35
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 17:13.