CFD - C++ vs. Fortran, and more

James Cho
  • James Cho
    James Cho

    I'm thinking about creating my own Navier-Stokes solver.  What I'd like to know is:
    Why are some solvers created in C++ and some in Fortran?  Which produces a faster solver, and by how much?
    What language is Fluent coded in?
    Could I create anything substantial CFD-wise over the course of a year?

    • I think you'd better using c/c++ rather than fortran because of compatibilty with other packages and libraries. there are numerous free libraries written in c(e.g. sgl) so that you can link it into your project without any sort of link problems.
      I hope you will take good advantage.

    • Alberto

      Hello xmnemonic,
      Fortran is an older language than C++, but it is very rich of functionalities for scientific applications. That's the reason many users still use it.
      However I don't think Fortran is a good choice today. C++ has many advantages, as a full object oriented programming, with all its advantages in terms of ease of programming and also re-usability of the code.

      Which produces faster solvers...I don't know. It depends on many factors, being your implementaton the most relevant. I'd say C++ is more efficient, but I'm not sure at all.

      FLUENT 6.0 should be coded in C/C++ I'd say. Its UDF are written in C/C++.

      You can write a solver in one year, but it requires time. Why you don't consider an Open Source solver as a starting point?
      There are some interesting projects:

      - OpenFlower ;-)
      - OpenFOAM
      - MOUSE
      - Overture

      Give them a look, expecially if you need to manage complex geometries.

      Best regards,

    • fluent ui is written in scheme. but it can call libs written in any language. just watch for underscores in func names.