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

cfd codes in c language?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 24, 2012, 21:30
Exclamation cfd codes in c language?
  #1
New Member
 
nikhil
Join Date: Aug 2012
Posts: 2
Rep Power: 0
nikhilbagalkot is on a distinguished road
can anyone please help me how to start with c coding in cfd, i.e any study material which has good number of examples with codes.
nikhilbagalkot is offline   Reply With Quote

Old   August 25, 2012, 10:26
Default
  #2
Member
 
Yon Han Chong
Join Date: Jun 2012
Posts: 77
Rep Power: 5
yonchong is on a distinguished road
Openfoam is written with C++ and open source. You should be able to see the source code but I don't know why you want to write CFD code in C as it will take a huge effort.
yonchong is offline   Reply With Quote

Old   August 25, 2012, 10:33
Default
  #3
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11
cfdnewbie is on a distinguished road
C or Fortran are the languages of choice for efficient codes, so writing one in C is not a bad idea!
cfdnewbie is offline   Reply With Quote

Old   August 25, 2012, 10:37
Default
  #4
Member
 
Yon Han Chong
Join Date: Jun 2012
Posts: 77
Rep Power: 5
yonchong is on a distinguished road
Sorry I did not meant the choice of language was wrong but rather why do you want to write a CFD code any way.
yonchong is offline   Reply With Quote

Old   August 25, 2012, 11:13
Default
  #5
New Member
 
nikhil
Join Date: Aug 2012
Posts: 2
Rep Power: 0
nikhilbagalkot is on a distinguished road
Quote:
Originally Posted by nikhilbagalkot View Post
can anyone please help me how to start with c coding in cfd, i.e any study material which has good number of examples with codes.
THANKS for the sugestions but none of you have answered my question, please help me.let me know a good study material or website for the above purpose.
nikhilbagalkot is offline   Reply With Quote

Old   August 25, 2012, 11:28
Default
  #6
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11
cfdnewbie is on a distinguished road
Quote:
Originally Posted by yonchong View Post
Sorry I did not meant the choice of language was wrong but rather why do you want to write a CFD code any way.

You should rather encourage him It is the best and only way to truly learn CFD! Anyone doing CFD should be forced to write a least a simple 2 code in my opinion!

regarding the question of study material for a C cfd code...I'm afraid there is none, at least I have never seen something. Is your focus on learning CFD (then you will find some good books in the section here in the forum) or learning C? Then there are certainly a lot of free resources on the web...

I guess the short answer is:
If you want to learn CFD, then take a class or read some books / papers.
If you want to learn how to program, just program =
cfdnewbie is offline   Reply With Quote

Old   August 25, 2012, 11:31
Default
  #7
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Quote:
Originally Posted by nikhilbagalkot View Post
THANKS for the sugestions but none of you have answered my question, please help me.let me know a good study material or website for the above purpose.
To learn C programming, there exist a huge quantity of material available on internet, just type " C tutorial" on google.

First you have to master the language by learning it, in a general context, not CFD.

Second start to learn CFD and discretization methods,schemes and algorithm.
The book from Gribel

http://books.google.fr/books/about/N...cC&redir_esc=y

is very good for that. Especially because after you can get his code Nast2D. As it is written in C it should fulfil your will

http://home.arcor.de/drklaus.bauerfe.../eNaSt2DA.html



Good luck !
leflix is offline   Reply With Quote

Old   August 25, 2012, 11:58
Default
  #8
Member
 
Yon Han Chong
Join Date: Jun 2012
Posts: 77
Rep Power: 5
yonchong is on a distinguished road
I also don't know any textbook with CFD code listing in C.

However, if you are willing to learn Fortran, I used a book called "Computer-Aided Engineering: Heat transfer and fluid flow" by Gosman, Launder and Reece when I was an undergrad. They are the force behind Start CD.

Fortran style in the book is now very old but Fortran is still very useful language for scientic code so I don't think it is a complete waste of time to learn the language.
yonchong is offline   Reply With Quote

Old   August 25, 2012, 13:15
Default
  #9
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Quote:
Originally Posted by yonchong View Post
but Fortran is still very useful language for scientic code so I don't think it is a complete waste of time to learn the language.

yes but he wants to learn C!! and we can imagine that he certainly knows why!
leflix is offline   Reply With Quote

Old   August 25, 2012, 21:39
Default
  #10
