Пример #1
0
    def testHangingCableANCF(self):
        g = np.array([0., 0., -9.81])
        system = fsi.ProtChSystem()
        system.ChSystem.Set_G_acc(chrono.ChVectorD(g[0], g[1], g[2]))
        system.setTimeStep(1e-1)

        # timestepper = chrono.ChTimestepperEulerImplicitLinearized()
        # system.ChSystem.SetTimestepper(timestepper)
        solver = chrono.ChSolverMINRES()
        system.ChSystem.SetSolver(solver)
        solver.SetMaxIterations(100)
        solver.EnableWarmStart(True)
        solver.EnableDiagonalPreconditioner(True)
        solver.SetVerbose(True)
        system.ChSystem.SetSolverForceTolerance(1e-10)
        system.ChSystem.SetSolverMaxIterations(100)
        mesh = fsi.ProtChMesh(system)
        L = np.array([5.])
        nb_elems = np.array([3])
        d = np.array([1e-3])
        rho = np.array([1000.])
        E = np.array([1e10])
        cable_type = b"CableANCF"
        fairlead_body = fsi.ProtChBody(system)
        fairlead_body.ChBody.SetBodyFixed(True)
        mooring = fsi.ProtChMoorings(system=system,
                                     mesh=mesh,
                                     length=L,
                                     nb_elems=nb_elems,
                                     d=d,
                                     rho=rho,
                                     E=E,
                                     beam_type=cable_type)
        mooring.external_forces_manual = True  # tri: should work without this line
        # vertical cable
        mooring.setNodesPositionFunction(lambda s: np.array([0., 0., s]),
                                         lambda s: np.array([0., 0., 1.]))
        mooring.setNodesPosition()
        mooring.buildNodes()
        mooring.attachBackNodeToBody(fairlead_body)
        system.calculate_init()
        system.calculate(0.5)
        T = mooring.getTensionBack()
        strain = mooring.getNodesTension(eta=1.)[-1] * np.pi * d**2 / 4 * E
        T_sol = -np.ones(3) * g * rho * (np.pi * d**2 / 4. * L)
        npt.assert_almost_equal(-T, T_sol)
Пример #2
0
body2.barycenter0 = np.zeros(3)
# fix anchor in space
body2.ChBody.SetBodyFixed(True)

# MESH

# initialize mesh that will be used for cables
mesh = fsi.ProtChMesh(system)

# FEM CABLES

# moorings line 1
m1 = fsi.ProtChMoorings(system=system,
                        mesh=mesh,
                        length=np.array([L]),
                        nb_elems=np.array([nb_elems]),
                        d=np.array([d]),
                        rho=np.array([dens]),
                        E=np.array([E]))
m1.setName(b'mooring1')
# send position functions from catenary to FEM cable
m1.setNodesPositionFunction(cat1.s2xyz, cat1.ds2xyz)
# sets node positions of the cable
m1.setNodesPosition()
# build cable
m1.buildNodes()
# apply external forces
m1.setApplyDrag(True)
m1.setApplyBuoyancy(True)
m1.setApplyAddedMass(True)
# set fluid density at cable nodes