← Back to team overview

yade-users team mailing list archive

[Question #698754]: Making video of pfacet clump: clump falling apart

 

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

Hello all,

I am trying to make a video of a rotating pfacet clump. However, when the pfacet clump starts rotating it seems to be falling apart in the 3D view. According to Bruno Chareyre [1] #17 :

"Note: there is a display problem which makes it look as if the clumped objects were splitting appart. It goes back to normal when you pause the simulation. Nothing to worry about. (reason is: the cylinders are not dynamic objects and there orientation is not used anywhere in the code, so it is not updated at runtime - only when 3D view is refreshed orientation is recomputed for display)." 

So all I have to do is pause the simulation. But I want to use the snapshot engine to make a video. If I pause it then the simulation no longer executes. So is there a way I can make a video in which the pfacet does not fall apart.

Kind regards,
Rohit K. John
[1] https://answers.launchpad.net/yade/+question/695558

# ------------------------------------------------------------------------------------------------------------------------------------------------- cube.gts
14 36 24 GtsSurface GtsFace GtsEdge GtsVertex
0.5 0.5 0.5
0.5 0.5 -0.5
0.5 -0.5 0.5
0.5 -0.5 -0.5
-0.5 0.5 0.5
-0.5 0.5 -0.5
-0.5 -0.5 0.5
-0.5 -0.5 -0.5
0.5 0.0 0.0
0.0 -0.5 0.0
0.0 0.0 0.5
-0.5 0.0 0.0
0.0 0.5 0.0
0.0 0.0 -0.5
6 8
2 6
1 2
8 7
3 4
5 6
3 7
1 3
8 4
7 5
5 1
4 2
9 3
2 9
4 9
1 9
10 7
4 10
8 10
3 10
11 3
5 11
7 11
1 11
12 6
7 12
8 12
5 12
13 2
5 13
6 13
1 13
14 8
2 14
6 14
4 14
7 21 23
7 17 20
6 25 28
9 33 36
8 13 16
3 29 32
12 14 15
5 15 13
3 16 14
9 18 19
4 19 17
5 20 18
11 22 24
10 23 22
8 24 21
4 26 27
1 27 25
10 28 26
6 30 31
2 31 29
11 32 30
2 34 35
1 35 33
12 36 34

# ------------------------------------------------------------------------------------------------------------------------------------------------- main.py
#------------------------------------------------------------------------------------------- YADE Script
from yade.gridpfacet import *
from yade import geom, utils, qt
from yade import plot
import sys, os
sys.path.append(".")

# ---------------------------------------------------------------------------- input parameter
# ----------------------------------------------------- target
target_young = 50e9
target_density = 1000
target_poisson = 0.3
target_friction = radians(30)

p_radius = 5e-2

# ---------------------------------------------------------------------------------------------------------- Materials
target_int_mat = 'pfacet_int_mat'
target_ext_mat = 'pfacet_ext_mat'

O.materials.append(
    FrictMat(
        young = target_young,
        poisson = target_poisson,
        density = target_density,
        label = target_ext_mat,
        frictionAngle = target_friction,
    )
)

O.materials.append(
    CohFrictMat(
        young = target_young,
        poisson = target_poisson,
        density = target_density,
        label = target_int_mat,

        frictionAngle = target_friction,
        normalCohesion = 3e100,
        shearCohesion = 3e100,
        momentRotationLaw = True,
    )
)
# ---------------------------------------------------------------------------------------------------------- Engines
O.engines = [
                ForceResetter(),

                InsertionSortCollider([
                    Bo1_GridConnection_Aabb(),
                    Bo1_PFacet_Aabb(),
                    Bo1_Sphere_Aabb(),
                ]),

                InteractionLoop(
                    [
                        Ig2_PFacet_PFacet_ScGeom(),
                        Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
                        Ig2_GridNode_GridNode_GridNodeGeom6D(),
                        Ig2_GridConnection_PFacet_ScGeom(),
                        Ig2_Sphere_PFacet_ScGridCoGeom(),
                    ],
                    [
                        Ip2_FrictMat_FrictMat_FrictPhys(),
                        Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(
                            setCohesionNow = True,
                            setCohesionOnNewContacts = False
                            ),
                    ],
                    [
                        Law2_GridCoGridCoGeom_FrictPhys_CundallStrack(),
                        Law2_ScGeom_FrictPhys_CundallStrack(),
                        Law2_ScGridCoGeom_FrictPhys_CundallStrack(),
                        Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),
                    ],
                )
            ]
# ---------------------------------------------------------------------------------------------------------- objects
# ---------------------------------------------------------------------- target
(
pnode,
pcyl,
pfacet
) = gtsPFacet(
    'cube.gts',
    radius = p_radius,
    shift = (0,0,0),
    scale = 1,
    wire = False,
    fixed = False,
    color = [0.1,0.5,0.1],
    materialNodes = 'pfacet_int_mat',
    material = 'pfacet_ext_mat',
)

target_ids = pnode + pcyl + pfacet
for i in pcyl:
    O.bodies[i].state.mass = 0

target_clump_ID = O.bodies.clump(target_ids)
O.bodies[target_clump_ID].state.inertia = Vector3([0.01,0.01,0.01])
O.bodies[target_clump_ID].state.mass = 1
print(target_clump_ID)

# ---------------------------------------------------------------------- spheres
sp1 = sphere([ 0.7, 0.25, 0], 5e-2, material = target_ext_mat)
sp2 = sphere([-0.7, -0.25, 0], 5e-2, material = target_ext_mat)

sp1_ID = O.bodies.append(sp1)
sp2_ID = O.bodies.append(sp2)

O.bodies[sp1_ID].state.vel = [-1,0,0]
O.bodies[sp2_ID].state.vel = [ 1,0,0]
# ----------------------------------------------------------------------------- Additional engines
ids = target_clump_ID
O.engines += [
    NewtonIntegrator(gravity = [0,0,0], damping = 0),
    qt.SnapshotEngine(fileBase='3d-', iterPeriod=20000, label='snapshot'),
    PyRunner(command='finish()', iterPeriod=12000000)
]

qt.View()


# this function is called when the simulation is finished
def finish():
	# snapshot is label of qt.SnapshotEngine
	# the 'snapshots' attribute contains list of all saved files
	makeVideo(snapshot.snapshots, '3d.mpeg', fps=10, bps=10000)
	O.pause()

# ----------------------------------------------------------------------------- Sim controller
O.dt = 2e-7#utils.PWaveTimeStep()
O.saveTmp()
 



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