← Back to team overview

yade-users team mailing list archive

[Question #707866]: Export velocity and force

 

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

Hi! 
I want to export the force and the velocity in 02-gravity-deposition.py[1] to ParaView through vtkExporter. In vtkExporter, the parameter of ‘what (dictionary)’ can export scalar, vector, and tensor variables. I read some of the earlier responses[2-4] and Yade Documentation. I have written a vtkExport function according to [5], but I still have several problems:
1. The variables of what(dictionary) content coordnumber, forceLen, forceVec, stressLen, stressVec, torqueLen, torqueVec[3]. I want to know the meaning of coordnumber, ‘Vec’, and ‘Len’. In addition, I would like to know which variables can be referenced in what (dictionary) and how to describe them correctly.
2. The different supported export types like exportContactPoints, exportSpheres, and exportInteractions.etc. I want to export the force of spheres and facets, and these force parameters need to be entered into those export types.

Here is the MWE:

from yade import pack, plot, export
O.bodies.append(geom.facetBox((.5, .5, .5),(.5, .5, .5),wallMask=31))
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0),(1, 1, 1),rMean= .02,rRelFuzz= .5)
sp.toSimulation()
O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        NewtonIntegrator(gravity=(0, 0, -9.81),damping=0.4),
        PyRunner(command='vtkExport()',  iterPeriod=100),
        PyRunner(command='checkUnbalanced()', realPeriod=2),
        PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt= .5* PWaveTimeStep()
O.trackEnergy = True
vtkExporter= export.VTKExporter('deposited')

def vtkExport():                                    
    vtkExporter.exportSpheres(ids='all',what=dict(particleVelocity='b.state.vel'))
    vtkExporter.exportFacets(ids='all',what={'pos': 'b.state.pos'})
    vtkExporter.exportInteractions(ids='all',what=dict(kn='i.phys.kn'))
    vtkExporter.exportContactPoints(ids='all',what={'nn': 'i.geom.normal'})

def checkUnbalanced():
        if unbalancedForce() < .05:
              O.pause()
def addPlotData():
       plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)
plot.plots={'i': ('unbalanced', None, O.energy.keys)}
plot. Plot()
O.saveTmp()

Cheers,
Weihao Mu

[1] doc/sphinx/tutorial/02-gravity-deposition.py · master · yade-dev / trunk · GitLab
[2] Question #689234 “How to export relative velocity of spheres to ...” : Questions : Yade (launchpad.net)
[3] Question #695966 “VTKExporter -> exportFacets command” : Questions : Yade (launchpad.net)
[4] Question #689542 “definition of the recorded data in Generic rec... : Questions : Yade (launchpad.net)
[5] examples/test/vtk-exporter/vtkExporter.py · master · yade-dev / trunk · GitLab


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