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

Water Supply analysis program

JohnNichols
Valued Contributor III
2,349 Views

Dear mecej4:

I am teaching a class about water supply analysis, using the program Magni.  I have not played with the program since your very kind help in making the program.  I went back to the 3000 node model from an Australian town and have created the data files for Magni.  I am slowly debugging the input file, when it is working I will put up a copy.  I have about 350 of the nodes and pipes in and it appears to loop and work nicely.  Even when it fails to converge, it runs 1000 times in 24 seconds. 

I was racking my brain trying to remember where the heck the program came from -- I worked through this site reading the old posts when you got PARDISO working, but I was none the wiser. It has to come from somewhere - there is a C# version I think?  My students are doing a town of about 10000 people. I think I will need to look to add pump input.  

I wish I could remember.  I know you did a huge part of the program, I can see your fingerprints all over it. (Getting to old)

JMN

0 Kudos
29 Replies
Steve_Lionel
Honored Contributor III
665 Views

What @mecej4 said. I think using link you get the wrong "subsystem".

0 Kudos
JohnNichols
Valued Contributor III
651 Views

Thank you both, it worked perfectly first time.  

What is a subsystem?

Is there are way to stop the program so we can see the console printout -- it is 1988 since I last did it. 

I sent the program to some students to see if they can get it to run.  Fingers crossed. 

In MS Fortran 3.03, with two floppy disk drives the /Fe switch was not used, when did that come into play.  

There are still some errors but the students should be able to get a moderate size model running. 

 

0 Kudos
mecej4
Honored Contributor III
641 Views

See https://commandwindows.com/configure.htm . Set the screen buffer size to something like 120 X 5000, and you will be able to use the scroll bar instead of using the Scroll-Lock button or Ctrl+S/Ctrl+Q to control the output. You can also change the foreground and background colors, font and size of text, etc.

Many things changed going from the 16-bit MSDOS world to 32-bit Windows. MS put out a short-lived Fortran PowerStation (FPS) for 32-bit Windows, then sold that product to DEC, which was then sold to Compaq and finally to Intel. This compiler used the /Fe designation for naming the output EXE.

0 Kudos
JohnNichols
Valued Contributor III
631 Views

Again thank you.  I used the Powerstation for a while in the 90's but it really had a lot of problem with some fairly standard Fortran - I remember vaguely the matrices gave weird errors.  

So the subsystems are the 32 and 64 bit - the 32 bit system has an error on loading -  no idea what causes it and I have no desire to reinstall - but the 64 bit is fine. So I assume I should use the 64 bit. 

 

Capture.GIF

0 Kudos
Steve_Lionel
Honored Contributor III
620 Views

No, subsystem is console vs. windows. /subsystem:windows is what you use when your "entry point" is a WinMain function.

0 Kudos
emilase3
Novice
559 Views

The purpose for doing so is to keep away from a capacity of accumulation of round-off mistakes (one for every development of dT). Using the product shape introduces simplest a single example of capacity spherical-off blunders.

0 Kudos
jimdempseyatthecove
Honored Contributor III
555 Views

>>The purpose for doing so is to keep away from a capacity of accumulation of round-off mistakes (one for every development of dT)

One technique is to NOT use accumulations, instead use products.

    real :: T0, T, Tend, dT
    integer :: interval
    
    ! not this
    dT = 0.001
    T0 = 0.0
    Tend = 12.34
    do T=T0, Tend, dT
        ! ...
    end do
    ! use this
    do interval = 0, huge(interval)
        T = T0 + (dT * interval)
        if(T > Tend) exit
        ! ...
    end do

Similar thing to where you might be accumulating (or diminishing) by an interval.

Jim

0 Kudos
JohnNichols
Valued Contributor III
544 Views

A water supply system is like a Whale's neural network. It is velocity dependent.  If I add water to a reservoir at time zero, the change in pressure is not felt immediately at the other side of the city, so at best it is an approximation.  Luckily the controlling part is the worst shower pressure at the highest hydraulic location.  Top of a hill, 2 storey house and a shower in a parent's remote bathroom at the back of the house, mother rings mayor and complains about pressure.  So modelling is a poor approximation, but the only tool we have until you monitor the full network. 

I started with the Tamworth Network in Australia, and I used to analyze it on the Watsys system on a mainframe, it was expensive and a whole day to make one run.  Streeter and Wylie is a very old Fluid Mechanics textbook from the 60's. I learnt from it in the late 70's and noticed it had a Hardy Cross solver in a Fortran program.  There is nothing wrong with Hardy Cross except that it is slow and you need to create all of the loops on the network in advance.  

I developed a set of LISP and Fortran routines, using a COMPAQ Portable and MS 3.31 Fortran to make the models and create the data files in the late 80's.  Before KYPipe and EPANET. 

Then I become an academic and put them aside.  A few years, for reasons lost in an old mind, I pulled out the old HC program and had a look at it.  I then downloaded EPANET and had a good look at the code.  But it is written in C and it has a Pascal GUI.  I hate C and Pascal is a beast.  But somehow, I developed the code in C#, which is not that hard to translate from C, but is a much better development language and then from mecej4 I translated it into Fortran in a weekend.  I first used the Pardiso solver from the Swiss for the C# and then the MKL version for the Fortran. 

I really like playing with it, but I lack the time and there really is not call for another water supply modeller, although the charge for one of the commercial ones is quite high.  But I learnt a lot from the translations. 

The only way to check the results is to run against another program using a different method and hopefully have some real experimental results.  The HC does get dodgy as it gets bigger. 

So it is a toy to me, but a fun one. 

0 Kudos
JohnNichols
Valued Contributor III
543 Views

without mecej4 and his help with packing the sparse matrix I would not have solved these problems. 

0 Kudos
Reply