ZGREEN - Wave Patterns made by Havelock Sources

Discussion in 'Software' started by Leo Lazauskas, Jan 3, 2011.

  1. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    Several people have asked me for a program to produce simple wave patterns.
    Some want to use the patterns as backgrounds for their ship design drawings;
    some want a method to illustrate wave cancellation and reinforcement,
    and others just want to create "Greeting Cards" like the one I posted in
    http://www.boatdesign.net/forums/open-discussion/merry-christmas-happy-new-year-35940.html

    The attached file "zg10.zip" contains programs to calculate and display
    the wave elevations made by arrangements of Havelock sources and sinks.

    For a quick demonstration of the program:
    1. Uncompress the zip file.
    2. Run the batch file rzgreen.bat
    3. To view results, run the batch file rzplot.bat
    4. Documentation is in the "doc" sub-directory.
    5. The "in" sub-directory contains several example input files.

    If you like the programs, please tell us the execution times for the examples
    on your PC. If you have a creation you are particularly proud of, please show us.

    Have fun!
    Leo.
     

    Attached Files:

    • zg10.zip
      zg10.zip
      File size:
      482.2 KB
      Views:
      1,078
    2 people like this.
  2. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    There are some applications that are not strictly related to ship hydrodynamics
    that some may find interesting...

    The attached pictures show photos of cloud patterns made by small islands, and
    wave patterns produced by the program.
    Amsterdam Island is in the Indian Ocean; Bouvet Island is in the South Atlantic.
    There is little doubt that early navigators (such as the Lapita people) could use these
    cloud patterns (along with many other clues) to locate distant islands.

    Leo.
     

    Attached Files:

    1 person likes this.
  3. DCockey
    Joined: Oct 2009
    Posts: 5,229
    Likes: 634, Points: 113, Legacy Rep: 1485
    Location: Midcoast Maine

    DCockey Senior Member

    Thanks!

    Example 2b took 240 seconds on an HP dv7-4173US, AMD Phenom II N950 Processor, 2.10 GHz; 4 GB memory, Windows 7 64-bit. I watched the performance on the Windows 7 Performance monitor. Overall CPU usage was 26% to 30%, with CPU's 1 and 3 usage running around 50%. The other two CPU's were much lower.
     
    1 person likes this.
  4. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    Thanks for the timing.
    I very much doubt that the program is using more than one processor.

    I am still trying to work out how to co-ordinate multiple processors for the more difficult "inverse problem " where we must find the object from a given wave pattern. It's pretty easy for humans (e.g. see photos above) but computers are pretty dumb. In some circumstances humans have trouble seeing what is going on (e.g. example 16).

    Leo.
     
  5. DCockey
    Joined: Oct 2009
    Posts: 5,229
    Likes: 634, Points: 113, Legacy Rep: 1485
    Location: Midcoast Maine

    DCockey Senior Member

    I ran zgreen.exe via rzgreen multiple times this morning using example 2B. Processor use was monitored using Resource Monitor which displays graphs of each total and individual processor usage, as well as a table of processes and their use. With the computer "quiet" total CPU usage is generally 2% with occasional brief increases. I didn't do anything to shut down other processes running in the background. When running it CPU usage was generally 27%, occasionally higher, with zgreen.exe using 25%. While it was running the usage on two CPU's increases significantly, one somewhat more than the other.

    Times were very consistent, 179 sec to 182 sec. The variation is probably mostly a function of the accuracy of my timing.
     
    Last edited: Jan 4, 2011
  6. DCockey
    Joined: Oct 2009
    Posts: 5,229
    Likes: 634, Points: 113, Legacy Rep: 1485
    Location: Midcoast Maine

    DCockey Senior Member

    Some interesting and repeatable, but unexpected results. I tried running multiple instances simultaneously, starting them in succession as quickly as possible, and the execution times were shorter with multiple intances running. Run times (rounded to nearest 5 seconds) were:
    1 instance: 180 seconds
    2 instances: 150 seconds
    3 instances: 140 to 150 seconds
    4 instances: 150 seconds
    Each instance/process showed 25% CPU usage except when 4 instances when one or two would have CPU usage periodically reduced to 24%, presumably due to other processes needing attention.

    These results are repeatable. No idea what is going on though.

    Back to multiple processors showing activity when only one instance is running. Presumably the "operating system", either software or hardware, divides tasks among the processors. It is interesting though that the CPU usage per thread tops out at 25% with four processors.
     
  7. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    Good work there!
    I think you have just shown us (and yourself) why most people quote "wall clock time" rather than trying to estimate CPU time or some other measure. It's just too messy when operating systems can distribute themselves among multiple processors and when there are unknown processes lurking in the background.

    All the best,
    Leo.
     
  8. DCockey
    Joined: Oct 2009
    Posts: 5,229
    Likes: 634, Points: 113, Legacy Rep: 1485
    Location: Midcoast Maine

    DCockey Senior Member

    Yes, wall clock time from input to output is what matters in the end. That's what I was measuring. I was curious about CPU processor usage because I continue to wonder how much benefit multiple core processors actually provide. Several decades ago I worked with a fellow who was a recognized international expert in supercomputer performance. He had quite involved proceedures for determining the relative speed of the computers. But users like me were more interested in how long did we have to wait for our jobs, and how many could be done per day.

    The calculations of wave pattern generation from sources/sinks of specified strengths would lend themselves to a simple parallel approach since the calculations don't involve any interactions between different locations in the domain. Divide the domain into parts and launch a separate process to calculate the wave heights in each domain parts and save the results in separate files. On the other hand given how quickly the calculations are done a reduction in calculation time of even 75% probably isn't worth the complications.

    What language are you using and what compiler? It's been several decades since I did serious programing for number crunching, and then I mostly used Fortran on a Cray or large IBM mainframe. Assuming I can find the time I'd like to some tinkering on a PC and am looking for language and compiler recommendations. It continues to amaze me that my $600 laptop is an order of magnitude or more faster than the Cray supercomputer was, let alone GB's of memory being the norm.
     
  9. DCockey
    Joined: Oct 2009
    Posts: 5,229
    Likes: 634, Points: 113, Legacy Rep: 1485
    Location: Midcoast Maine

    DCockey Senior Member

    I've tested ZGreen using Example 2b on four computers, three laptops and a desktop.

    Laptop, AMD Phenom II N950 Processor, 2.10 GHz; 4 GB memory, Windows 7 64-bit: 180 sec (previously reported)

    Desktop, AMD Athlon 64 X2 Dual Core Processor 4000+, 2.10 GHz, 3 GB memory, Windows 7 32-bit: 140 sec

    Laptop, AMD Turion 64 X2 Mobile Technology TL-60, 2.00 GHz, 3 GB, Vista 32-bit: 135 sec

    Laptop, AMD Turion II Neo K635 Dual Core Processor, 1.50 GHz, 3 GB memory, Windows 7 64 bit: 230 sec

    Not sure what to make of this. The oldest machine was the fastest.
     
  10. DCockey
    Joined: Oct 2009
    Posts: 5,229
    Likes: 634, Points: 113, Legacy Rep: 1485
    Location: Midcoast Maine

    DCockey Senior Member

    Another thought on the differences in times. The machines running Windows 7 64-bit were the slowest. The last one listed wasn't a surprise since it has a slow processor. But the first one was. I wonder if ZGreen was compiled as a 32-bit program and is slowed down when running on a 64-bit operating system in 32-bit emulation mode.
     
  11. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    Yes, that is a good strategy for some applications.
    For others it's better to run the program separately for different speeds.
    That's what I did to produce the animations of a "diamond tetrahull"
    http://www.cyberiad.net/waketet.htm
    I ran the code for that problem on different computers and then basically glued the results together in a cartoon.

    I used Fortran for the numerical work in zgreen, and C/C++ for the simple graphics program zplot.

    I dislike using super-computers and networks of workstations: all my work over the last 15 years has been on laptops and PC's. That means I can work cheaply and the result is useful to a larger pool of people.

    All the best,
    Leo.
     
  12. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    I'm not sure either.
    I get almost identical results on an i7 running 64bit Windows 7, and an i7 with 32bit XP.

    I'm as amazed as you when it comes to currently available computing power. I bought two i7's for under $2500. That's pretty cheap for something I use 16 hours a day, 365 days a year!

    Leo.
     
  13. BYDE
    Joined: Mar 2011
    Posts: 54
    Likes: 3, Points: 0, Legacy Rep: 66
    Location: Italy-China

    BYDE Junior Member

    Hello Leo,

    I also develop hydrodynamic codes based on potential flow, though with different techniques.
    I also have read some of your publications (and those by O. Tuck or D.C. Scullen). I'd like to ask you: zgreen is based on thin-ship theory right? would you be able to say a slenderness ratio limit to keep a reasonable accuracy?
    is zgreen similar (or the same) as the code SWPE?

    Thanks!
     
  14. Leo Lazauskas
    Joined: Jan 2002
    Posts: 2,696
    Likes: 155, Points: 63, Legacy Rep: 2229
    Location: Adelaide, South Australia

    Leo Lazauskas Senior Member

    No. zgreen deals with isolated singularities. However, it does use a linearised free-surface boundary condition with viscous effects at the surface.

    SWPE uses continuous distributions of sources whose strengths are determined from Michell's thin-ship theory. Other similar codes (such as Flotilla and Flotsm etc) use higher order continuous distributions of Havelock sources/sinks and Havelock vortices, and they also include viscous effects in the free-surface boundary condition.

    All the best,
    Leo.
     
    Last edited: Mar 21, 2011

  15. BYDE
    Joined: Mar 2011
    Posts: 54
    Likes: 3, Points: 0, Legacy Rep: 66
    Location: Italy-China

    BYDE Junior Member

    Thanks Leo, very kind.

    What do you mean with 'isolated singularities'?
    I'm not very familiar with the Havelock source as I use only the Rankine source (and I'm not a mathematician). However from the computational times reported above I guess there's a linear system being solved, to relate the influence of each source on the others.

    What kind of viscous effects does it model?
     
Loading...
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.