Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Harrison 1967 Fortran

JohnNichols
Honored Contributor I
6,686 Views
            Do 610 I=1,L
                  IP1 = I + 1
                  TEMP = ABS(ASAT(I,I))
                  K = I
                  Do 520 J = I,L
                        DUM = ABS(ASAT(J,I)) - TEMP
                        IF(DUM)520,520,510
510                     K = J
                        TEMP = ABS(ASAT(J,I))
520               Continue
                  IF(K - I) 530, 550,530
530               DO 540 J = I,KJ
                        TEMP = ASAT(I,J)
                        ASAT(I,J) = ASAT(K,J)
                        ASAT(K,J) = TEMP
540               END Do


550               IF(ASAT(I,I)) 570, 1000, 570
570               TEMP = 1.0/ASAT(I,I)
                  do 580 J = I,KJ
                        ASAT(I,J) = ASAT(I,J)*TEMP
580               END DO

                  do 610 J = 1,L
                        IF(I-J)590,610,590
590                     TEMP = ASAT(J,I)
                        DO 600 K = IP1,KJ
                              ASAT(J,K) = ASAT(J,K) -TEMP*ASAT(I,K)
600                     END DO
610         END DO


            DO 650 I = 1,M3
                  CSAT(I) = 0.0
                  DO 651 J = 1,L
                        CSAT(I) = CSAT(I) + A(J,I)*ASAT(J,L+1)
651               END DO
650         END DO!

            DO 660 I = 1,M2
                  K = ((I+1)/2)*2-1
                  SATX(I) = SF(I,1)*CSAT(K) + SF(I,2)*CSAT(K + 1)
660         END DO

This comes from some Harrison Fortran Code in 1967 for second order elastic analysis, he says that it ran on a CD 3600 computer in 17 minutes for 17 cycles,  the code write-up does not really discuss this section, after playing with it for a while, I think this is the earliest inverter I have ever found.  

What was a CD 3600 computer? It was at Le High University and would 17 minutes be the limit they were allowed for time.   I put in a separate inverter just to make sure from Conte and De Boore,  as I tried to work out the code.  They really worked to use limited memory.  

Why is this important, running on modern computers it allows us to do major structural problems not constrained by the annoyances in the major programs. I was reading Strand7 stuff on this type of program and it was so close to some of the stuff Harrison wrote it was eerie. 

It runs in a few seconds.  

 

Editing out the arithmetic ifs is fun. 

0 Kudos
42 Replies
JohnNichols
Honored Contributor I
2,685 Views

There is a bit to add to the program to make it modern.  

Harrison had published a paper where he talked about programming the ELSO into plastic. The code is not in the paper, but appears to be in a report at Le High.  I am trying to get it. 

How did you get your old name back? @mecej4 

Plus these are published results we do not know for sure they are correct.  I was playing with ZZ and it does some weird things as it gets smaller.  

0 Kudos
witwald
New Contributor II
2,375 Views

Hello @mecej4 . Thank you for pointing out that issue. The original Harrison code did the right thing, but my initial implementation inadvertently introduced an incorrect-initialization error. This has now been corrected, and the code matches the original Harrison code in that respect. I just wanted to have an as-good-as possible, as-published line-by-line implemenation of the original Harrison code, to serve as a potential benchmark for future modifications. A copy of this corrected version is attached here.

0 Kudos
mecej4
Honored Contributor III
2,020 Views

@witwald, there remains an initialization error in your ELSO.f90. Here a simple correction for that: 

After reading the member connections data, compute

   L =  SUM( jtype(1:jct,1:3) )   ,

and do the initialization

   VL(1:L) = 0.0

0 Kudos
JohnNichols
Honored Contributor I
1,996 Views

@witwald,  

@mecej4  with the latest iteration of ELSO provides a master class in how to reconfigure old Fortran.  It is quiet a treat to read.  The comments are sparse but clear.

 

!---------------------------------------------------------------
! The joint coordinates are adjusted
!---------------------------------------------------------------
       lct = 0
       do i = 1, jct
          do j = 1, 3
             if (jtype(i,j)<=0) cycle
             lct = lct + 1
             if (j>=3) cycle
             cord(i, j) = scor(i, j) + defx(lct)
809       end do
       end do

 

