# Structure of CFD code

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

 April 25, 2006, 04:52 Structure of CFD code #1 Shyam Guest   Posts: n/a Hi all, I am planning to start writing up a CFD code for my phd. Since mine is Higher Order, i need to develop the code from the scratch. Hence I thought it would be better to ask the experts to advise me of the structure of the code. Is it advisable to store the variables as a bunch of arrays, or to store them in a structure Also, is it recommendable to have a one dimensional array or a 3D array for storing the variables? Scheme: FVM, Explicit time integration, LES/RANS (DES) Shyam

 April 25, 2006, 05:12 Re: Structure of CFD code #2 zxaar Guest   Posts: n/a structure of the code is very simple Start: Starting code Middle: Lot of middle code, and then some more lot of code. End: In the end there is some more code, its not important you can keep it empty and put this code in middle code part.

 April 25, 2006, 08:50 Re: Structure of CFD code #4 Steve Guest   Posts: n/a To answer the question posed (unlike the two previous responses)... Structures are great for holding all the relevant data together in the right place. And also great for traversing networks (i.e. pointers to neighbours and all that). But I suspect your solver will work best on big arrays, so you'll need to build them up by pulling data from your structures each time you want to solve and then stuffing results back into the structures after each solution step.

 April 25, 2006, 21:01 Re: Structure of CFD code #5 Shyam Guest   Posts: n/a Thanks Steve.. Yes... Thats what i was worried about... Accessing the variabes through a structure requires extra work of pointing to the structure first. As speed is the first priori, I will try to incorporate array blocks. The next thing is the choice of 1D or 3D array for holding 3 dimensinal data set. I heard from my friends that in case of explicit schemes with fixed computational stencils, if properly programmed, 1D array can be much faster, as accessing any variable inside that array mostly involves atmost two additions, whereas in 3D (dynamic) array, it involves pointing to the base pointer, then next, then to the variable. But, when the memory involved is huge, it is often advisable to have smaller chunks of memory allocated (as in 3D array) than a huge chunk as in 1D array. What is your opinion? Is the additional computational time involved in these access negligible when compared to the actual calculation involved?

 April 26, 2006, 12:04 Re: Structure of CFD code #6 chris Guest   Posts: n/a Well, you can make one more step of abstraction and try to see which solution is best. The user of your storage structure should not see whether it operates on 1D-arrays or 3D-arrays.

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post MAB Main CFD Forum 5 August 10, 2008 03:47 Chris Kleijn Main CFD Forum 0 August 22, 2001 06:41 waqar Main CFD Forum 19 August 18, 2000 16:31 Dr. Don I anyanwu Main CFD Forum 20 May 17, 1999 15:13 Hanson G. He Main CFD Forum 1 October 15, 1998 08:49

All times are GMT -4. The time now is 04:17.