def testHangingCableANCF(self): g = np.array([0., 0., -9.81]) system = crb.ProtChSystem(gravity=g) system.setTimeStep(1e-1) mesh = crb.Mesh(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 = "CableANCF" mooring = crb.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 fairlead_body = crb.ProtChBody(system) fairlead_body.ChBody.SetBodyFixed(True) 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)
tank.BC['x-'].setNoSlip() tank.BC['y-'].setNoSlip() tank.BC['y+'].setNoSlip() tank.BC['z-'].setNoSlip() tank.BC['z+'].setAtmosphere() rect.BC['x+'].setNoSlip() rect.BC['x-'].setNoSlip() rect.BC['y+'].setNoSlip() rect.BC['y-'].setNoSlip() rect.BC['z+'].setNoSlip() rect.BC['z-'].setNoSlip() # CHRONO system = crb.ProtChSystem(gravity=np.array([0., 0., -9.81])) body = crb.ProtChBody(system=system) body.attachShape(rect) body.ChBody.SetMass(500.) body.ChBody.SetBodyFixed(True) # fixing body # OTHER PARAMS st.assembleDomain(domain) max_flag = max(domain.vertexFlags + domain.segmentFlags + domain.facetFlags) flags_rigidbody = np.zeros(max_flag + 1, dtype='int32') for key in rect.boundaryTags_global: flags_rigidbody[rect.boundaryTags_global[key]] = 1 from proteus.ctransportCoefficients import smoothedHeaviside from proteus.ctransportCoefficients import smoothedHeaviside_integral
facet += [i] caisson.facets = np.array([[facet]]) caisson.facetFlags = np.array([1]) caisson.regionFlags = np.array([1]) else: caisson = st.Rectangle(domain, dim=opts.caisson_dim) caisson.translate([caisson_coords[0], caisson_coords[1]]) ang = rotation_angle caisson.setHoles([[0., 0.]]) caisson.holes_ind = np.array([0]) # system = crb.System(np.array([0., -9.81, 0.])) # rotation = np.array([1, 0., 0., 0.]) rotation_init = np.array([np.cos(ang / 2.), 0., 0., np.sin(ang / 2.) * 1.]) caisson.rotate(ang, pivot=caisson.barycenter) system = crb.ProtChSystem(np.array([0., -9.81, 0.])) system.setTimeStep(opts.chrono_dt) body = crb.ProtChBody(shape=caisson, system=system) from proteus.mbd import pyChronoCore as pych x, y, z = caisson.barycenter pos = pych.ChVector(x, y, z) e0, e1, e2, e3 = rotation_init rot = pych.ChQuaternion(e0, e1, e2, e3) inertia = pych.ChVector(1., 1., inertia) # chrono functions body.ChBody.SetPos(pos) body.ChBody.SetRot(rot) body.ChBody.SetMass(opts.caisson_mass) body.ChBody.SetInertiaXX(inertia) # customised functions body.setConstraints(free_x=np.array(opts.free_x),
facet += [i] caisson.facets = np.array([[facet]]) caisson.facetFlags = np.array([1]) caisson.regionFlags = np.array([1]) else: caisson = st.Rectangle(domain, dim=opts.caisson_dim) caisson.translate([caisson_coords[0], caisson_coords[1]]) ang = rotation_angle caisson.setHoles([[0., 0.]]) caisson.holes_ind = np.array([0]) # system = crb.System(np.array([0., -9.81, 0.])) # rotation = np.array([1, 0., 0., 0.]) rotation_init = np.array([np.cos(ang/2.), 0., 0., np.sin(ang/2.)*1.]) caisson.rotate(ang, pivot=caisson.barycenter) system = crb.ProtChSystem(np.array([0., -9.81, 0.])) system.setTimeStep(opts.chrono_dt) #body = crb.ProtChBody(shape=caisson, body = crb.ProtChBody(system=system) body.attachShape(caisson) from proteus.mbd import pyChronoCore as pych x, y, z = caisson.barycenter pos = pych.ChVector(x, y, z) e0, e1, e2, e3 = rotation_init rot = pych.ChQuaternion(e0, e1, e2, e3) inertia = pych.ChVector(1., 1., inertia) # chrono functions body.ChBody.SetPos(pos) body.ChBody.SetRot(rot) body.ChBody.SetMass(opts.caisson_mass)
# BOUNDARY CONDITIONS tank.BC['x+'].setNoSlip() tank.BC['x-'].setNoSlip() tank.BC['y-'].setNoSlip() tank.BC['y+'].setAtmosphere() rect.BC['x+'].setNoSlip() rect.BC['x-'].setNoSlip() rect.BC['y+'].setNoSlip() rect.BC['y-'].setNoSlip() # CHRONO system = crb.ProtChSystem(gravity=np.array([0., -9.81, 0.])) body = crb.ProtChBody(system=system, shape=rect) body.ChBody.SetMass(500.) body.ChBody.SetBodyFixed(True) # fixing body # OTHER PARAMS st.assembleDomain(domain) max_flag = max(domain.vertexFlags + domain.segmentFlags + domain.facetFlags) flags_rigidbody = np.zeros(max_flag + 1, dtype='int32') for key in rect.boundaryTags_global: flags_rigidbody[rect.boundaryTags_global[key]] = 1 from proteus.ctransportCoefficients import smoothedHeaviside from proteus.ctransportCoefficients import smoothedHeaviside_integral from proteus.default_n import *