×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Excel Limits for FE analysis

Excel Limits for FE analysis

Excel Limits for FE analysis

(OP)
Has anyone tried using excel for a Finite Element Analysis? I've done it with a small structural frame when I was in school but I'm wondering if excel is able to invert a large 1000x1000 matrix. I know the minverse function can only handle up to about n=256 so I'm wondering if there is a way to compile and invert the matrix on the VBA side of excel. Thanks.

RE: Excel Limits for FE analysis

Of course there is. Just look it up in any numerical recipe book and convert the algorithm to VBA.

Whether it solves in a reasonable time is a whole separate issue.

Cheers

Greg Locock

SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Excel Limits for FE analysis

(OP)
Thanks. So whats a good, efficient numerical method? Anyone have any recommendations or refferences? Would a sparse accellerator be good? How does that work? Anyone have this code they want to share?

RE: Excel Limits for FE analysis

With FE the matrix is banded so there's no need to invert a square matrix, but use a banded solver instead. You'd have to use an algorithm to reorder the node numbers to minimise the bandwidth first. You can find these in lots of text books if you look around.

Excel will be slow though as the code isn't compiled. I've written a Boundary Element code in excel before with a square matrix of typically 100 x 100. The solve time of milliseconds is too slow for some these days.  

corus

RE: Excel Limits for FE analysis

> The solve time of milliseconds is too slow for some these days.   

smile

Try a freeware C or Fortran compiler - that´s the most straightforward route to fast home-made FE. Expect VBA in Excel to be horribly slow for your application. I was shocked when I wrote a small dof radiation solver recently.
 

RE: Excel Limits for FE analysis

Or else go to the surprisingly fast OpenFEM in Matlab. All the heavy computational lifting has been done for you in Matlab.



 

Cheers

Greg Locock

SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Excel Limits for FE analysis

(OP)
Thanks, can I link these Fortran/Freeware C compilers to excel?

RE: Excel Limits for FE analysis

I think it is a good idea to link VBA in Excel to C code. Beside the fact that C is fast, there are state of the art sparse solvers such as superLU that are free. I don't recommend you to write a linear solver of your own.

Yes, you can link VBA to C codes. A colleague of mine just presented in a group meeting a few months ago the way to do it. I just remember that it is not very straight forward, nothing else.

If you code in Matlab, you can link to C and Fortran also. But again it is not very straightforward. You'll need to write gateway functions to pass parameters back and forth. But actually, Matlab linear solver is not too bad. It can handle, say, 10,000 dofs pretty fast.

Have a good time coding!


RE: Excel Limits for FE analysis

You may find the articles from my blog listed below of use:

http://newtonexcelbach.wordpress.com/2008/08/27/solving-simultaneous-equations/

http://newtonexcelbach.wordpress.com/2008/12/20/solving-simultaneous-equations-fortran-dll/

http://newtonexcelbach.wordpress.com/2008/12/01/linking-excel-to-fortran/

http://newtonexcelbach.wordpress.com/2008/09/02/linking-excel-to-c/

I found it considerably easier to get Fortran routines linked to Excel than C, but that may be because I'm not that familiar with C.  Either should work well, once you gety the system sorted out.

Also whilst VBA is undoubtedly much slower that Fortran or C, for many applications it will be more than fast enough.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/
 

RE: Excel Limits for FE analysis

So far every question by the OP is adequately answered by a google search. Perhaps he could do us the favour of doing some research.


 

Cheers

Greg Locock

SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Excel Limits for FE analysis

Quote:

" Expect VBA in Excel to be horribly slow for your application. I was shocked when I wrote a small dof radiation solver recently."

VBA is slower than a compiled program, but it shouldn't be that slow.  Two of the main things that can be done to speed things up is to make sure that all the data is transferred into VBA at once, as arrays rather than cell by cell, and avoid using worksheetfunction in the VBA code.  This applies particularly in Excel 2007.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/
 

RE: Excel Limits for FE analysis

FWIW inverting a 1000 by 1000 matrix of random numbers in Octave, using a compiled standard maths library, took 2 seconds, Matlab would be the same or faster I should think. I didn't try the same using a sparse matrix as the reordering problem is a little more complex than I can be bothered with today.


 

Cheers

Greg Locock

SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Excel Limits for FE analysis

Further to my earlier post, VBA is about 6 times slower than a Fortran dll linked to Excel, using the same algorithm.  I don't know if Greg's computer is much faster than mine, or if he has a superfast algorithm (or both), but my Fortran code took about 9 seconds to do Gaussian elimination and back substitution on 1000x1000 random numbers.  A C++ dll was a little slower.

Excel 2007 will invert a 1000 x 1000 matrix using the minverse() function, and takes about the same time as the VBA.

If you do use VBA the way to read the numbers into a VBA array is:

1: create a variant variable
2: Read the data into this variable:
   vbaarray = range("datarange").value2
3: This will create an array of variants.  For less maths intensive applications it is usually best to leave it at that, but in this case it is worth creating a new array of type double, and reading the contents of the variant array into the double array.  As far as I know, the only way to do that is:

Redim vba_double_array(1 to numrows, 1 to numcols)
for i = 1 to numrows
for j = 1 to numcols
vba_double_array(i,j) = vbaarray(i,j)
next j
next i

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources