CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

how to write code based on any novel cfd research paper?

Register Blogs Community New Posts Updated Threads Search

Like Tree14Likes
  • 2 Post By arjun
  • 3 Post By LuckyTran
  • 2 Post By FMDenaro
  • 3 Post By flotus1
  • 3 Post By sbaffini
  • 1 Post By arjun

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2022, 15:42
Default how to write code based on any novel cfd research paper?
  #1
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
i'm hesitant to ask this question, because the answer is definitely : "git good", but still some topics are difficult even for experts, and i was interested to know how would you go about creating a creating a code based on any novel research paper that you read.

the condition would be that you currently don't understand the mathematics in the research paper, but you want to write your own solvers based on the paper.

for example, things like finite rate combustion, LES, Discontinuous Galerkin Spectral Element Method, etc. might be complex even for experienced engineers.

i ask this mainly because my maths is limiting me, and i can't just google for "k exact reconstruction solver in fortran python matlab c c++ github gitlab sourceforge"

i mean, i did search it, but didn't find anything.
aerosayan is offline   Reply With Quote

Old   March 30, 2022, 16:47
Default
  #2
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
There are not many people who can actually answer what you asked. I am one of very few who can say what i feel because i have actually written codes into a very wide range (pretty much everything including lattice boltzmann , meshless to cartesian based DNS codes etc etc).

First of all there are two main problems

1. What to do

2. How to do.


Both these problems could be equally tough but most of the time second problem is easier one.

As far as what to do is concerned, I have been reading lots of papers and thesis etc and doing it for almost 17 years now. So it is kind of advantage i have that is tough to build in an year or two.

I also have collection of papers etc collected over the years. So this helps.


If one does not have this then it is slightly tougher but still doable.


My approach is that i collect as much material as i could on that topic. I read all of them and find two things.

1. The material that i can understand based on writing style or language used etc. (Don't like too heavy maths , i want that explains to me in simple terms).

2. Find out what is common in them. This tells me what is definitely happening. After this i focus on what i found confusing and not common. This part needs some detective work sometimes but eventually i figure it out.


Once what to do is known. I focus on how to do. That is all programming so it is mostly okay in c++.
sbaffini and aerosayan like this.
arjun is offline   Reply With Quote

Old   March 30, 2022, 17:49
Default
  #3
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,675
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
I think too many people forget that any paper you read has authors that you can easily track down if you need any help. They can recommend you material to help get you started. Usually they'll even tell you how they learned it and recommend you the same stuff that they used so you can learn it the same way even.
sbaffini, arjun and aerosayan like this.
LuckyTran is offline   Reply With Quote

Old   March 31, 2022, 04:28
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,769
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by aerosayan View Post
i'm hesitant to ask this question, because the answer is definitely : "git good", but still some topics are difficult even for experts, and i was interested to know how would you go about creating a creating a code based on any novel research paper that you read.

the condition would be that you currently don't understand the mathematics in the research paper, but you want to write your own solvers based on the paper.

for example, things like finite rate combustion, LES, Discontinuous Galerkin Spectral Element Method, etc. might be complex even for experienced engineers.

i ask this mainly because my maths is limiting me, and i can't just google for "k exact reconstruction solver in fortran python matlab c c++ github gitlab sourceforge"

i mean, i did search it, but didn't find anything.



Papers published in journals have not the aim to provide details for writing the corresponding CFD code, this is the real issue in trying to replicate the algorithm. Often the reviewers ask for limiting the material or, sometimes, to put in appendix the practical parts.
Contacting the authors could be useful but it is only a part of the work.
sbaffini and aerosayan like this.
FMDenaro is offline   Reply With Quote

Old   March 31, 2022, 04:46
Default
  #5
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,399
Rep Power: 46
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Quote:
i ask this mainly because my maths is limiting me
I am not directly involved in writing solvers based on cutting-edge research. But from discussions with my colleague who does that kind of stuff, he often points out one thing:
Papers contain errors. Shocking, I know
What that means when trying to implement something based on a method described in a paper: even if the paper does go into enough detail to derive a functioning algorithm from it, without a solid grasp of the math that went into it, you are flying blind.
I don't write this to discourage you, I think it is something you have to be aware of. Because no amount of debugging will help you find a flipped sign that went into the mathematical formulation.
sbaffini, FMDenaro and aerosayan like this.
flotus1 is offline   Reply With Quote

Old   March 31, 2022, 04:48
Default
  #6
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by aerosayan View Post
i'm hesitant to ask this question, because the answer is definitely : "git good", but still some topics are difficult even for experts, and i was interested to know how would you go about creating a creating a code based on any novel research paper that you read.

the condition would be that you currently don't understand the mathematics in the research paper, but you want to write your own solvers based on the paper.

for example, things like finite rate combustion, LES, Discontinuous Galerkin Spectral Element Method, etc. might be complex even for experienced engineers.

i ask this mainly because my maths is limiting me, and i can't just google for "k exact reconstruction solver in fortran python matlab c c++ github gitlab sourceforge"

i mean, i did search it, but didn't find anything.
My experience is that with time you level up into these things, as long as you always add some textbook to the stuff you want to read that is somehow newer. For example, if you want to implement combustion, there is no way you are going to do that correctly if you don't first learn combustion in general (and research papers, even if wonderfully written, are not always the best source).

I couldn't second Arjun more on the collecting as much stuff as possible on a topic. Last summer I had to implement porous models in my code which, I have to admit, I kind of underestimated. I had to read tens of papers, luckily most of them from the same authors, so that I could more easily connect the dots. But, in the end, it is your view that also matters; it is not uncommon to find some paper implementation that actually neglects relevant aspects for you. So, you have to develop your understanding of the kind of code that you are building because, as a matter of fact, you are in charge, not a random author. Sometimes it is you or your code that won't be able to do certain stuff (for a number of reasons), so it is still up to you to figure a way out of a problem formalization that is correct but unreachable for you.

If you are working on second order FV codes that must do the most different stuff, in my opinion, papers from people working on commercial CFD codes are typically well written, mostly consistent, and aligned to the common needs of people working on these codes. There are also few research groups out there that also produce consistent papers on typical topics for second order CFD FV codes.

However, let me say that I kind of discourage implementing stuff that you barely understand unless it has a precise spot in your framework (so that you can extrapolate stuff from things you actually understand).

Finally, let me spend a word on fearing the math. I come from there and in my first year of university I couldn't tell apart a line from an n-th order polynomial (ouch!). If you keep avoiding it, you'll never be good at it. Also, note that there is a lot of math everywhere in a CFD code and you typically end up doing first everything on paper before going into development. My suggestion is to:

1) Develop an attitude to put things on paper and work trough them. There will be moments where you'll find a lot of friction in proceeding this way (basically because you don't want to), but you need to convince yourself that that's how you do stuff and proceed to do that. Sometimes it's just impossible to do otherwise because there are things that you can't copy-paste because details are missing.