For example he provides a neat rearrangement of the arithmetic if's with the use of cycle. 

Some one else looking at it might have offered:

!----------------------------------------------------------------------------------------------
!
!     Add the deflections to the original positions
!
!----------------------------------------------------------------------------------------------
LCT = 0
DO  I = 1,JCT
      DO J = 1,3
            IF(JTYPE(I,J) .gt. 0) then
                  LCT = LCT + 1
                  IF((J-3) .lt. 0)  then   
                        CORD(I,J) = SCOR(I,J) + DEFX(LCT)
                  end if
            end if
      end do
END DO

The difference often comes down to individual choice, I do not use cycle, never have.  The 809 in the first code is the remnant of the use of a single end do, with the line numbers removed it has to be adjusted.  

Harrison's flaw, for want of a better word is adding the extra row to the NxN stiffness matrix, but at that stage there are only academic papers on inversion, principally in structures by Wang.  And this was the early days.  But now if we want to use MKL we need to reduce the stiffness matrix.  Interestingly the run time difference from Harrison's inverter to MKL is almost nothing. 

The other issue is the need to check the answers on big problems, so as @mecej4 taught me many years ago, use allocate and a base module, so the problem is easy to scale up.  And add a drawing routine so you have a visual output which makes it much easier to check on problems like this bridge over the Mississippi River, sadly it was taken on the 19th Ultimo to be replaced by an interesting structure.  The visual code produced in AutoCAD allows for a check of large problems, this one below is about 300 members, and you can do all the checks, member type, stress resultant and lambda factors for a plastic analysis and plot a result for the client.

One can put a Monte Carlo system around the program and test across the full statistical spectrum, this one in Ularc will do 50,000 runs overnight.   The standard output file for this number of runs is 50 GB.  One of course has VEDIT to look inside the file.   Thank God for VEDIT, it is impossible to make DXF file checks without it.  The better way is to just collect the 50,000 lambda minimums and do a statistical analysis. 

JohnNichols_0-1769354356525.png

 

The actual plot is the following which you can give the client.  It is much better than a long EXCEL file or 50 GB.

JohnNichols_2-1769355057646.png

 

 

JohnNichols_1-1769355013618.png

Harrison uses a single brace in one problem.  If you need to put a door in you have to use a single brace, as one of the chaps I knew found out the hard way.  But a single brace is not a good solution for cost and I would prefer not to have a brace in compression in an earthquake a recipe for dead people. 

The secondary problem with AutoCAD is you need a large array, each element covering about 1 mm in size, when you occupy a space on the drawing you switch on the element, you then know not to put two items in the same place, above 5 and 6 were moved apart, but clearly incorrectly. 

So we are exceedingly lucky to have such people.  

I remember reading a story in the 80's  that was the time of management consultants looking for efficiency,  apparently the story goes the MC went into the IBM Watson Building. At the end of the work, they said we know what everyone does except the guy in the corner office on the ground floor. He sits there all day and occasionally people pop in and out. 

The IBM manager said, he is the guy who solves the unsolvable problems, he is not to be touched, he saves us millions every year..  

There are a small number of people like this, my favourite was my fourth year structures lecturer, Peter Kleeman, he was a font of wisdom and humility.  

John

 

 

 

0 Kudos
witwald
New Contributor II
1,962 Views

I understand the

       L = SUM(jtype(1:jct,1:3))

bit of code. What it is doing is checking to see whether an individual degree of freedom (DOF) at a junction (node) has been set to be free, in order to produce a count of the number of active DOFs. An active DOF is denoted by '1', whereas a fixed DOF is denoted by '0'.

But isn't that exactly what the lines labelled as 1150–1180 do?

      L=0               ! 1150
      DO 70 I=1,JCT     ! 1160
          DO 70 J=1,3   ! 1170
70    L=L+JTYPE(I,J)    ! 1180

And these are then followed elsewhere by the following initialization code:

78    DO 72 I=1,L       ! 1240
72    VL(I)=0.0         ! 1250

My aim is to keep the code as close to the original Fortran as possible, while still ensuring that it works for the two problems described in Harrison's book.

0 Kudos
JohnNichols
Honored Contributor I
1,956 Views

@witwald 

 

