/[ascend]/trunk/models/johnpye/moody.py
ViewVC logotype

Contents of /trunk/models/johnpye/moody.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 912 - (show annotations) (download) (as text)
Fri Oct 27 07:18:21 2006 UTC (18 years, 2 months ago) by johnpye
File MIME type: text/x-python
File size: 1508 byte(s)
Removed BBOXWHINE (replaced with some one-time-only warnings for the moment)
Added ExtMethodDestroyFn to allow 'user_data' associated with external methods to be destroyed.
Implemented the destroy fn through to 'extpy' module.
Added 'name' as an extra parameter in the user_data for extpy, to help with debug msgs.
Moved 'solvernotes' to a file of its own (was part of listnotes.py)
Added 'repaint' to GTK 'tools' menu (for debugging)
Added 'python.h' to top of library, type files (pygtk) to stop silly warnings.
Working on some diagnosing of problems as noted in Simulation::checkInstance.
Removed some old comments from namio.h and others.
Renamed 'blsys' to 'sys' in integrator.c.
Some work on fixing up the J*v function for IDA (not yet complete).
Added new 'destroyfn' parameter (as NULL) to all calls to 'CreateUserFunctionMethod'.
1 import ascpy
2 import extpy
3 browser = extpy.getbrowser()
4
5 from pylab import *
6 from solverreporter import *
7
8 def setsomevalue(self):
9 """ a silly listing testing routine """
10 self = ascpy.Registry().getInstance('context')
11 f = 0.005
12 self.f.setRealValue(f)
13 s = "Set f to %f (confirmed as: %f)" % (f, self.f.getRealValue())
14 print s
15 browser.reporter.reportNote(s)
16
17 def moodyplot(self):
18 """ repeatedly solve the colebrook equation to plot a Moody diagram """
19 self = ascpy.Registry().getInstance('context')
20
21 self.eps.setFixed(False)
22 self.eps_on_D.setFixed(True)
23
24 ioff()
25 figure()
26 hold(True)
27 leg = []
28 Re_vals = array([1000,1500,2000,2100,2300,2400,2500,2600,2700,2900,3000,4000,5000,10000,20000,50000,100000,200000,500000,1e6])
29
30 #browser.reporter.reportNote(str(len(Re_vals)))
31 for eps_on_D in [1e-5,2e-5,5e-5,1e-4,2e-4,5e-4,1e-3,5e-3,0.01,0.02]:
32 self.eps_on_D.setRealValue(eps_on_D)
33 f_vals = zeros(size(Re_vals),'f')
34 for i in range(0,len(Re_vals)):
35 self.Re.setRealValue(Re_vals[i])
36 browser.sim.solve(ascpy.Solver("QRSlv"),SimpleSolverReporter(browser))
37 f_vals[i] = self.f.getRealValue()
38
39 loglog(Re_vals,f_vals)
40 leg += ["e/D = %f" % eps_on_D]
41
42 legend(leg)
43 ion()
44 show()
45
46 def checksomevalue(self):
47 """ a silly listing testing routine """
48 self = ascpy.Registry().getInstance('context')
49 s = "Value of f = %f" % self.f.getRealValue()
50 print s
51 browser.reporter.reportNote(s)
52
53 extpy.registermethod(moodyplot)
54 extpy.registermethod(checksomevalue)
55 extpy.registermethod(setsomevalue)

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22