Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Large Stiffness Matrix

Status
Not open for further replies.

ctmfab

Mechanical
Oct 1, 2002
21
0
0
US
Does any know how to handle very large arrays or matrices in VB6.0 (or any programming language). I get a memory error when using arrays that are of several thousand terms. (ie 3000x3000). This is for math calculations for stiffness matrix of steel structures.

I have seen suggestions to use an array of arrays. In other words each row of the matrix would have an array. This seems to be a good idea, but I don't know how to create additional arrays at runtime since the actual size of the matrix is unknown at design time.

Any ideas appreciated.
 
Replies continue below

Recommended for you

ctmfab:

There are 3 ways to store the stiffness matrix:

1. The upper symmetric part.
2. The upper simi-band width
3. The non-zero profile (skyline) (Sparce matrix)

To give some idea for a 3000x3000
full 9,000,000
upper symmetric 4,501,500
upper Semi-band +/-75,000
Skyline +/-60,000

Obviously, the dificulty of programming increases as the size decreases.
Fortunately, you may find numerical algorithms for Sparce matrices (multipication, Gauss reduction, etc) in the book of Numerical Recipes, some of the Fortran/C subroutines are online for free.


In addition, to have the smallest semi-band or the lowest skiline you should number the nodes adequately. The algoritm of CutHill-McGee es very efficient to get best numbering of nodes.

CMFG
 
Your problem seems to be a memory storage problem. You should try to use banded or skyline solution technique to see if there is any difference. I use Matlab, I use variable memory allocation. You can also do teh same in Fortran 90 as well as in C/C++. I also clear momory of many variables which are currently not in use. Your stiffness size of 3000x3000 seems to be not so large, I handle three times of this size in 126 MB ram. Try to increase your ram or use dual processor. I hope particular computer is not a concern here.
 
yes, true....u need to create the matrix dynamically..in C++/C , use the "new" operator..It allocates memory in the heap (more than sufficient)..Say int *i = new int[2000]..Think it is a good option to write a 'Matrix' class that handles this..It could have a memeber variable like
int** m_p2DArray...A constructor cud look like this...:-->>>

Matrix(size_t Rows , size_t Cols):
m_iRows(Rows), m_iCols(Cols), m_iNElements(Rows * Cols)
{
m_p2DArray = new T*[m_iRows] ;
for (size_t iRowIndex = 0 ; iRowIndex < m_iRows ; iRowIndex++){
m_p2DArray[iRowIndex] = new T[m_iCols] ;
for (size_t iColIndex = 0 ; iColIndex < m_iCols ; iColIndex++){
m_p2DArray[iRowIndex][iColIndex] = 0 ;
}
}
}

try this ...it works...!! hope this is what u need..!!
 
Status
Not open for further replies.
Back
Top