← Back to team overview

yade-users team mailing list archive

[Question #706246]: create clump using gts

 

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

Hi! I try to mimic the example named 'gts-horse.py' with my own .gts file. But the spheres seem to be not generated with the facets but outside. My code is presented as follows:

# -*- encoding=utf-8 -*-
# © 2009 Václav Šmilauer <eudoxos@xxxxxxxx>

from __future__ import print_function
from yade import pack
import gts, os.path, locale

locale.setlocale(
        locale.LC_ALL, 'en_US.UTF-8'
)  #gts is locale-dependend.  If, for example, german locale is used, gts.read()-function does not import floats normally
'''
if you get "Error: unsupported locale setting"
-> type as root: "dpkg-reconfigure locales"
-> choose "en_US.UTF-8" (press space to choose)
'''

# coarsen the original horse if we have it
# do nothing if we have the coarsened horse already

surf = gts.read(open('26.gts'))

if surf.is_closed():
	pred = pack.inGtsSurface(surf)
	aabb = pred.aabb()
	dim0 = aabb[1][0] - aabb[0][0]
	radius = dim0 / 40.  # get some characteristic dimension, use it for radius
	O.bodies.append(pack.regularHexa(pred, radius=radius, gap=radius / 4.))
O.bodies.append(pack.gtsSurface2Facets(surf, wire=True))

O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()], label='collider'),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()],
        ),
        NewtonIntegrator(damping=.1, gravity=[0, 0, -5000]),
        PyRunner(iterPeriod=1000, command='timing.stats(); O.pause();'),
        PyRunner(iterPeriod=10, command='addPlotData()')
]
O.dt = .7 * PWaveTimeStep()
O.saveTmp()
O.timingEnabled = True
O.trackEnergy = True
from yade import plot
plot.plots = {
        'i': (
                'total',
                O.energy.keys,
        )
}


def addPlotData():
	plot.addData(i=O.iter, total=O.energy.total(), **O.energy)


plot.plot(subPlots=False)

from yade import timing
from yade import qt
qt.View()


The download link for the '.gts' file is shown below:
https://drive.google.com/file/d/1_vEFdUc64rDjoPJ8utrenGtqS-chAjlR/view?usp=sharing


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