CFD Online Logo CFD Online URL
Home > Forums > General Forums > Main CFD Forum

A Question on Multi-Rectangular Grids

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

LinkBack Thread Tools Display Modes
Old   June 11, 2000, 04:02
Default A Question on Multi-Rectangular Grids
Bharanidharan Rajamani
Posts: n/a

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.
  Reply With Quote

Old   June 11, 2000, 11:48
Default Re: A Question on Multi-Rectangular Grids
John C. Chien
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,..
  Reply With Quote

Old   June 12, 2000, 18:58
Default Re: A Question on Multi-Rectangular Grids
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.
  Reply With Quote


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
Unanswered question niklas OpenFOAM 2 July 31, 2013 16:03
link multi blocs ben souissi Phoenics 1 August 4, 2005 18: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 04:57
upwind schemes,zonal grids and LES Prabhu Main CFD Forum 5 October 20, 1999 19:43

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