 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Wed Aug 10, 2011 7:39 am Post subject: Checkmate: array out of bounds |
|
|
We use the (FEM) matrix renumbering scheme found at:
1.) algorithm 509 and
2.) algorithm 508
The subroutine uses assumed size arrays. In debug and release mode the results are correct. When using checkmate an array out of bound error appears. What is the reason for this?
Code: |
SUBROUTINE DGREE(NDSTK, NR, NDEG, IOLD, IBW1, IPF1) DGR 10
C DGREE COMPUTES THE DEGREE OF EACH NODE IN NDSTK AND STORES
C IT IN THE ARRAY NDEG. THE BANDWIDTH AND PROFILE FOR THE ORIGINAL
C OR INPUT RENUMBERING OF THE GRAPH IS COMPUTED ALSO.
C USE INTEGER*2 NDSTK WITH AN IBM 360 OR 370.
INTEGER NDSTK
INCLUDE 'GRA.INC'
DIMENSION NDSTK(NR,1), NDEG(1), IOLD(1)
IBW1 = 0
IPF1 = 0
DO 40 I=1,N
NDEG(I) = 0
IRW = 0
DO 20 J=1,IDEG
ITST = NDSTK(I,J)
IF (ITST) 30, 30, 10
10 NDEG(I) = NDEG(I) + 1
IDIF = IOLD(I) - IOLD(ITST)
IF (IRW.LT.IDIF) IRW = IDIF
20 CONTINUE
30 IPF1 = IPF1 + IRW
IF (IRW.GT.IBW1) IBW1 = IRW
40 CONTINUE
RETURN
END |
|
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Wed Aug 10, 2011 7:57 am Post subject: |
|
|
Try the following change to your code:
DIMENSION NDSTK(NR,*), NDEG(*), IOLD(*)
This should stop bound checking for these arrays.
Alternatively, you could try and find what size has been allocated for these arrays in the calling routine.
This looks to be very old re-ordering code. You could try googling Marc Hoit or Scott Sloan for better algorithms, at least they were in the mid 80's.
John |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Wed Aug 10, 2011 8:22 am Post subject: |
|
|
This line
Code: |
DIMENSION NDSTK(NR,1), NDEG(1), IOLD(1)
|
is an old compiler optimization trick with some compilers. But it is not really standard Fortran.
Its best to do as John suggests. This won't disable bounds checking though (FTN95 can do bounds checking even on assumed size arrays like NDEG(*)). However, it should work properly as your arrays won't be dimension 1.
Alternatively, if you don't want to edit your code you can include the following switch on the command line (or in Plato you will find it as the option "Allow Old Arrays" in the Language section).
/OLD_ARRAYS
Best of luck _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Wed Aug 10, 2011 9:46 am Post subject: |
|
|
Thanks! Problem fixed. Continuing the checking resulted in a few type errors in the "implicit" part of the renumbering! It is the first time I use Checkmate and find it quite usefull!
John: Thanks for the tipp on the other renumbering schemes. In fact I have a working version of the Sloan code. At the moment I am re-arranging our existing code using a bit "modern" Fortran. As soon as the test-vector tests past, I would like to implement the Sloan code. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Wed Aug 10, 2011 1:57 pm Post subject: |
|
|
I have implemented both the Hoit and Sloan algorithms plus my own approach. Combining all 3 gives a fairly robust profile minimisation.
My approach is to test 3 node order lists by sorting all active nodes using:
x + .01y + .01z
y + .01x + .01z
z + .01x + .01y
It is surprising how frequently this simple approach produces the best solution, without any consideration of the tree structure of the connectivity.
John |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Wed Aug 10, 2011 2:01 pm Post subject: |
|
|
John, this is perhaps not on the topic. However, responding with Sloan so quickly means that you are familiar with this stuff! Anyway, the code I mentioned might be old-style Fortran. It compares good with the Sloan version.
1.) Test data by Everstine
2.) Sloan paper with code |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Wed Aug 10, 2011 4:07 pm Post subject: |
|
|
One last comment on Checkmate: I have been trying for days now to get the FEM (skyline) solver to work after some maintenance. Once I got the checkmakte to get to to solver part, the problem was fixed in a matter of seconds! That is another point to add to my list why I like FTN95  |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Thu Aug 11, 2011 2:23 am Post subject: |
|
|
The code you have looks like a variant of the RCM approach.
If so then Sloan should do better in most cases and much better in a few.
Sloan and Hoit consider both tree level and front size bias for their ordering approach, while RCM is basically limited to tree structure assessment.
I did a lot of work on this in mid 80's, trying to understand how these methods fail.
Recently I have been converting to Fortran 95, trying to produce code which is more conforming to the standard, especially in terms of memory management.
I have tried some variation to the Sloan/Hoit approach, by introducing a concept of member length into the tree level attribute. It works for a few examples but in general was not effective. The combination of Sloan, Hoit and sort is as good as I've been able to achieve.
The Hoit algorithm has a dual node connectivity and element connectivity data structure, retaining more of the element attribute in the algorithm. This has an advantage for some problems. My variant of the Hoit algorithm includes a tree level attribute, with a combined front size and tree level weightings in the approach, similar to Sloan.
I have a number of examples where both Sloan and Hoit do not work well. My directional sort approach addresses a number of these types, but there remain a number of examples with apparently poor ordering. My Everstine data sets are just connectivity data and now they look so small.
Some are characterised by a multiple ring structure, but others have no apparent type of tree structure to distinguish their unsuitability to the Sloan or Hoit approach.
My other recent project has been to parallelise my skyline solver to improve performance. It has not been a successful project to date. The solvers in the main commercial FE codes appear to be much faster and I wonder if the skyline/profile direct solver is an obsolete approach. It�s difficult to get a reliable comparison.
There are a number of others on this forum who have worked in this area.
Good luck |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Thu Aug 11, 2011 7:32 am Post subject: |
|
|
Hi John, thanks for your reply. This sort of motivates me to get deeper into the stuff. Our code is definitely not up to date. I only inherat the code and recently did a lot of reading on the different methods (renumbering, sparse matrices, direct solvers, etc.). Luckily I do not have to program the stuff from scratch. Since we use it for rotating electrical machines the movement is the important part. For this we use the approach explained in:
1.) A.A. RAZEK, J.L. COULOMB, M. FELIACHI, and J.C. SABONNADIERE
The calculation of electromagnetic torque in saturated electric machines within combined numerical and analytical solutions of the field equations,
Trans. I.E.E.E., Vol. MAG 17, pp. 3250-3252, 1981.
2.) A.A. RAZEK, J.C. COULOMB, M. FELIACHI and J.C. SABONNADIERE
Conception of an air-gap element for dynamic analysis of the electromagnetic field in electrical machines,
Trans. I.E.E.E., Vol. MAG 18, pp. 655-659, 1982.
There is no mesh in the air gap. Recently a student cleaned up the code and did a lot of improvements (thesis). We also started using an open source mesh. However, I found no 2D mesh generator written in Fortran. The one I have is very primitive and one actually needs to "program" the mesh. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|