How to export VTK file of walls

Asked by Leonard

Hi,
I'd like to export the VTK files at some interested strain level. It seems that using VTKRecorder in engines like:

VTKRecorder(fileName='vtkRecorder',recorders=['all'],iterPeriod=1000)

can only export the VTK files according to the iterPeriod. So I go to use VTKExporter to output the VTK files at the desired strain level. With [1] I can output the spheres, and I still need to output the walls which is defined as walls=aabbWalls([mn,mx],thickness=0,material='walls' (for triaxial test).

In [1] it mentions that using VTKExport can export:

spheres
facets
polyhedra
PotentialBlocks
interactions
contact points
periodic cell

I just wonder is it possible to export the walls using VTKExport?

Thanks
Leonard

[1]https://yade-dev.gitlab.io/trunk/yade.export.html?highlight=vtkexporter#yade.export.VTKExporter.exportSpheres

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

concerning "at some interested strain level", how is VTKExporter different from VTKRecorder?
From this point of view, they are interchangeable..

Concerning "wall" export (which is actually Box, as aabbWalls return boxes), they are not (yet) supported.
You can:
- export "manually" the data of the boxes and visualize it extra
- implement the functionality to VTKExporter

cheers
Jan

Revision history for this message
Leonard (z2521899293) said :
#2

Hi Jan,

Thanks for your reply.

The general way to output VTK files could be (in O.engines):
VTKRecorder(fileName='vtkRecorder',recorders=['all'],iterPeriod=500),

In this way I can gain all the items (spheres, walls...) which is really good. But it exports the files evey 500 iters, which doesn't ensure I get the files at the strains that I want, and also it generates many files at other strains which I don't need.

The way I export the VTK files by using VTKExporter at some interested strain level is like:

vtkExporter = export.VTKExporter('sphere')

strainLevel=[0.01,0.02,0.03]
def outputVTK_sphere():
 if -triax.strain[1]>strainLevel[0]:
  vtkExporter.exportSpheres(ids='all',what=[('linVel','b.state.vel'),('linVelLen','b.state.vel.norm()'),('id',"b.id")])
  strainLevel.remove(strainLevel[0])

And then I put this function to the engines as:
PyRunner(command='outputVTK_sphere()',iterPeriod=100)
But in this way exporting the "wall" is not (yet) supported as you mentioned.

>they are interchangeable.
Do you have any idea to make the VTKRecorder being executed only at the desired strain? As something like the above example.

Thanks
Leonard

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

You can use VTKRecorder (almost) exactly the way as VTKExporter.
Just instead of vtkExporter.exportSpheres(...) use vtkRecorder()

A MWE:
###
s = sphere((0,0,0),1)
s.state.vel = (1,0,0)
O.bodies.append(s)
vtkRecorder = VTKRecorder(fileName='vtkRecorder',recorders=['all']) # instead of export.VTKExporter(...)
pyRunner = PyRunner(iterPeriod=1,command="export()")
O.engines += [pyRunner]
def export():
    if O.iter in (10,50,200): # primitive condition, just export if O.iter is 10, 50 or 200
        vtkRecorder() # calling does the engine's action, in this case saving
O.run(210,True)
###

cheers
Jan

Revision history for this message
Leonard (z2521899293) said :
#4

Thanks Jan Stránský, that solved my question.