|
[Sponsors] |
Data structure handling in multiblock approach |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 29, 2006, 06:42 |
Data structure handling in multiblock approach
|
#1 |
Guest
Posts: n/a
|
Hello,
I would like to implement multiblock in my solver. The problem is how to organize the data structure. Suppose I have a c-grid generated airfoil. Now I would like to extend the far field by placing a new block of rectangular grid behind it. Originally, there's variables x(i,j),y(i,j),u(i,j) etc. So now how should the variables be organized? If the orginal c-grid is block 1, should x(i,j) be x1(i,j) now, and the new block 2 be x2(i,j) etc. Or block1 variables be x(1,i,j), block2 be x(2,i,j) Or should block1 variables just remain the same while for block2, it'll continue from where block1 ends. Btw, I'm using a FVM scheme with fortran. I have no experience so I hope those ppl who have done it before can recommend me the best approach. |
|
September 29, 2006, 14:21 |
Re: Data structure handling in multiblock approach
|
#2 |
Guest
Posts: n/a
|
First off, I hope you are not using anything older than Fortran 90.
> Or block1 variables be x(1,i,j), block2 be x(2,i,j) This is one thing you should definitely not do! You are limiting your grid to the case that all blocks have the same dimensions (or you are waisting a lot of memory). It will also make it quite difficult to parallelize your code. > should x(i,j) be x1(i,j) now, and the new block 2 be x2(i,j) etc. This is much better, but you should try to write your code as general as possible, keeping in mind that you may want to treat more than just 2 blocks in the future. Make your code handle an arbitrary number of blocks. This can be done by defining a new data type "block", e.g. type block integer ni,nj real(kind=8), dimension(:,, pointer :: x,y,u ! ... add all other variables within a block end type And then you can define a given number of blocks by type(block), dimension(, allocatable :: blk allocate(blk(n)) ! for n blocks and then for each block you allocate space for x,y,u, and so on, e.g. allocate(blk(i)%u(blk%ni,blk%nj)) and so on. I think you get the idea. If you're not familiar with derived types in Fortran get yourself a Fortran book and read carefully before you start programming. You can save yourself a lot of trouble debugging, maintaining, and extending your code later on, if you write it in a smart way (as much object oriented as possible in Fortran). In addition, your code will be quite easy to parallelize. |
|
September 30, 2006, 01:39 |
Re: Data structure handling in multiblock approach
|
#3 |
Guest
Posts: n/a
|
thanks alot mani! that's definitely a more elegant way of implementation.
|
|
October 5, 2006, 19:51 |
Re: Data structure handling in multiblock approach
|
#4 |
Guest
Posts: n/a
|
yes that is write.
If you want a multiblock grid then you need to have a data structure for the blocks. To connect each block with another you need buffer blocks. if you want to take a second derivative then you need to have buffer blocks for the buffer blocks. Vasanth |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Standard data structure for AMR | Takuya Tsuji | Main CFD Forum | 1 | January 8, 2002 03:14 |
PhD in turbulence | Hans | Main CFD Forum | 14 | October 8, 2001 04:03 |
Manipulation on sparse data structure | Takuya Tsuji | Main CFD Forum | 0 | June 26, 2001 23:48 |
Meshing data structure | Weiqing Yee | Main CFD Forum | 3 | February 21, 2001 14:48 |
Data Structure for the unstructured finite volume method | Anthony | Main CFD Forum | 4 | February 2, 1999 20:24 |