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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 890 - (show annotations) (download) (as text)
Thu Oct 12 14:06:37 2006 UTC (14 years, 1 month ago) by johnpye
File MIME type: text/x-python
File size: 979 byte(s)
Eliminated T1, T2 from dsg.a4c.
Added moody diagram example model (with python script)
Removed some debug output from solverreporter.py and simulation.cpp
1 import ascpy
2 import extpy
3 browser = extpy.getbrowser()
4
5 from pylab import *
6 from solverreporter import *
7
8 def moodyplot(self):
9 """ repeatedly solve the colebrook equation to plot a Moody diagram """
10 self = ascpy.Registry().getInstance('context')
11
12 self.eps.setFixed(False)
13 self.eps_on_D.setFixed(True)
14
15 ioff()
16 figure()
17 hold(True)
18 leg = []
19 Re_vals = array([500,1000,2000,2100,2300,2400,2500,2600,2700,2900,3000,4000,5000,10000,20000,50000,100000,200000,500000,1e6])
20
21 browser.reporter.reportNote(str(len(Re_vals)))
22 for eps_on_D in [1e-5, 1e-5,2e-5,5e-5,1e-4,2e-4,5e-4,1e-3,5e-3,0.01,0.02]:
23 self.eps_on_D.setRealValue(eps_on_D)
24 f_vals = zeros(size(Re_vals),'f')
25 for i in range(0,len(Re_vals)):
26 self.Re.setRealValue(Re_vals[i])
27 browser.sim.solve(ascpy.Solver("QRSlv"),SimpleSolverReporter(browser))
28 f_vals[i] = self.f.getRealValue()
29
30 loglog(Re_vals,f_vals)
31 leg += ["e/D = %f" % eps_on_D]
32
33 legend(leg)
34 ion()
35 show()
36
37 extpy.registermethod(moodyplot)
38

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