r/CFD • u/Overunderrated • Feb 03 '21
[February] Programming languages for CFD
As per the discussion topic vote, February's monthly topic is "Programming languages for CFD"
User /u/SignificantCell2 asked for Rust experiences, but that sounded overly specific so i op'ed'd it into this.
Talk about your experiences and preferences with various programming languages in the context of CFD programming.
43
Upvotes
View all comments
Show parent comment
13
u/Overunderrated Feb 03 '21
I would say the differentiation comes about at larger scale. Fortran is absolutely wonderful for all things math and array-based -- concise, clear code with great performance.
Where it starts to suck is when you wander outside of the core numerics -- user interfaces, file io, graphics, options, yadda yadda. In large scale numerics codes (million+ lines) you'll find that actual number crunching code is exceptionally small, 5% or even 1% of the total code size. So it's not so much that I opt for C++ "because it's better for CFD", but "because it's better for literally everything else i have to do, and is also acceptable for the numerics stuff."
If you're talking toy codes or even academic-sized solvers, I agree it really doesn't matter much, although that's becoming less true with accelerator-based environments leaving fortran behind.