Fortran for Computational Fluid Dynamics Problems

In summary: I see you mention hot gas diffusion but could you provide more details?In summary, Ulfa Azmi introduces herself as a new member and a master's student studying CFD and fluid dynamics. She has been assigned a project involving simulating fluid dynamics using Fortran, a language she has no experience in. She asks for recommendations and help in learning Fortran and expresses concern about completing the project in a year and a half. Other members suggest using other programming languages and software tools such as OpenFOAM.
  • #1
ulfaazmi
17
1
Dear, Everyone
I am a new member here, nice to meet you..

First, I want to introduce my self, I am a master student of physics and I am studying CFD right now. It's a new topic for me and I will also do my research about simulation of fluid dynamics related to CFD. Actually, I got this topic from my supervisor, and he suggested me using fortran to do such simulation. However, I haven't ever using fortran before. Do you have an experiences in this field ? or do you have any recommendation book of Fortran related to this subjects?

I hope you can help me, Thank you very much.

Regards,

Ulfa Azmi
 
Technology news on Phys.org
  • #2
What programming languages do you know? Fortran isn't hard to pick up if you already know a procedural language.
 
  • Like
Likes ulfaazmi
  • #3
DrClaude said:
What programming languages do you know? Fortran isn't hard to pick up if you already know a procedural language.
Actually, I ever studied Pascal and Matlab programming. Unfortunately, I haven't understood well because I seldom use it. But, now, I am really want to study a programming languages seriuosly. please help me, what should I do? Is it will be hard for me?
 
  • #4
  • Like
Likes ulfaazmi and FactChecker
  • #5
DrClaude said:
It is hard to say if it will be hard for you. Some people pick up programming quite easily, others have to work harder at it.

Concerning Fortran, the only books I have in mind assume some knowledge of programming. There are some online resources that appear to start from basic principles:

https://www.fortrantutorial.com
https://pages.mtu.edu/~shene/COURSES/cs201/NOTES/fortran.html
https://classes.soe.ucsc.edu/ams213/Spring14/sections/
Thank you very much for your information, I am glad you may help me. I have checked the websites and it's good and will be helpful for me. I will study it well.
Thank you.
 
  • #6
The Fire Dynamics Simulator which is used by my colleagues for simulating the fluid dynamics and chemical kinetics of combustion, is made with FORTRAN and the code is open source. I can't see why FORTRAN wouldn't be a good choice for other fluid dynamics simulations as well.
 
  • Like
Likes ulfaazmi
  • #7
I am not sure how far you are going to get with this project starting from no knowledge of numerical methods , computer programming , fluid mechanics , theory of CAD/FEA/CFD or commercial analysis software and with a twit for an advisor but genuinely best of luck anyway .

Not much de novo CFD software is written in FORTRAN these days .Commonly used languages are C (variants) and Python . Fortran tends to be used now for maintaining and extending in house software and heritage software like NASTRAN .

An important part of CFD is visualisation - images are almost a nescessity for generating input data and for interpreting results . This means that CFD software is best written in a language which is not only capable of powerful calculations but is capable of working with images as well .

Any specific questions ask me .
 
  • Like
Likes ulfaazmi
  • #8
Dear, Mr.Nidum

Actually, I have to finish my study in two years, but now I only have a time about 1,5 years left. What do you think about it? Does it make a sense? I am still studying fluid mechanics and computer programming and the others as you said that. Indeed, it is hard enough to study all of them at once. I know that I must study hard to accomplish it.

So, Would you give me any suggestion, please?? Because it is out of my supposing, I thought my supervisor has ever done this research using Fortran, in fact, this is also the first time he used Fortran for CFD simulation (in case : diffusion of hot gas).

Thank you very much for your help.
 
  • #9
What is the actual project that you have to work on ?

Edit : I see you mention hot gas diffusion but could you provide more details ?
 
  • Like
Likes ulfaazmi
  • #10
