← Back to team overview

yade-users team mailing list archive

[Question #701253]: The error of generating particles and importing .mesh file

 

New question #701253 on Yade:
https://answers.launchpad.net/yade/+question/701253

Hi all,

I'm simulating the collision of a rigid body (.mesh file and FrictMat) with a brittle material (sphere and CohFrictMa).

Below is my script :
from yade  import pack
from numpy import genfromtxt 
from yade  import utils
from yade  import export
from yade  import ymport
from yade  import wrapper
import csv              
import numpy as np 
import gts, os.path, locale

global h
global waterlevel
waterlevel=0
rho_water=1000
rho_ice=880
gravity=9.85
#matice
matice = O.materials.append(CohFrictMat(isCohesive=True, frictionAngle=radians(42), density=rho_ice, poisson=0.42, young=4.2e9, alphaKr=0.242, alphaKtw=0.1642, normalCohesion=4.2e7, shearCohesion=8.4e7))
Matice=O.materials[matice]

#matsteel
matsteel=O.materials.append(FrictMat(young=1e10,poisson=0.22,density=7580,frictionAngle=radians(30)))
Matsteel=O.materials[matsteel]

#sphere
coordinates=numpy.genfromtxt("zuobiao.csv",delimiter=",")
pack_ice=[sphere((x,y,z),radius=0.02,material=Matice,color=(69./255.,137./255.,148./255.)) for x,y,z in coordinates]
PACK_ICE=O.bodies.append(pack_ice)  

#ship
ship=ymport.gmsh('xuelong.mesh',color=(0.42,0.42,0.42))
SHIP=O.bodies.append(ship)

#add ebgines
O.engines=[
      ForceResetter(),
      InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.1), Bo1_Facet_Aabb()]),
      InteractionLoop(
              [Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=1.1), Ig2_Facet_Sphere_ScGeom()],
              [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True), Ip2_FrictMat_FrictMat_FrictPhys()],
              [Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),Law2_ScGeom_FrictPhys_CundallStrack()]
      ),
      DragEngine(Cd=0.47,Rho=rho_water,ids=PACK_ICE),
      NewtonIntegrator(gravity=(0, 0, -gravity), damping=0.5),
      TranslationEngine(translationAxis=[0,1,1],velocity=2, ids=SHIP,label='line_velocity')
      #RotationEngine(rotationAxis=[0,0,1],angularVelocity=10,ids=Box1,label='angular_velocity')
]

#buoyancy force
def applyBuoyancy():
               
         for b in pack_ice: 
               h=b.state.pos[2]
               rad=0.05
               if h >= rad:
                      F_buo=0
                      O.forces.setPermF(b.id,(0,0,F_buo))
               elif h >= 0 and h < rad:
                      F_buo=(pi/3.)*h*h*(3.*rad-h)*rho_water*gravity
                      O.forces.setPermF(b.id,(0,0,F_buo))
               elif h >=-rad and h<0:
                      F_buo=((4./3.)*pi*rad*rad*rad-(pi/3.)*(rad+h)*(rad+h)*(3*rad-(rad+h)))*rho_water*gravity
                      O.forces.setPermF(b.id,(0,0,F_buo))
               else:  
                      F_buo=(4./3.)*pi*rad*rad*rad*rho_water*gravity
                      O.forces.setPermF(b.id,(0,0,F_buo))
                      
O.engines=O.engines+[PyRunner(iterPeriod=100,command='applyBuoyancy()',label='buolabel')]

O.dt = .5e-2 * PWaveTimeStep()
O.run(10000,True)
O.saveTmp()
##########################
.mesh file :
 MeshVersionFormatted 2
 Dimension
 3
 Vertices
 6472
     -1972.5348641465           2217.7544425058          -126.36521179963      1
     -1817.6871954756           2218.3440546922          -126.36521179963      2
     -1726.3235370492           2221.3487259367          -126.36521179963      3
     -1662.9266797428           2224.9927763124          -126.36521179963      4
     -1485.0446499397           2242.6015236394          -126.36521179963      5
     -1353.5544706967           2263.8767324632          -126.36521179963      6
     -1276.6144899829           2279.9050322631          -126.36521179963      7
     -1200.1244294567            2297.741214602          -126.36521179963      8
      -1123.806072471           2316.3916800594          -126.36521179963      9
......
#############.csv file
0,0,0
0,0.1,0
0,0.2,0
0,0.3,0
0,0.4,0
0,0.5,0
0,0.6,0
0,0.7,0
0,0.8,0
0,0.9,0
0,1,0
......
####################Question
Case one : when I run this script, the .mesh file is imported successfully, but the particles are not generated, and no error message.
Case two : if I remove the .mesh related commands, the particles can be generated.
Please let me know if full file is required or if you find other errors in the script.
Thanks in advance for your help

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.