CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   CFD code structure (F90) (https://www.cfd-online.com/Forums/main/8463-cfd-code-structure-f90.html)

ma December 16, 2004 21:47

CFD code structure (F90)
 
I've read and written several CFD codes in Fortran, and come to know that the code structure is quite important as the code goes large. The commercial CFD codes may have a good structure but we have no chance to read them.

I am wondering how you guys construct your CFD code, particularly, TVD code for compressible reacting flow?

As for my self, several years ago, I put every thing in a single file and have a lot of "/common/...".

Later, I use a separte file, usually named PubVar.mod, to define public variables, and USE this module in the main code, which is a new attribute of Fortran 90.

Later, I found it is good to add another modue, usually named "GovEqu.mod" to encapsulate those related with governing equations, e.g., it may include subroutines like Get_Q(Q,p,T,u), Put_Q(Q,p,t,u), Get_E(Q,E), etc. The code sounds like having a "modular" structure.

Now I am going to add chemical reaction to such an existing code and have 3 options: (1) add to the main code (2) add to the GovEqu.mod (3) establish a new Chemistry.Mod

So what are your preference? Any discussion about how to improve a CFD code structure is welcome.

- ma

Saad December 19, 2004 08:29

Re: CFD code structure (F90)
 
I think you should try the object-oriented programming approach. You can use C++. OOPs is I think one of the best ways of program organisation.

Saad

David December 21, 2004 09:52

Re: CFD code structure (F90)
 
ma,

You can also use Fortran 95(2000?). Though, there are some limitations with it (inheritance)

For example:

http://www.lanl.gov/Caesar/ http://w3.pppl.gov/~pletzer/papers-reports/OOP-95/ http://www.cs.rpi.edu/~szymansk/oof90.html http://www.physics.ucla.edu/icnsp/Ht...ton/norton.htm

Also the following paper describes NASA converting a legacy fortran 77 (FUN3D) code to Fortran: Collaborative Software Development in Support of Fast Adaptive AeroSpace Tools (FAAST), Kleb et. al. 2003 http://fun3d.larc.nasa.gov/publicati...faast_software

Dave

ma December 23, 2004 12:00

Re: CFD code structure (F90)
 
Thanks for your suggestions. The above reference website is good.

- ma

Bil Kleb January 10, 2005 20:47

Re: CFD code structure (F90)
 
RE: FUN3D publications link

Better to use the main FUN3D site:

http://fun3d.larc.nasa.gov

as the names of the subpages are in flux.

Regards, -- Bil


All times are GMT -4. The time now is 19:35.