def main(): #x = np.ndarray([5,1]) #y = np.ndarray([5,1]) #for a, b in zip(x,y): # a = 12.0 # b = 22.0 x = np.zeros([500, 1], dtype=float) y = np.zeros([500, 1], dtype=float) x = np.asarray([12.0 for xi in x]) y = np.asarray([22.0 for yi in y]) #x = np.array([12.0,12.0,12.0,12.0,12.0]) #y = np.array([22.0,22.0,22.0,22.0,22.0]) flow = flowField.flowField('simple') vx, vy = flow.getVectorSoA(x, y) #print vy, vx #this is correct vx = np.asarray(vx) vy = np.asarray(vy) ##print vx[-1] #print vy[-1] for i in xrange(150): print i x, y = dog.kinzelbach1990SoA(x, y, vx, vy) #print "in main" #print x[0] #print y[-1] plt.scatter(x, y) plt.axis([0, 20, 0, 30]) show()
def __init__(self, parameters, fileName, gen=True): self.plumeEtAl = plumeEtAl(parameters, gen, fileName) self.param = parameters self.flow = flowField.flowField(self.param.flow) self.plumeEtAl.flow = self.flow self.puffSoA = puffSoA() self.puffQueue = 0
def main(): x = [12, 12, 12, 12, 12] y = [22, 22, 22, 22, 22] flow = flowField.flowField('simple') for i in xrange(5000): x, y = kinzelbach1990SoA(flow, x, y) print x print y
def plotFlows(): print "Here i am going to plot both of the fluid flows side by side, or just 1 at a time is fine. " flowS = flowField.flowField('simple') flowM = flowField.flowField('mit') gap = 10 plt.subplot(1, 2, 1) #plt.axes('equal') plt.quiver( flowS.x[::gap,::gap], flowS.y[::gap,::gap], \ flowS.vy[::gap, ::gap], flowS.vx[::gap, ::gap], color = 'g', units='x',pivot=( 'tail' ), linewidths=(1,), edgecolors=('g'), headaxislength=10 ) plt.subplot(1, 2, 2) plt.quiver( flowM.x[::gap,::gap], flowM.y[::gap,::gap], \ flowM.vy[::gap,::gap], flowM.vx[::gap,::gap], color = 'b', units='x',pivot=( 'tail' ), linewidths=(1,), edgecolors=('b'), headaxislength=20) show()
reload(auxiliary) import flowField reload(flowField) np.random.seed(1) param = auxiliary.Parameters() plum = plumeClass.plume(param) plum.puffSoA.addPuffs(plum.param.yi, plum.param.xi, 1) plum.kinzelbach1990SoA() x = np.array([12.0]) y = np.array([26.0]) flow = flowField.flowField('simple') x, y = step.kinzelbach1990SoA(flow, y, x) print "New kinzelbach" print x, y print "old kinzelbach" print plum.puffSoA.xs print plum.puffSoA.ys
""" #print sys.argv[1] #fileName = sys.argv[1] fileName = 'models/nagheeby/sparse_5000' #'icra2015sim/love_5000' print "load plume data from file %s" % fileName """ """ """ Some constants that we use throughout """ """ """ plum = plumeClass.plumeEtAl(None, True, fileName) sc = None dummyMsg = positionSim_t() flow = flowField.flowField(plum.param.flow) fileNumber = 1 print "r = %s" % r r = 1.0 n1 = (-37.3 * r + 20.54) / r #or n2 = (-.3364 * r + 1.1182) / (r * r) print "norm of %s or %s" % (n1, n2) n = 1.0 norm = (n / plum.param.den)