2) Doing a serious fluid mechanics course with all the demonstrations by yourself on paper (accompanied by the same sort of work for all your courses in a degree) is typically sufficient to be able to later digest books and papers without having to resort again to pen and paper (until the implementation, of course). In my case, for example, besides regular courses, I just did the extra mile for fluid mechanics and LES, and that was it. That is, you don't need to spend your whole life going trough full books with pen and paper, you need to do that just a couple of times (in your relevant field) to be able to avoid that in the future and be able to read a book even from bed (this I couldn't reccomend enough as, at worst, you just fall asleep immediately)
arjun, FMDenaro and aerosayan like this.
sbaffini is offline   Reply With Quote

Old   March 31, 2022, 06:31
Default
  #7
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
I deliberately did not mention one very important aspect in my first post.

If you want to implement any thing, first you have to find a good and simple test case for it. This is, believe it or not, one of the most difficult thing to do.

When I implemented finite rate combustion, it took me a week to implement it and 2 months to find the test cases that could show me what i am doing is right and things work properly.

It took 2 months because there was huge confusion regarding units used (Jules Calorie etc etc).



Also many times what happens is that people who work in certain field for long time, they have huge understanding for their field. When they publish they leave out many things that think are trivial. Those things are not trivial. One such situation was with lattice boltzmann method. Some authors just worked with dt=1 and everything based on it and they understood that this is how it should be but from their paper its not at all clear. Some authors used dt as physical time step. This ends up with many definitions of quanities (in formulas).

These small trival things are important for people trying to learn to implement things. I have had many situations where I could not work out just because one small thing was missing.


Edited to add: Recently added P1 radiation model in Wildkatze because it is simple. Now to verify it i used verification case from starccm. Now the radiation quantities match but in starccm test problem the temperature of domain remains the same (it should change since there is radiation flux through walls). Because of this i can not completely verify the radiation model. It means now i will have to find another test case to be 100 percent sure).
aerosayan likes this.
arjun is offline   Reply With Quote

Old   March 31, 2022, 11:09
Default
  #8
Senior Member
 
andy
Join Date: May 2009
Posts: 270
Rep Power: 17
andy_ is on a distinguished road
Quote:
Originally Posted by aerosayan View Post
the condition would be that you currently don't understand the mathematics in the research paper, but you want to write your own solvers based on the paper.
Not sure I fully grasp the question. You are asking how to code something that you don't understand? The answer is that you generally can't unless you can find a recipe to follow or an implementation to copy.

I have been developing CFD and related numerical methods for many decades and don't recall the situation arising hence my doubts about understanding the question. I have sometimes had to spend considerable time developing my notes to help work out what was likely done before implementation. One can't always be sure because papers omit details.
andy_ is offline   Reply With Quote

Old   March 31, 2022, 11:35
Default
  #9
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by andy_ View Post
Not sure I fully grasp the question. You are asking how to code something that you don't understand?
Yes, the question's more about learning how others approach a problem they don't fully understand.

Finding a source code to learn from is crucial for a beginner in cfd/fem. But after some time, it's not possible to find source code or implementation of a complex or new mathematical model.

What do you do then? Simple answer would be to try harder and get good.

But that's not really helpful to someone who doesn't know what steps he/she needs to take.
aerosayan is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Patankar CFD FORTRAN 90 Code FVM siddiquesil Main CFD Forum 19 October 25, 2022 05:21
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 13:06
CFD code structure (F90) ma Main CFD Forum 4 January 10, 2005 20:47
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 08:10
user friendly cfd code waqar Main CFD Forum 19 August 18, 2000 16:31


All times are GMT -4. The time now is 12:25.