Visualizing cubes
I am using the following code from the examples to model cube deposition in a box, but i am not able to visualize it or export it to vtk.
This is my code:
# -*- encoding=utf-8 -*-
# 2022 © Vasileios Angelidakis <email address hidden>
# Duplicate script of cubePBscaled.py, simplified using the "potential_utils" module.
from yade import pack,
from potential_utils import *
import math
recordVTK=True
# -------
if recordVTK:
# Create vtk directory
import os
import errno
try:
os.mkdir(
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
NewtonIntegrat
# save data for Paraview
VTKRecorder
]
powderDensity = 2000
meanSize = 1.0
distanceToCentre = meanSize/2.
wallThickness = 0.5*meanSize
O.materials.
lengthOfBase = 9.0*meanSize
heightOfBase = 14.0*meanSize
sp=pack.
mn,mx=Vector3(
R=sqrt(
sp.makeCloud(
r=0.01*meanSize
for s in sp:
color=
# PB_utils.cuboid
b=cuboid(
b.state.ori = Quaternion(
O.bodies.append(b)
#Bottom faces of the box
r=0.1*wallThickness
color=[0,0.5,1]
# Centroids of particles forming the bottom face of the box
center= [[ 0, 0, 0],
[-lengthOfBas
[ lengthOfBase/3.0, 0, 0],
[ 0, 0, -lengthOfBase/3.0],
[-lengthOfBas
[ lengthOfBase/3.0, 0, -lengthOfBase/3.0],
[ 0, 0, lengthOfBase/3.0],
[-lengthOfBas
[ lengthOfBase/3.0, 0, lengthOfBase/3.0]
]
edges=[
lidID=len(O.bodies)
for i in range(0,9):
O.bodies.append( cuboid(
# Vertical faces A-B-C-D of the box
center= [ [ 0, 0.5*heightOfBase, 0.5*lengthOfBase],
[ 0, 0.5*heightOfBase, -0.5*lengthOfBase],
[ 0.5*lengthOfBase, 0.5*heightOfBase, 0],
[-0.
]
edges= [ [ lengthOfBase, heightOfBase, wallThickness],
[ lengthOfBase, heightOfBase, wallThickness],
[wallThickness, heightOfBase, lengthOfBase],
[wallThickness, heightOfBase, lengthOfBase]
]
transparentID=
for i in range(0,4):
O.bodies.append( cuboid(
O.bodies[
escapeNo=0
def myAddPlotData():
global escapeNo
global wallThickness
global meanSize
uf=utils.
if isnan(uf):
uf = 1.0
KE = utils.kineticEn
for b in O.bodies:
if b.state.pos[1] < -5.0*meanSize and len(b.state.
escapeNo = escapeNo+1
O.bodies.
if O.iter>15000:
removeLid()
plot.addData(
from yade import plot
plot.plots=
#plot.plot() #Uncomment to view plots
O.engines=
def removeLid():
global lidID
if (O.bodies[lidID]):
O.bodies.
O.dt = 0.2*sqrt(
# -------
if recordVTK:
# Take snapshots
# O.engines=
# Export VTK results
from yade import export
vtkExporter = export.
def vtkExport():
vtkExporter.
O.engines=
from yade import qt
qt.Controller()
v=qt.View()
O.saveTmp()
thank you!
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Carine Tanissa
- Solved:
- Last query:
- Last reply: