Example #1
0
def Sjoe(args = None):
	if args != None:
		def rhs(t,y):
			return oderhs(t,y, args)
	else:
		def rhs(t,y):
			return oderhs(t,y)
	rhs.name = 'rhs'
	return rhs

## Initial position/motion of the rolling elements
n = 8
N = 5*n+4
u0 = array(zeros(N))
ind = Index(n)
# This is rand(8)*1e-6:
perturbation = array([  9.78702856e-07,   2.93684668e-07,   4.79000309e-07,
						3.21827339e-07,   8.01445882e-07,   7.26611584e-08,
						8.74822963e-08,   7.41679693e-07])

for i in xrange(0,n):
	u0[ind.r(i)]        = (b0+c0)/2 + perturbation[i] #rand()*1e-6       # r
	u0[ind.theta(i)]    = -pi/2 + 2*pi*i/n# theta
	u0[ind.rdot(i)]     = 0               # rdot
	u0[ind.thetadot(i)] = 0*b0/(b0+c0)#*w0   # thetadot
	u0[ind.phidot(i)]   = 0*b0/2/a0*628.32      # phidot - note that phi is not a state variable since it does not matter here

end_state = array([9.81, 628.32, 1000.])
h = 1. / numpy.max(end_state)
def Sjoe(args = None):
    if args != None:
        def rhs(t,y):
            return oderhs(t,y, args)
    else:
        def rhs(t,y):
            return oderhs(t,y)
    rhs.name = 'rhs'
    return rhs
#Sjoe.name = 'Sjoe'

## Initial position/motion of the rolling elements
n = 8
N = 5*n+4
u0 = array(zeros(N))
ind = Index(n)

for i in xrange(0,n):
    u0[ind.r(i)]        = (b0+c0)/2       # r
    u0[ind.theta(i)]    = -pi/2 + 2*pi*i/n# theta
    u0[ind.rdot(i)]     = 0               # rdot
    u0[ind.thetadot(i)] = b0/(b0+c0)*w0   # thetadot
    u0[ind.phidot(i)]   = b0/2/a0*w0      # phidot - note that phi is not a state variable since it does not matter here

rhs = Sjoe()

cv=IVP.CVode(rhs,u0)
cv.set_method('BDF','Newton')
atol = array(zeros(N))
for i in range(0,N):
    atol[i] = 1e-8
Example #3
0
def oderhs(t,z, args = (9.81, 628.32, 1000.)):
	g,w0,F_a = args
	n = int((len(z)-4)/5)
	dz = array(zeros(len(z)))
	ind = Index(n)
	ring_state = r_[z[ind.x():ind.y()+1], z[ind.xdot():ind.ydot()+1]]
	F_x = 0
	F_y = F_a

	for j in xrange(0,n):
		rhs, F_xj, F_yj = rhs_ball(r_[z[ind.r(j):ind.theta(j)+1], z[ind.rdot(j):ind.phidot(j)+1]], ring_state, args = (g,w0))
		F_x += F_xj
		F_y += F_yj
		dz[ind.r(j)] = z[ind.rdot(j)]
		dz[ind.theta(j)] = z[ind.thetadot(j)]
		dz[ind.rdot(j):ind.phidot(j)+1] = rhs

	dz[ind.x():ind.y()+1] = z[ind.xdot():ind.ydot()+1]
	dz[ind.xdot()] = F_x/m0
	dz[ind.ydot()] = F_y/m0
	return dz
Example #4
0
from Sjoe_m_func2 import *
from Sjoe_index import Index
from numpy import *
import IVP
import lsodar

def Sjoe(t,y):
	return oderhs(y,t)
Sjoe.name = 'Sjoe'

## Initial position/motion of the rolling elements
n = 8
N = 5*n+4
u0 = array(zeros(N))
ind = Index(n)

for i in xrange(0,n):
	u0[ind.r(i)] 		= (b0+c0)/2       # r
	u0[ind.theta(i)] 	= -pi/2 + 2*pi*i/n# theta
	#u0[ind.theta(i)] 	= -pi/2
	u0[ind.rdot(i)] 	= 0               # rdot
	u0[ind.thetadot(i)] = b0/(b0+c0)*w0   # thetadot
	u0[ind.phidot(i)] 	= b0/2/a0*w0      # phidot - note that phi is not a state variable since it does not matter here


u0 = array([ -1.76242809e-06,   2.76352696e-05,   2.49863406e-02,
		3.60926024e+01,   2.49894620e-02,   3.68814017e+01,
		2.49990368e-02,   3.76634995e+01,   2.50188206e-02,
		3.84516617e+01,   2.50287876e-02,   3.92372570e+01,
		2.50226201e-02,   4.00211008e+01,   2.50039592e-02,
		4.08050833e+01,   2.49913725e-02,   4.15901103e+01,