
[Sponsors] 
How long did it take you to implement the liddriven cavity code from scratch? 

LinkBack  Thread Tools  Search this Thread  Display Modes 
March 8, 2018, 15:58 
How long did it take you to implement the liddriven cavity code from scratch?

#1 
New Member
Karla
Join Date: Dec 2017
Posts: 7
Rep Power: 6 
I am using the SIMPLE algorithm with a central difference scheme, using ghost cells and the GaussSeidel method on a staggered grid. It has taken me a while (longer than I expected) because I had to learn all these concepts (I didn't model fluids before) and started from scratch.
I wonder how long it took you all (who did this benchmark) to implement it and run it correctly? Additionally, in what language did you implement it? I am currently working with C++. Also, if you have suggestions I will be glad to accept them. 

March 8, 2018, 16:23 

#2 
Senior Member
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 23 
http://lorenabarba.com/blog/cfdpyth...navierstokes/
I don't know how many times I've posted that link here already, but it bears repeating. While there is merit to learning things "the hard way," it need not be that way anymore. I sincerely wish I had resources like back in the 90s when I was learning CFD. That python stepbystep just covers all of the hard CFD concepts (for Finite Difference anyway) while not bogging you down with syntax or language complications. Python is (nearly) the perfect learning language, IMO. And once you get the hang of it, recoding in C/C++/Fortran requires minor effort. 

March 8, 2018, 16:43 

#3 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,150
Rep Power: 66 
The liddriven cavity was my first NS exercise when I was a student of CFD. At that time (1989) we worked on the 8088 CPU (and math coprocessor 8087 ) using Fortran. I remember that I first developed my SOR routine to use in the streamfunction vorticity formulation. Just in a couple of day I had the code running on a 15x15 grid at Re=O(10).
Now, I still suggest to my student to do the same exercise 

March 8, 2018, 23:22 

#4 
Senior Member
Lane Carasik
Join Date: Aug 2014
Posts: 692
Rep Power: 13 
It took me about a month or so to get a working liddriven cavity code using the SIMPLE method in Matlab. I had a lot of issues with programming since it was my first real programming project.


March 9, 2018, 00:57 

#5 
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,095
Rep Power: 29 
I took embarrassingly long time but I did not write lid driven cavity, I wrote unstructured grid based navier stokes solver as my first trial.
Since I never did any CFD course and I had only done computer science basic college course (CS101, Pascal) I had to learn every thing myself from scratch. It took me almost 8 months to get that code working and that was not really stable with anything complicated geometry wise. It worked with structured meshes but tetra were tough for it. The only time I wrote lid driven cavity was when i wrote lattice boltzmann solver to learn and it took me 1 day to code and have it working. (actually may be 3 to 4 hours). PS: The only course that could be considered closed to CFD that i did was fluid dynamics course and I remember I scored lowest marks in my class. :) 

March 9, 2018, 05:50 

#6 
Senior Member
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 23 
You jumped right into the deep end! But at least you didn't have to unlearn all of those "Cartesian" prejudices when you moved to an unstructured solver. 8)


March 9, 2018, 11:03 

#7  
Senior Member

Quote:
... btw, concerning the op question, it really depends from a lot of factors. The cavity is notable for the trivial bcs. Still, SIMPLE is not as straighforward as other algorithms (e.g., fractional step or vorticitystreamfunction). Moreover, it also counts if you are using precoded linear algebra routines or writing them at the moment. Finally, it is also a matter of acquaintance with programming and the used programming language. If this is your first time, focus on learning, not on time (unless, of course, you're going unreasonably long on this). 

March 9, 2018, 12:39 

#8 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,150
Rep Power: 66 
Well, actually when I wrote my first unstructured NavierStokes code I exploited many of my knowledge acquired before for structured codes...


March 10, 2018, 08:10 

#9  
Senior Member
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 23 
Quote:
Seriously, I think it is a question of degree. I spent TOO MUCH time working on Cartesian and blocktype solvers. Implementing QUICK and doing compact differences and highorder filtering and so many other things that implicitly rely on East of East and North of North neighbors, straight (or analytically curved) coordinate axes, etc. Had I done that for a semester or two and then moved on to unstructured, it would not have been too bad. But I spent all of grad school working on Cartesianstyle solvers. Moving on to development work on FLUENT 5 was like stumbling into a new country with a completely new language. 

March 10, 2018, 08:25 

#10  
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,150
Rep Power: 66 
Quote:
I think that the key is in learning either FD or FVbased approach. If you stay for years in the framework of FD, mapping of the domain and so on, I agree with you. But if you are lucky that the teacher introduces to the use of the general concept of FV, introducing the theory for the flux reconstruction and volumebased filtering, this would be so general that structured or unstructured approaches can be just slightly different. The same QUICK structure has several issues you will use. Of course, some step is required to work on complex 3D codes on unstructured grids. 

March 11, 2018, 04:39 

#11  
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,095
Rep Power: 29 
Quote:
I came back to Cartesian solver with immersed boundary for LES DNS in year 2008 or so. (produced some 4 to 5 patents for the company so they were happy). I learned FFT and block cyclic reduction with it. Had lots of email exchange with Paul (https://www.researchgate.net/publica...n%27s_Equation ) (RIP). I had very interesting journey when it comes to flow solver. This is how it went. Unstructured grid solver > Cartesian LES/DNS code > Lattice Boltzmann > Finite Volume Lattice Botzmann > Moving particle meshless method > Unstructured grid pressure based coupled solver Now finally having done all this , I wrote 1D euler code for automotive (still building on the library so in few months will become part of Wildkatze project. Now writing unstructured density based coupled solver (currently working along with higher order methods). Its amusing that all these converged to 1D code in the end :D PS: Edited to add somewhere in between were LES DNS code in cylindrical cordinate and also locally refined oct tree based cartesian solvers. 

Tags 
c++, lid driven cavity, simple algorithm 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Boundary Conditions at Corners, lid driven cavity  t.teschner  Main CFD Forum  8  August 17, 2016 08:20 
Lid Driven cavity Fortran code  Dhairya  CFD Freelancers  0  June 26, 2016 00:48 
Lid Driven cavity Fortran code  Dhairya  CFD Freelancers  0  June 26, 2016 00:42 
Boundary Conditions for Lid Driven Cavity case (SIMPLE Algorithm)  Mandeep Deka  Main CFD Forum  1  April 7, 2015 08:01 
Boundary condition for 2d lid driven cavity using ghost cells  quarkz  Main CFD Forum  9  January 20, 2013 05:54 