create clump using gts

Asked by Ruidong LI

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 <email address hidden>

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

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Ruidong LI
Solved:
Last query:
Last reply:
Revision history for this message
Ruidong LI (kyle2000) said :
#2

Is it an advertisement?

Revision history for this message
Ruidong LI (kyle2000) said :
#3

This problem was solved by inverting face orientations.

Revision history for this message
Jan Stránský (honzik) said :
#4

> Is it an advertisement?

yes, it is a spam, often nowadays among answers on Yade problems.. I sill hide it
Cheers
Jan