Nidum said:
I am not sure how far you are going to get with this project starting from no knowledge of numerical methods , computer programming , fluid mechanics , theory of CAD/FEA/CFD
I had focussed on the technical aspects of the question, but I admit I missed the forest for the trees. Writing your own fluid dynamics code from scratch is not an efficient way to solve the problem.

In addition to the packages mentioned, I would add OpenFOAM.
 
  • Like
Likes ulfaazmi
  • #11
hilbert2 said:
The Fire Dynamics Simulator which is used by my colleagues for simulating the fluid dynamics and chemical kinetics of combustion, is made with FORTRAN and the code is open source. I can't see why FORTRAN wouldn't be a good choice for other fluid dynamics simulations as well.
Thank you
Nidum said:
What is the actual project that you have to work on ?

Edit : I see you mention hot gas diffusion but could you provide more details ?
I study of energy flow when a projectile impact on a target in nitrogen, the experiment is carried out using a 2- stage light gas gun. The impact reactions produce smoke or hot gas plume. In this case, my supervisor already got several experimental data about the hot gas plumes and I will to analyze that data and make a model of the energy flow after that impact.
 
Last edited by a moderator:
  • #12
Reactive flow just added a layer of complexity. Just concentrating on modeling the process correctly, without programming anything, will take all your time.
 
  • Like
Likes ulfaazmi and Nidum
  • #13
There are some online Fortran tutorials:

https://www.tutorialspoint.com/fortran/

https://www.fortrantutorial.com/

http://www.fortran.com/the-fortran-company-homepage/fortran-tutorials/

There are other links available if you search

and there are fortran examples (not necessarily the best examples but still examples that may help code something) with many numerical computing examples interspersed among them:

http://rosettacode.org/wiki/Category:Fortran

Also for each example there are equivalent code in other languages so you can compare and contrast Fortran and Matlab or Python or Julia all of which are used in numerical computing. I would also get some experience using Matlab, Python and Julia to broaden your skillset once you begin looking for jobs after graduation. You might even be able to use these skills in your current project as in using Matlab to plot results and to compare Matlab generated results with your fortran generated results.

The book Numerical Recipes in Fortran is the goto book for developing code for these kinds of projects so you should get a copy in your library and go through as you work with your code.

https://www.amazon.com/s/ref=nb_sb_...,aps,156&crid=3HNLYXK7UTUCQ&tag=pfamazon01-20

and here's an example of a computational modeling project in Fortran (the appendices have the code):

http://www.arl.army.mil/arlreports/2006/ARL-CR-575.pdf
 
  • Like
Likes ulfaazmi
  • #14
DrClaude said:
I would add OpenFOAM.

Open Foam is excellent and free . I use it a lot . Not easy to learn as a first introduction to a CFD package though .
 
  • #15
If one wishes to actually use Fortran in 2018, and is not strictly forced to use an older version of the language standard, I would certainly strongly recommend familiarising yourself with truly Modern Fortran, i.e. F2003 and F2008, both of which are now "almost entirely" implemented in gfortran (the upcoming GCC 8 implements parameterised derived types, for example).

I can't name any projects off the top of my head which I can vouch for being an excellent "real" demonstration, however I will say that, at least in my experience, almost all free online resources for "modern" Fortran have at least one of the following deficiencies:
  • "Modern" for them is taken to mean F90 or F95, precisely what I would recommend to avoid.
  • They are written by people who, while very familiar in F66/F77 and F90, evidently fail to fully understand the possibilities and flexibility of the features in F2003/2008; or are intended for students whose only involvement with Fortran is to be occasionally adding new SUBROUTINEs to mixed F95/F77 codebases.
  • Were written in the fledgeling days of the F2003/2008 standards, when no (certainly not free) compiler implemented the majority of the standard without serious issues with nontrivial code, and so intentionally omit (or worse, actively discourage) constructs which now work everywhere without issue.
  • Were written for a very specific, highly specialised field (usually for advanced users of specific, non-language-standard parallelism frameworks), and simply presume that the reader already has the understanding we're trying to establish.
