|
[Sponsors] |
August 14, 2014, 14:29 |
Best practices in CFD (code structure)
|
#1 |
Senior Member
Joachim
Join Date: Mar 2012
Location: Paris, France
Posts: 145
Rep Power: 15 |
Hey everyone!
I would like to improve the organization of my CFD code (in Fortran 90), and I would gladly appreciate any suggestions/comments you might have! To summarize, here is the current structure: 1. import grid / construct metrics, volumes, etc 2. initialize solution ----------------time loop--------------------- 3. compute residuals - compute roe fluxes (including turbulent terms) - compute transport fluxes (both laminar and turbulent at same time) - compute source terms if any 4. update solution (laminar and turbulent at same time) 5. impose new boundary conditions in ghost cells and update dependent variables --------------------------------------------- I have constantly stored in memory the state variables, as well as dependent variables (pressure, temperature, speed of sound, viscosity, etc + turbulent quantities such as eddy viscosity, blending functions, etc). I read that in CFL3D, they only stored the primitive variables, but in FUN3D, they were basically storing everything. Which approach would you recommend? Some people told me it might be better to separate laminar and turbulent subroutines, and put the latter in a big module. That would make things a bit more clear. However, if I consider the Roe fluxes computation for example, I will need uL and uR in for my turbulent fluxes too. It means that I either have to store them and waste memory or recompute them and waste CPU time... I guess the new structure would look something like that: 1. import grid / construct metrics, volumes, etc 2. initialize solution ----------------time loop--------------------- 3. compute NS residuals 4. add turbulent residuals 5. update solution (laminar and turbulent at same time, since my code is tighly coupled) 6. impose NS boundary conditions 7. impose turbulent boundary conditions ---------------------------------------------- I was also suggested to use structures for my grid, solution, etc. Any comment about that? What is, in your opinion, the best way to structure a code? I know there is not a single right answer to that question, but I would gladly hear your suggestions! Thank you very much! Joachim |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
general ARCHITECTURAL structure of the code of a CFD code | mecobio | Main CFD Forum | 0 | August 12, 2013 08:04 |
Give me some advice CFD in Fortran code or Matlab code. | tringuyenttt | Main CFD Forum | 4 | May 29, 2013 08:32 |
STRUCTURE OF CFD CODE | MAB | Main CFD Forum | 5 | August 10, 2008 03:47 |
Structure of CFD code | Shyam | Main CFD Forum | 5 | April 26, 2006 12:04 |
ASME CFD Symposium | Chris Kleijn | Main CFD Forum | 0 | August 22, 2001 06:41 |