← Back to team overview

yade-users team mailing list archive

Re: [Question #269831]: HydroForceEngine not defined?

 

Question #269831 on Yade changed:
https://answers.launchpad.net/yade/+question/269831

    Status: Answered => Open

huisky is still having a problem:
well, ok.
i'm trying to simulate a ship colliding with many floating boxes.
Here is a simple codes to start with, maybe you can see something strange?


#####

from yade import pack,geom
import numpy as np

# build the tank walls
L_tank = 40.
W_tank = 10.
H_tank = 5.
D_wat  = 2.
# box data
L_box  = 30.
rau_box= 980.
rau_wat= 1024.
h_box  = 0.20
sub_h  =rau_box/rau_wat*h_box
rMean  = .10   # mean particle radius
porosity = 0.85 # porosity
#Add material
O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=980.))
kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':0}
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}

# form the tank wall with the top open
O.bodies.append(geom.facetBox((L_box-L_tank*.5,0,H_tank*.5-D_wat),(.5*L_tank,.5*W_tank,.5*H_tank),wallMask=31))
# add structure
L_strut = 3.0
W_strut = 1.0
H_strut = 0.5
D_strut = 0.35
oriBody = Quaternion(Vector3(0,0,1),(pi))
strut   = geom.facetBox((-L_strut*.5-rMean,0,H_strut*.5-D_strut),(.5*L_strut,.5*W_strut,.5*H_strut),oriBody,**kwBoxes)
O.bodies.append(strut)
# pack box particles
sp = pack.SpherePack()
sp.makeCloud((0,-W_tank*.5,-sub_h),(L_box,W_tank*.5,h_box),rMean=rMean,porosity=porosity)  # build the box cloud initially and move it to position 
# all sphere ids
spids   = sp.getClumps()[0]
#afterwards
sp.toSimulation()
# define engies
O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],label='collider'),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()],
    ),
    NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(0,0,-9.81)),
    TranslationEngine(translationAxis=[1,0,0],velocity=5.0,ids=[id.id for id in strut]),
    #HydroForceEngine(densFluid=rau_wat,ids=spids,lift=True),
    HydroForceEngine(densFluid = 1024,viscoDyn = 1e-3,zRef = -D_wat,deltaZ = 0.1,nCell = 20,vxFluid=numpy.zeros(20),phiPart = numpy.zeros(20),vFluctX = np.zeros(len(spids)),vFluctZ = np.zeros(len(spids)),ids = spids )
]

O.dt =PWaveTimeStep()
O.run(1,True)

# visulize the  model
try:
    from yade import qt
    qt.Controller()
    qt.View()
except ImportError: pass

####

Regards
Liu

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.