We all communicate differently, thank god.  You are correct the two are exactly the same, I would be surprised if the machine code is different between the two. 

Of course there is the long discussion on this forum about syntactic sugar from Perlis, https://en.wikipedia.org/wiki/Syntactic_sugar

provides a good summary., which can never be resolved because it is a personal opinion, but as I learnt with LISP, remove any sugar, and I love the brevity of the language, it is just useless for structural stuff, but it is fun.  And it is great in AutoCAD. 

I understand your desire for the original, I need a program that I can scale up and use with real structures, so we have different ends. 

@mecej4  just made it modern, well partly, but it is also nice as the original is.   You can learn a lot from his terse comments. 

The forum can be ignored, but it is just full of highly opinionated people that can make you tear your hair out.  

It is a neat program, however you code it.  

IFX caused some fun last night, it was the last thing I needed at the end of 12 hours of Fortran programming.

Just enjoy the ride and continue to express your opinion.  The interesting thing is how many ghosts inhabit this board.  I am glad you are not a ghost.  

John

 

Plus if you are going to make significant changes then you need a lot of print statements.  

 

0 Kudos
witwald
New Contributor II
1,824 Views

Attached is a refactored version of the original Fortran code for Harrison's ELSO program. It has been adjusted to use some features of Fortran 90, and use of GOTO's has been greatly reduced. The arrays are dynamically allocated based on the size of the problem being solved. Hopefully the code is now a bit easier to follow, and easier for those who might like to tinker with it a bit further.

mecej4
Honored Contributor III
1,796 Views

Thanks, @witwald , for posting the cleaned-up code and the two input files. The new code has the additional nice feature that the sizes of the arrays can be calculated after reading the input data file, and the arrays are then allocated with just the correct sizes for the problem being solved.

0 Kudos
JohnNichols
Honored Contributor I
1,793 Views

@witwald , very nice.  I like how you solved the arithmetic if problem that bedeviled me.  

I have added Pardiso solver to the program,  it was a lot easier to install than the other. 

Neat code to read.  Well done, splice the main brace.  

I was looking at LU decomposition  after thinking about ELSO original solver.  I found some interesting code that surprisingly for the first time had Fortran first.  

I will steal some of you code if that is ok?

 

0 Kudos
witwald
New Contributor II
1,739 Views

Hi @JohnNichols,

 

You're most welcome to use the code that I provided; it's hardly what I'd call mine.

In case you might be interested, there is a large repository of Fortran 90 mathematical software located at:

https://people.math.sc.edu/Burkardt/f_src/nswc/nswc.html 

0 Kudos
cean
New Contributor II
1,478 Views

I have played with this Ra(11). It works.

 

Now I copied the Ra folder to another folder and loaded the Ra.sln there, it has an error saying:

fatal error LNK1104:cannot open file 'mkl_intel_lp64_dll.lib'

Which setting I need to change for this? Project/Properties/ ?

 

Thanks for help.

0 Kudos
DavidWhite
Valued Contributor II
3,206 Views

I believe a CDC 6400 was the mainframe we had at Adelaide University while I was a undergraduate in 1976.  It was such an advanced machine that I believe they rented out compute time to local businesses.

 

As undergraduates, we had to use punch machines to punch cards and submit the decks for execution.  Usually the punch machine had worn out typeewriter ribbons, so you could not read the text at the top.  One got adept at reading the punch marks!

 

Two stories from that time - two students submitted the same deck as their homework assignment - the tutor quickly spotted the same spelling mistakes in the Fortran comments and awarded them 18/20 for the assignment, shared equally as 9/20 each!

 

Also some post grads using mag tape input tested code to put two copies of itself onto the input queue.  Eventually the queue overloaded and the machine went down.  To restart the machine, the techs used the same input tape, resulting in the same crash.  Only then did they restart the machine with a new tape!

0 Kudos
JohnNichols
Honored Contributor I
3,013 Views

We had to walk about a mile to the computer support section and drop off the punch cards and wait 24 hours.  My professor did an experiment with the students he gave each one different data and had them run the analysis and then hand in the answers, it was for some research, of the class I was the only one to do the wrong data.  Then I found a little box computer in the library they called daemon and it took cards and ran Fortran straight away, 'twas great. 

