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

Recommendation of book for CFD coding

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2024, 09:49
Default Recommendation of book for CFD coding
  #1
Senior Member
 
-
Join Date: Oct 2021
Location: -
Posts: 139
Rep Power: 5
FluidKo is on a distinguished road
Hello Everyone
I want to make my own CFD code.
But I think my coding level is not enough.
So I need to learn and practice CFD coding.
Is there any bible book that treats coding example mainly?
If there is example code and solution, it would be better because before making code, I want to solve a problem by using pen with less number of mesh for first iteration.
Thank you
FluidKo is offline   Reply With Quote

Old   July 8, 2024, 10:15
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,190
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
There is no book on CFD coding as such. You will find several with some accompanying code but none of them has any actual practical relevance, they are didactic as they should be.

However, the idea of a bible for the coding of X is wrong, in my opinion. There are general principles that you can use which go beyond coding per se, but still depend from the scope of the code. In fact, coding for didactic purposes is very different from coding in general, which is very different from coding math software in a commercial setting.

All of this, then, must be contextualized within the programming language in use, which might have its own idiosyncracies.

If you need to learn CFD coding for the first time, focus on getting it right first.
FluidKo likes this.
sbaffini is offline   Reply With Quote

Old   July 8, 2024, 17:20
Default
  #3
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,190
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Of course, there are some common sense things to always have in mind, once you have your stuff working:

1) CFD coding is pretty much synonimous of coding for performances BUT, math coding as a business requires a balance between different needs. Code readability and maintainability are equally important (a clever, imperscrutable trick to gain a 1% speedup is almost always a bad idea), as well as code length (less code is always better) and its general organization (too long to delve in it here, but many small independent pieces are always better than few monolithic, interlinked pieces)

2) Coding for performances really means: a) access memory in a friendly manner (e.g., column major in Fortran); b) access memory as little as possible; c) organize memory in an access friendly manner (SoA, not AoS); d) keep your cpu busy, possibly trough vectorization; e) pick up the correct algorithm (almosy always with linear or log-linear cost, not higher)

3) Try to use external libraries with parsimony and common sense

4) Respect your programming language as much as possible and always write standard conforming code

It really makes no sense to go beyond this generic common sense stuff at the beginning. A fully working CFD code has so much stuff in it that you soon realize it cannot live with rules written in stone. You actually need a formal thinking framework that will serve as guidance for each decision to be taken along the way
sbaffini is offline   Reply With Quote

Old   July 9, 2024, 02:18
Default
  #4
New Member
 
maverickwhites
Join Date: Jul 2024
Posts: 1
Rep Power: 0
maverickwhites is on a distinguished road
Quote:
Originally Posted by FluidKo View Post
Hello Everyone
I want to make my own CFD code.
But I think my coding level is not enough.
So I need to learn and practice CFD coding.
Is there any bible book that treats coding example mainly?
If there is example code and solution, it would be better because before making code, I want to solve a problem by using pen with less number of mesh for first iteration.
Thank you
For learning and practicing CFD coding, you might find these resources useful:
1. Numerical Heat Transfer and Fluid Flow by Suhas V. Patankar
- Covers CFD basics with examples and solutions.

2. Computational Fluid Dynamics: The Basics with Applications by John D. Anderson Jr.
- Offers fundamental concepts and practical coding exercises.

3. An Introduction to Computational Fluid Dynamics: The Finite Volume Method by H.K. Versteeg and W. Malalasekera
- Detailed introduction with examples and problem solutions.
maverickwhites 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
New Book Proposal: Project-based Finite Element Method Dr Youssef Hafez Main CFD Forum 1 January 1, 2023 12:45
Book recommendation for pipe flow having incomprehensible fluid in ANSYS Fluent Rimzy FLUENT 3 September 27, 2019 06:24
book recommendation: hydrodynamics thomas Main CFD Forum 0 February 15, 2008 02:28
Book recommendation need for all speed flows jinwon park Main CFD Forum 0 February 6, 2008 12:34
Book recommendation? Jason Main CFD Forum 1 June 6, 2002 00:45


All times are GMT -4. The time now is 01:26.