def test_model(self): np.testing.assert_array_less( SurfaceGuidedMassSystem( surface=EllipticParaboloid(1.0, 2.0), s0=nprand((4,)), solid=1.0, forces=[ Gravity(1.0, [0, 0, -10.0]), SpringForce(1.0, [0.0, 0.0, 0.0]), ViscousFriction(2.0), ], ).solve(time=np.linspace(0, 20, 1000))[-1,:], 1e-5*np.ones((4,)) )
from gsurface.surface import Tore from gsurface.serialize import save_attached from gsurface.tools import nprand SIZE = 5 surface = Tore(0.5, 1.0) mesh = surface.build_surface(*surface.mesh(50, 50)) snake = BowStructure(SIZE, 1.0, stiffness=1000.0, mu=10.0, l0=1.0) snake.interactions[(0, SIZE - 1)].stiffness = 100.0 sim = SurfaceGuidedStructureSystem(surface, snake, s0=nprand(4*SIZE), structureForces=[ ViscousFriction(0.01) ]) sim.s0[1::4] = 1.0 time = np.linspace(0, 40, 1000) data = sim.solve(time) solutions = sim.solutions(data, time) model_parsed = save_attached(sim, __file__) mayavi_plot_surfaces([ SurfacePlot(
def w() -> np.ndarray: return nprand((2, ))
def V() -> np.ndarray: return nprand((3, ))
def s0() -> np.ndarray: return nprand((4, ))
def J() -> np.ndarray: return nprand((3, 2))
def H() -> np.ndarray: return nprand((2, 2, 2))