0 Kudos
JohnNichols
Honored Contributor I
2,509 Views

Hello  @witwald 

 

      double precision, parameter :: TWO = 2.0
      double precision, parameter :: FOUR = 4.0

I am glad you copied in the original code, I hope you used OCR.

Using the two programs I looked backward through the answers and found I had set the parameter FOUR to a value of 2 instead of 4.  

Even the worst of us make mistakes. 

 

Here is your file in a VS Folder.  

 

Thanks heaps. 

I have asked our library to find the last book by Harrison, could be a hard ask - but we shall see.  

John

0 Kudos
JohnNichols
Honored Contributor I
2,267 Views

This is Harrison's 65 book, it gives more detail about the ELSO program development and the results.  

 

witwald
New Contributor II
2,191 Views

Hi @JohnNichols ,

I'm glad my implementation of the original Harrison could helped you sort out your bug. And I did use OCR to do the bulk of the work. That was followed up by two Fortran-calibrated eyeballs going line-by-line through the code to fix the litany of OCR text conversion errors; the OCR engine didn't speak Fortran particularly well.

And now I must go and fix an error with incorrect initialisation of the VL array that stores the applied loads...

0 Kudos
JohnNichols
Honored Contributor I
2,115 Views

Hello @witwald 

 

@mecej4  was just playing with your mind.  The zero initialization is a good idea, but if you set all the numbers in a loop then the lack of init is not really that important. 

 

@mecej4 , I got the MKL inverter running in ELSO and took out most of the arithmetic if's.   It was interesting to switch it over and convert the program.

But,  I cannot get around this 340 and 360 combination.  I have had two long attempts and both times I ended up a lot of NAN's.  He is trying to avoid the fixed joints and I see how he does it but unwinding it just gets nowhere.  

He is assembling the stiffness matrix, in total rather than assembling the beam matrices and adding them to the overall as he did in the 3D program from a few years ago.  

His convergence checker had two steps, I simplified it by getting the sum of the absolutes of the new deflection - old deflection, it gives an error of about 0.00014 at six iterations and deleting his second checker.  His 13 iterations in the book has to be a typo error.  

Your thoughts appreciated. 

John

 

            write(SR2,902)
            write(SR1,902)
            DO 450 J=1,JCT                                                                                           
                  DO 440 M=1,NM
                        NA=NJ                                                                                            
                        IF(J-MCON(M,1))340,330,340                                                                       
330                     JF=MCON(M,2)                                                                                     
                        MJ=2*M-1                                                                                         
                        MF=MJ+1
                        GO TO 360
340                     IF(J-MCON(M,2))440,350,440                                                                       
350                     JF=MCON(M,1)                                                                                     
                        MJ=2*M                                                                                           
                        MF=MJ-1
360                     X=CORD(JF,1)-CORD(J,1)                                                                           
                        Y=CORD(JF,2)-CORD(J,2)                                                                          
                        D=SQRT(X*X+Y*Y)          

 

 

David_DiLaura1
New Contributor I
2,264 Views

In 1972 we were running radiative transfer code on the University of Colorado's CDC 6600. Beautiful machine. The Computing Center was off the main campus in its own building. The Engineering Center had a Data Center connected to the Computing Center by rooftop IR transmitters/receivers. No, really.  The only time is was fiddly was when it snowed.

0 Kudos
JohnNichols
Honored Contributor I
2,115 Views

It is going to snow now.  

Was  life not simpler with a desk phone and one per family. 

0 Kudos
JohnNichols
Honored Contributor I
2,109 Views

@mecej4 

 

The end of the program has a weird mess of goto's, he was trying to avoid printing each step, so he uses gotos to avoid the middle 4 print stages,  I would have loved to see his flow chart. 

Plus Harrison returns the LU matrix, but it is different to the MKL LU return, he has all 1's on the diagonal. 

He uses his "LU" matrix as part of the solution, so I 

do I = 1,N
      A(I,I) = 1.0
end do

 added the following before returning A from the MKL routine, to the main program, I did not have enough time to dig into it well, but I could then take out his stuff.

John  

 

0 Kudos
JohnNichols
Honored Contributor I
2,109 Views

@mecej4 , thanks for the earlier thoughts.  

 

0 Kudos
Reply