|
[Sponsors] |
June 11, 2000, 05:02 |
A Question on Multi-Rectangular Grids
|
#1 |
Guest
Posts: n/a
|
Hi,
I am confronted with a problem of writing a code for generating a multi-rectangular domain. The domain will have different number of maxima and minima in both x and y direction (which should be given at users discretion). I want to use the optimal resource of memeory by an effective programming technique, like say Dynamic Memeory Allocation (Not sure if this will work) so that the relevant grid points alone are stored and not all points in the rectangle encompassing the whole grid which in other words means that my grid file should not store data more than it needs to. Also if somebody can help me solve this problem, generally without the above-specified programming issues, it will be helpful. Thanks. Bharanidharan Rajamani. |
|
June 11, 2000, 12:48 |
Re: A Question on Multi-Rectangular Grids
|
#2 |
Guest
Posts: n/a
|
(1). In C++, you can use NEW to reserve memory space and get the pointer which pointed to the type of the variable reserved. You can assign this pointer to the declared pointer variable. (2). You can use the pointer to manipulate the values stored. When you are done with the variable, release the memory space by using the DELETE pointer. (3). For more information, read the C++ text books. (4). You can use NEW to reserve the memory space form the "free store" for interger, floating point variables, array, structure, class,..
|
|
June 12, 2000, 19:58 |
Re: A Question on Multi-Rectangular Grids
|
#3 |
Guest
Posts: n/a
|
Hello Ram,
Is the number of active cells going to be much smaller than the peak value of Imax*Jmax? Because otherwise, optimisation is pointless. If the answer is yes, one possibility is to save the logical indices (if needed) in a separate array, and just have the number of cells needed. For example, suppose you want to limit the grid to 100,000 cells totally, with peak values Imax=1000, Jmax=1000. Then define all your arrays to 100,000 eg U(100000), V(100000) etc, and an index array INDEX(100000) which can store the I and J [INDEX(ICELL)=(J-1)*1000+I]. It may also help to save the neighbours of each cell to avoid searches on I and J (eg. NORTH(ICELL) saves the J+1 neighbour of cell ICELL). This will cost you 4 additional arrays. The bright side of doing all this right: You are now ready to go to unstructured grids! Just ignore all the business about I and J, and simply use the neighbour lists. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unanswered question | niklas | OpenFOAM | 2 | July 31, 2013 17:03 |
link multi blocs | ben souissi | Phoenics | 1 | August 4, 2005 19:02 |
Nonstaggered Grids and Momentum Interpolations | S. Wang | Main CFD Forum | 3 | March 2, 2001 14:44 |
question | K.L.Huang | Siemens | 1 | March 29, 2000 05:57 |
upwind schemes,zonal grids and LES | Prabhu | Main CFD Forum | 5 | October 20, 1999 20:43 |