def __init__(self, Nb_x=0, s=0, p1=[.25, 25, .5], p2=[.75, .25, .5], p3=[.75, .75, .5], center=None, size=None, h=None): """Nb_x gives the number of fiber points along one side of the plate. s is an elasticity constant. p1, p2, p3 are sequential corners of the square. Alternatively, center specifies the center of the plate and size[0] and size[1] specify the widths in the x and y directions. h is a height function used to the perturb the height of the plate.""" Tethered.__init__(self, (Nb_x + 1)**2, Dim=3, s=s) if center != None: p1 = center + array([-size[0], -size[1], 0]) / 2 p2 = center + array([size[0], -size[1], 0]) / 2 p3 = center + array([size[0], size[1], 0]) / 2 self.MakeSquare(Nb_x + 1, p1, p2, p3, h)
def __init__(self, Nb_x, s, Scale=1., Chi=.1, alpha=pi / 2, Period=1., Orientation=PumpOrientation.Horizontal, Style=PumpingStyle.LeftToRight): """Set aside the needed memory to handle the ellipse. Nb_x is the number of fiber points along a 1D strand in the x direction (Nb = 2 * Nb_x). s is a stiffness constant. Chi is the channel occlusion ratio. 1 is fully occluded, 0 is fully open. Scale is the length of the pump from end to end (the length of one wavelength)""" self.Scale = Scale self.Chi = float(Chi) self.alpha = alpha self.Period = float(Period) self.Nb_x = Nb_x self.Orientation = Orientation self.Style = Style # Calculate the point separation distance self.hb_x = 1. / self.Nb_x Tethered.__init__(self, 2 * self.Nb_x, Dim=2, s=s) self.SetTime(0, self.X)
def __init__(self, Nb_x, s, Scale = 1., Chi = .1, alpha = pi / 2, Period = 1., Orientation = PumpOrientation.Horizontal, Style = PumpingStyle.LeftToRight): """Set aside the needed memory to handle the ellipse. Nb_x is the number of fiber points along a 1D strand in the x direction (Nb = 2 * Nb_x). s is a stiffness constant. Chi is the channel occlusion ratio. 1 is fully occluded, 0 is fully open. Scale is the length of the pump from end to end (the length of one wavelength)""" self.Scale = Scale self.Chi = float(Chi) self.alpha = alpha self.Period = float(Period) self.Nb_x = Nb_x self.Orientation = Orientation self.Style = Style # Calculate the point separation distance self.hb_x = 1. / self.Nb_x Tethered.__init__(self, 2 * self.Nb_x, Dim = 2, s = s) self.SetTime(0, self.X)
def SetTime(self, t, X=None): """Update the configuration of the pump to time t.""" self.LastSetTime = t Tethered.SetTime(self, t) if X == None: X = self.Tether X[...] = self.PeristalticPos(self._x, self._theta, t)
def __init__(self, Nb_x=0, s=0, p1=[.25,25,.5], p2=[.75,.25,.5], p3=[.75,.75,.5], center=None, size=None, h=None): """Nb_x gives the number of fiber points along one side of the plate. s is an elasticity constant. p1, p2, p3 are sequential corners of the square. Alternatively, center specifies the center of the plate and size[0] and size[1] specify the widths in the x and y directions. h is a height function used to the perturb the height of the plate.""" Tethered.__init__(self, (Nb_x + 1)**2, Dim = 3, s = s) if center != None: p1 = center + array([-size[0], -size[1], 0]) / 2 p2 = center + array([size[0], -size[1], 0]) / 2 p3 = center + array([size[0], size[1], 0]) / 2 self.MakeSquare(Nb_x + 1, p1, p2, p3, h)
def __init__(self, Nb_x, s, Scale = 1., Chi = .1, alpha = pi / 2, Period = 1., Orientation = PumpOrientation.Horizontal, Style = PumpingStyle.LeftToRight): """Set aside the needed memory to handle the ellipse. Nb_x is the number of fiber points along a 1D strand in the x direction (Nb = 2 * Nb_x). s is a stiffness constant. Chi is the channel occlusion ratio. 1 is fully occluded, 0 is fully open. Scale is the length of the pump from end to end (the length of one wavelength)""" self.Scale = Scale self.Chi = float(Chi) self.alpha = float(alpha) self.Period = float(Period) self.Nb_x = Nb_x self.Orientation = Orientation self.Style = Style # Calculate the number of fiber points along a circumference of the perilstaltic pump self.Nb_C = int(pi * Nb_x) # Calculate the point separation distance self.hb_x, self.hb_C = 1. / self.Nb_x, 2 * pi / self.Nb_C Nb = self.Nb_x * self.Nb_C Tethered.__init__(self, Nb, Dim = 3, s = s) # Initialize x and theta coordinate grids self._x, self._theta = zeros(Nb, float64), zeros(Nb, float64) for i in range(self.Nb_x): x = (i + .5) * self.hb_x for j in range(self.Nb_C): theta = j * self.hb_C self._x[i * self.Nb_C + j] = x self._theta[i * self.Nb_C + j] = theta self.SetTime(0, self.X)
def __init__(self, Nb_x=0, s=0, center=[.5, .5, .5], r=.2): """Nb_x is the number of fiber points along the edge of one triangle of the generating icosohedron. s is an elasticity constant.""" center = EnsureNumpyArray(center) # Make the sphere Points, Triangles, Edges = self.MakeSphere(Nb_x, center, r) # Make the fiber Tethered.__init__(self, Nb=Points.shape[0], Dim=3, s=s) self.X = Points self.Tether = self.X.copy() self.s = s # Save the corresponding unit sphere self.UnitSphere = (self.X - center) / r
def __init__(self, Nb_x=0, s=0, center=[.5,.5,.5], r=.2): """Nb_x is the number of fiber points along the edge of one triangle of the generating icosohedron. s is an elasticity constant.""" center = EnsureNumpyArray(center) # Make the sphere Points, Triangles, Edges = self.MakeSphere(Nb_x, center, r) # Make the fiber Tethered.__init__(self, Nb = Points.shape[0], Dim = 3, s = s) self.X = Points self.Tether = self.X.copy() self.s = s # Save the corresponding unit sphere self.UnitSphere = (self.X - center) / r
def SetTime(self, t, X=None): """Update the configuration of the pump to time t.""" self.LastSetTime = t Tethered.SetTime(self, t) if X == None: X = self.Tether for i in range(self.Nb_x): x = self.Scale * (i + .5) * self.hb_x X[i] = self.PeristalticPos(x, t, Top=True) X[i + self.Nb_x] = self.PeristalticPos(x, t, Top=False)