What I used to recommend a few years ago, and still do now, is to get hold of the following books:
  • [Metcalf, 2011] Modern Fortran Explained - By far the most generally useful, I use it as kind of a "digest" version of the standard, whose "standard-ese" can sometimes be tiresome to understand
  • [Markus, 2012] Modern Fortran in Practice
  • [Clerman, 2012] Modern Fortran - Style and Usage
  • [Chivers, 2012] Introduction to Programming in Fortran
This is the order I read them, and found them most useful in. There may well of course be other books (or even just editions) which I've neglected. Also, "soon" should be the release of the next language standard, F2018, which further extends the Modern functionality.
 
  • #16
One thing to be aware of is that what you call deficiencies are still there for a reason. There are many legacy fortran systems still in operation with little to no programmer support. Many of these free implementations are still catering to this crowd of people. Most of these systems are computational models that have been vetted through testing and experience and to jump to a newer language and libraries means the vetting must be done again only more stringently to be sure nothing significant has changed.

You see this same sort of problem with Python. There are two primary variants Python2 and Python3. Python 2 had a large following with many scripts written so much so that some features of Python3 were backported to Python2. Its been years now and still Python2 is around and the Python3 designers can't get folks to move on so they can drop support for Python2. They coexist together stuck in a stasis caused by too radicala jump to new features.
 
  • Like
Likes aphirst
  • #17
Of course they are how they are for a lot of good reasons (some of which I explicitly enumerate). My point is simply that these resources are not especially useful for actually Modern Fortran.
 
  • Like
Likes ulfaazmi and jedishrfu
  • #18
Good point, my point is that the OPs choice may be limited by his/her project and by his/her advisors suggestions.
 
  • Like
Likes ulfaazmi

1. What is Fortran and why is it used for computational fluid dynamics (CFD) problems?

Fortran (Formula Translation) is a general-purpose programming language commonly used in the scientific and engineering fields. It is particularly well-suited for CFD problems due to its efficient handling of mathematical operations and ability to work with large datasets. Additionally, Fortran has a long history in the field of CFD and many existing CFD codes are written in Fortran, making it a popular choice for researchers and practitioners.

2. What are the advantages of using Fortran for CFD over other programming languages?

One of the main advantages of using Fortran for CFD is its speed. Fortran is a compiled language, meaning that it is translated into machine code before execution, which allows for faster execution times compared to interpreted languages. Fortran also has built-in support for multidimensional arrays, making it well-suited for representing the complex data structures used in CFD simulations.

3. Are there any drawbacks to using Fortran for CFD?

One potential drawback of using Fortran for CFD is its steep learning curve. Fortran has a syntax and structure that may be unfamiliar to those with experience in other programming languages. Additionally, Fortran is not as widely used as other languages such as Python or C++, so finding resources and support may be more difficult.

4. Can Fortran be used for both 2D and 3D CFD problems?

Yes, Fortran can be used to solve both 2D and 3D CFD problems. It has the capabilities to handle large arrays and perform complex mathematical operations, making it suitable for representing and solving the equations governing fluid flow in both 2D and 3D domains.

5. Are there any recommended resources for learning Fortran for CFD?

Yes, there are many resources available for learning Fortran for CFD. Some popular textbooks include "Computational Fluid Dynamics: Principles and Applications" by Jiri Blazek and "Fortran Programs for Chemical Process Design, Analysis, and Simulation" by A. Kayode Coker. Additionally, there are online tutorials and courses available, as well as forums and communities for Fortran users to share knowledge and ask for help.

Similar threads

  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
2
Views
898
  • STEM Academic Advising
Replies
4
Views
741
  • STEM Academic Advising
Replies
1
Views
448
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
16
Views
1K
  • Science and Math Textbooks
Replies
3
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • STEM Career Guidance
Replies
3
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
Back
Top