home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2823 < prev    next >
Encoding:
Internet Message Format  |  1992-07-24  |  9.1 KB

  1. Path: sparky!uunet!olivea!decwrl!sun-barr!cs.utexas.edu!torn!cunews!nrcnet0!cu23.crl.aecl.ca!wl.aecl.ca!harrisp
  2. From: harrisp@wl.aecl.ca
  3. Newsgroups: comp.lang.fortran
  4. Subject: SUMMARY: Partial Diff. Eqn's. Thanks to all
  5. Message-ID: <24JUL92.12390271@wl.aecl.ca>
  6. Date: 24 Jul 92 18:39:02 GMT
  7. Sender: news@cu23.crl.aecl.ca (USENET News System)
  8. Organization: AECL RESEARCH
  9. Lines: 209
  10. Nntp-Posting-Host: wc4.wl.aecl.ca
  11.  
  12. From: HARRISP@WL.AECL.CA   (Phil Harris)
  13. Date: 24-JUL-1992
  14. RE:   Solving partial differential equations numerically (SUMMARY)
  15.  
  16.  I originally posted in article <21JUL92.11592567@wl.aecl.ca>
  17.  
  18. >From: HARRISP@WL.AECL.CA   (Phil Harris)
  19. >Date: 22-JUL-1992
  20. >RE:   Solving partial differential equations numerically
  21. >
  22. >Can anyone recommend a fortran callable  package for solving pde's and systems
  23. >of pde's. I really need the source code, preferably written as standard
  24. >Fortran 77 as I want this to run on a PC (80486) using Lahey Fortran. Some
  25. >documentation would be nice also. I'm looking for something that is fast,
  26. >since the model I am developing has to run for several months of real time.
  27. >I wrote a simple program to solve the equations using explicit
  28. >finite differences which works just fine, but I need to use very small time
  29. >steps for it to remain numerically stable, and takes almost a minute of
  30. >execution time on my '486 to simulate the results of a minute of real time.
  31. >I am currently working on a code using implicit (Crank-Nicholson) finite
  32. >differencing, but am having some trouble getting it to execute correctly.
  33. >I'm hoping that once I get this working, I will be able to use larger time
  34. >steps.
  35. >
  36. >The equations I need to solve are fairly simple:
  37. >
  38. >dQ(z,t)
  39. >-------  = a1*( Const1(z) - Q(z,t) )*C(z,t) - a2*Q(z,t)
  40. >  dt
  41. >
  42. >dC(z,t)                dQ(z,t)    dC(z,t)
  43. >-------- = -Const2 * ( ------- +  ------- )
  44. >  dt                     dt         dz
  45. >
  46. >a1, a2, Const2  are independant of z and t
  47. >Const1 independant of t, but dependant on z.
  48. >
  49. >Phil Harris                |  Imagination is more
  50. >Whiteshell Laboratories        |  important than knowledge.
  51. >Atomic Energy of Canada        |           Albert Einstein
  52. >HARRISP@WL.AECL.CA            |
  53.  
  54.  
  55. I want to thank all of those who kindly responded, and who have opened my
  56. eyes to a whole world of useful information in the NETLIB libraries. Also 
  57. thanks to those who provided several useful suggestions about implicit
  58. methods and the application of Crank-Nicholson. I didn't mention that I 
  59. would provide a summary in my original post, but thought it might be useful
  60. especially to those who are new to using bulletin and anonymous FTP.
  61.  
  62.             SUMMARY
  63.  
  64. Venkatesh Gopinath (Dept of Electrical Engineering,Michigan State University)
  65. has used a set of routines from the NAG library for solving systems of PDE's
  66. and found that they are easy to use and work well. Source code is provided,
  67. but the NAG libraries are not free. I am  looking into their availability
  68. for the PC.
  69.  
  70. Carl Gooch (gooch@leland.stanford.edu) obvious knows his way around 
  71. Crank-Nicholson and implicit codes for PDE's. His advice assured me that 
  72. what I was trying should work, although he included:
  73.  
  74. >I would expect Crank-Nicholson to be fairly easy to implement, even
  75. >with the presence of the non-linear Q*C term, which will end up
  76. >looking something like: Q(z,t)*C(z,t) + 0.5*(Q(z,t)*dC(z,t)/dt * dt +
  77. >dQ(z,t)/dt *C(z,t) * dt) + O(dt**2).  Two problems to keep in mind:
  78. >first, Crank-Nicholson is only neutrally stable; numerical errors do
  79. >not damp out.  The easiest way to fix this is to use a fraction
  80. >slightly greater than 1/2 in expressions like the above.  That makes
  81. >the method slightly more implicit, awhich improves the stability
  82. >characteristics of the method at the price of dropping the time
  83. >accuracy back to first order.
  84.  
  85. He was right in both counts, easy to implement and required lambda 
  86. not equal to 1/2. It seems my problem with my implicit code (which I
  87. tried debugging for two weeks) was a compiler bug and not the code
  88. itself. Might post something about this later, once I've done more 
  89. testing. Don't want to flame the supplier if I'm wrong. The implicit 
  90. code has been tested using time steps two orders magnitude larger than
  91. those used in the explicit code, and executes about 60 times faster. 
  92. There are still some areas in the code which can be optimized, and I may
  93. be able to go to still larger time steps without a significant loss in
  94. accuracy. 
  95.  
  96. Thanks Carl for the advice and assurance that it should work.
  97.  
  98.  
  99.         NETLIB
  100.  
  101. Lot's of good advice re: NETLIB
  102.  
  103. From klassen@sol.UVic.ca I received
  104. copies of a number of other postings related to NETLIB, and a brief USER's
  105. GUIDE to NETLIB. This made it obvious to me that there was a lot of useful
  106. source code sitting out there waiting to be used.
  107.  
  108. The NETLIB routines may be obtained in two ways:
  109.  
  110. >If you have not tried netlib, try sending email to
  111. >        netlib@ornl.gov
  112. >with message
  113. >        send index
  114.  
  115. or:
  116.     FTP to research.att.com
  117.     Password: NETLIB
  118.  
  119. I took the second route and was blown away by the amount of stuff there.
  120.  
  121.  
  122. Stan Gruszka@mindlink.bc.ca pointed out the size of Netlib (actually 
  123. warned) and how to get access to it.
  124.  
  125. C. Wolfe (wolfe@mnbsun.Phy.Queensu.CA) also sent info on getting
  126. access to NETLIB>
  127.  
  128. Both hj427su@unidui.uni-duisburg.de and cox@beta.lanl.gov sent info about
  129. NETLIB, and a particular routing called pdecol.f.
  130.  
  131. >Use the pdecol.f Program. It uses the method of the orthogonale collocation
  132. >. It is very usefull for great time steps. It is in the NETLIB routines.
  133.  
  134. >Algorithm 540 in TOMS is PDECOL, software for evolution of PDE's
  135. >in time.  It works OK (but is not terribly fast).
  136.  
  137. seemingly some disagreement about speed, but both obviously found it
  138. useful. TOMS stands for Transactions of the Mathematical Society (I believe)
  139. and algorithms related to published articles are available on NETLIB
  140.  
  141. > I suggest you try sending e-mail to netlib@ornl.gov with the
  142. >messages (not subject lines):
  143.  
  144. >    send index
  145. >    send index from toms
  146. >    send 540 from toms
  147.  
  148. I have downloaded pdecol from NETLIB, but have not yet had the opportunity
  149. to get it up and running. 
  150.  
  151. Thanks to all for the help re NETLIB. All I can say after seeing what's
  152. there is 
  153.  
  154.     So Many Interesting Things to See and Do,
  155.     Too many deadlines to meet.
  156.  
  157.  
  158.             END of NETLIB Stuff
  159.  
  160.  
  161. ECMTWHK@CCU1.AUKUNI.AC.NZ pointed out that "Numerical Recipes" discussed
  162. finite differcing schemes quite extensively, and provided some advice on
  163. getting routines to solve the resultant equations from the finite 
  164. differencing scheme. Also, mentioned a "set of black - box routines 
  165. called SLDGL" that he has worked with and suggested they might be useful
  166. in solving this system.
  167.  
  168.  
  169. >I've also worked with a set of black - box routines called SLDGL, which
  170. >were developed at the Computer Centre of the University of Karlsruhe,
  171. >Germany; they could do what you want.  To get a line to the people
  172. >there, mail postmaster@rz.uni-karlsruhe.de. They also developed FIDISOL,
  173. >a package optimized for supercomputers.
  174.  
  175. Thanks much for the advice. I had already looked at Numerical Recipes, 
  176. which helped greatly in setting up the equations. Have downloaded MADPACK
  177. from NETLIB, but no time yet to implement. Am going to archie search for
  178. SLDGL.
  179.  
  180. Bauwens@acs.ucalgary.ca expressed the greatest interest in the physics of 
  181. the problem, and what the real world applications are. The problem deals 
  182. with the transport of an adsorbable ( probably not found in any dictionary 
  183. but what the hell) species through a granulated bed with constant carrier 
  184. gas flow rate. The bed contains porous particles, which have a limited 
  185. number of adsorption sites. The first equation describes the rate of change 
  186. of the concentration of the adsorbed species (Q), in which the adsorption 
  187. proces obeys a Langmuir isotherm. The constant with a z dependance is the 
  188. number  of free sites per unit length of bed. In most cases, the z dependance 
  189. is nil. However, I have to consider the case where the front parts of the
  190. bed (small z) have been poisoned by a material which decreases the number
  191. of active sites. The problem has been simplified by ignoring diffusion
  192. effects.
  193.  
  194. For sufficiently long bed lengths, and in the case of a uniform distribution
  195. of the number of active sites (ie no z dependance, no poisoning) the system
  196. of equations will result in constant pattern conditions. This gives rise to
  197. a wave equation for the gas phase concentration (C) and the propagation of
  198. a shock wave solution. 
  199.  
  200. An analytical solution to the system can be obtained under the conditions
  201. that there is no z dependance in the first constant. I have not tried yet 
  202. to reproduce this solution, but it can be found in.
  203.  
  204. Thomas H. C., Ann. N.Y. Acad. Sci., Volume 49, pg 161 (1948)
  205.  
  206.             END of SUMMARY
  207.  
  208. Once again, thanks to all who took the time to respond. This was the first
  209. time I had posted a question on the boards, and I was astounded and delighted
  210. with the response. If I missed giving credit to anyone who responded, my
  211. sincerest apologies.
  212.  
  213. Sorry for the length of this summary. First time I posted, but I had read
  214. that it is good netiquette to provide a summary if the responses were many, 
  215. and may be of general interest.
  216.  
  217. Phil Harris                |  Imagination is more
  218. Whiteshell Laboratories                |  important than knowledge.
  219. Atomic Energy of Canada                |           Albert Einstein
  220. HARRISP@WL.AECL.CA            |
  221.