← Back to team overview

yade-users team mailing list archive

Re: [Question #707368]: Export wall for Paraview

 

Question #707368 on Yade changed:
https://answers.launchpad.net/yade/+question/707368

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

the problem is visualization of the infinite object :-) and its automation (what should be the shape? what size? ...?).
For every situation the proper visualization may be different.

As a workaround, you can export wall data to a CSV file, load it in paraview, "filter" it a bit and get whatever you want.
For example circles:

### yade scriptw1,w2,w3 = [wall((0,0,0),axis=i) for i in (0,1,2)]
walls = [w1,w2,w3]
O.bodies.append(walls)
w1.state.vel = (1,0,0)
w2.state.vel = (0,2,0)
w3.state.vel = (0,0,3)

O.engines = [
    PyRunner(iterPeriod=1,initRun=True,command="exportWalls()"),
    NewtonIntegrator(),
]

def exportWalls():
    with open(f"wall-{O.iter:06d}.csv","w") as f:
        f.write("x,y,z,nx,ny,nz\n")
        for w in walls:
            x,y,z = w.state.pos
            n = [0,0,0]
            n[w.shape.axis] = 1
            nx,ny,nz = n
            f.write(f"{x},{y},{z},{nx},{ny},{nz}\n")

O.dt = 1
O.run(5,True)
###

And then in Paraview for example:
- open the wall-....csv files, use CSV Reader if you have to choose, Apply
- Filters -> Table To Points, select x,y,z as X, Y, Z columns, Apply
- Calculator (make nz,ny,nz to one vector):
    - Result: normal
    - formula: iHat*nx+jHat*ny+kHat*nz
    - Apply
- Glyph -> Box:
    - Z Length: 0
    - Scale Factor: what you need, e.g. 5
    - Glyph Mode: All Points
    - Apply

Cheers
Jan

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