Member
 
Yon Han Chong
Join Date: Jun 2012
Posts: 77
Rep Power: 5
yonchong is on a distinguished road
I wasn' t saying he shouldn't be learning C. I am saying he could learn Fortran as well.

I think people talk too much about which languages to use but most of the tasks can be done with any language including BASIC. However C and Fortran are the most common and you should learn both if you are serious about programming. Frankly I have seen more Fortran than C but that's because I am working in an engineering company not software company and old fashioned. :-)
yonchong is offline   Reply With Quote

Old   August 26, 2012, 10:15
Default
  #11
Senior Member
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 387
Rep Power: 6
cdegroot is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
You should rather encourage him It is the best and only way to truly learn CFD! Anyone doing CFD should be forced to write a least a simple 2 code in my opinion!
Thank you for this comment! I could not agree with you more. You hear a lot these days that you should not write your own CFD code because of tools like openfoam. Seriously, if you want to be a CFD developer or even an "expert" CFD user you need to write at least one code yourself, even if it is a simple one... not to be confused with SIMPLE
cdegroot is offline   Reply With Quote

Old   August 26, 2012, 12:23
Default
  #12
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
Quote:
Originally Posted by cdegroot View Post
You hear a lot these days that you should not write your own CFD code because of tools like openfoam. Seriously, if you want to be a CFD developer or even an "expert" CFD user you need to write at least one code yourself, even if it is a simple one...
You told the truth cdegroot and cfdnewbie!!!! I perfectly agree with you. I will never talk deeply with a so called CFD "expert" until I'm sot sure he has already written a code whatever it is.
Because it's only when you put your hands in dirty oil that you become a good car mechanic
Theory is good but practice is invaluable!
So please let nikhilbagalkot conducting his own experience... It would be great for him.
leflix is offline   Reply With Quote

Old   August 26, 2012, 15:43
Default
  #13
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,599
Rep Power: 22
FMDenaro will become famous soon enough
Quote:
Originally Posted by leflix View Post
You told the truth cdegroot and cfdnewbie!!!! I perfectly agree with you. I will never talk deeply with a so called CFD "expert" until I'm sot sure he has already written a code whatever it is.
Because it's only when you put your hands in dirty oil that you become a good car mechanic
Theory is good but practice is invaluable!
So please let nikhilbagalkot conducting his own experience... It would be great for him.
I agree, definitely! writing a cfd code is a necessary (but not sufficient) to come into issues of CFD.
I have no idea of a book where you can find example of C++ applied in CFD, expecially for newcomer in CFD ...I think to only C++ program-language book that treat general topics maybe an idea could be to use Maple programming a general algorithm and then use the translate function in C ...

However, see Ref at page 22 of http://powerlab.fsb.hr/ped/kturbo/op...s/C++Intro.pdf
FMDenaro is offline   Reply With Quote

Old   August 26, 2012, 18:24
Default
  #14
Senior Member
 
Join Date: Aug 2011
Posts: 251
Rep Power: 6
leflix is on a distinguished road
nikhilbagalkot is not seeking for C++ code but C code. And I gave him the reference of NaSt2D code written in C.
If he wants C++ Openfoam is a must...but perhaps a bit difficult to start with when you do not have a sufficient experience.
iNavier is also in C++ and I guess there exist others...
leflix is offline   Reply With Quote

Old   September 10, 2012, 09:56
Default
  #15
New Member
 
Jet Power
Join Date: May 2012
Posts: 3
Rep Power: 5
Jet_Power is on a distinguished road
There are CFD solvers written by C. I'm sure. If you want to develop a new solver for a company or an institue, the choose of C is also a good way.
For learning or hoppy, in my opinion, Python is better.
Jet_Power is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFD codes ICARE and N3S (Navier-Stokes) Aeolus Main CFD Forum 0 January 13, 2007 18:20
CFD CODES FOR MARINE APPLICATIONS 1995JAL Main CFD Forum 2 August 19, 2006 07:40
CFD codes and books: need your opinion Giovanni Mattarolo Main CFD Forum 3 February 4, 2006 23:52
is there any money in CFD? T Main CFD Forum 35 May 9, 2001 19:35
PC vs. Workstation Tim Franke Main CFD Forum 5 September 29, 1999 15:01


All times are GMT -4. The time now is 03:51.