Error while compiling Potential Blocks
Hi,
I am trying out an example with Potential Blocks, but I am getting the following error:
File "cubePBscaled.py", line 34, in <module>
InsertionSo
NameError: name 'PotentialBlock
I have already installed the packages coinor-clp and so on. Also I tried to simply write
ENABLE_
yade cubePBscaled.py ENABLE_
However, neither resolved the issue.
Can anyone help me in understanding the issue? My version of Ubuntu is 18.04 and YADE 2018.02b.
Here's the code I am using:
-------
##!/usr/
# -*- encoding=utf-8 -*-
# CWBoon 2015
# Uses the following algorithm:
# CW Boon, GT Houlsby, S Utili (2012). A new algorithm for contact detection between convex polygonal and polyhedral particles in the discrete element method. Computers and Geotechnics 44, 73-82.
#Display is saved to a vtk file in the "vtk folder" and the user is required to load it using ParaView. Control the frequency of printing a vtk file using vtkRecorder.
#To use this script:
#Compile with
#ENABLE_
#coinor-clp,
#coinor-libclp-dev,
#coinor-libclp1,
#coinor-libosi1v5
from yade import pack
import math
import os
import errno
try:
os.mkdir('./vtk/')
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
#GlobalStiffne
NewtonIntegrat
PotentialBlock
]
powderDensity = 2000
distanceToCentre = 0.5
meanSize = 1.0
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:
b=Body()
b.mask=1
b.aspherical=True
wire=False
color=
highlight=False
b.shape=
d=[distanceToCe
wire=wire, highlight=
utils.
b.state.pos = s[0] #s[0] stores center
b.state.ori = Quaternion(
O.bodies.append(b)
#Bottom faces of the box
r=0.1*wallThickness
bbb=Body()
bbb.mask=3
wire=False
color=[0,0.5,1]
highlight=False
bbb.shape=
utils._
bbb.state.pos = [0,0,0]
lidID = O.bodies.
b1=Body()
b1.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b1.shape=
utils._
b1.state.pos = [lengthOfBase/
O.bodies.append(b1)
b2=Body()
b2.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b2.shape=
utils._
b2.state.pos = [-lengthOfBase/
O.bodies.append(b2)
b3=Body()
b3.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b3.shape=
utils._
b3.state.pos = [0,0,lengthOfBa
O.bodies.append(b3)
b4=Body()
b4.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b4.shape=
utils._
b4.state.pos = [lengthOfBase/
O.bodies.append(b4)
b5=Body()
b5.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b5.shape=
utils._
b5.state.pos = [0,0,-lengthOfB
O.bodies.append(b5)
b6=Body()
b6.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b6.shape=
utils._
b6.state.pos = [-lengthOfBase/
O.bodies.append(b6)
b7=Body()
b7.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b7.shape=
utils._
b7.state.pos = [-lengthOfBase/
O.bodies.append(b7)
b8=Body()
b8.mask=3
wire=False
color=[0,0.5,1]
highlight=False
b8.shape=
utils._
b8.state.pos = [lengthOfBase/
O.bodies.append(b8)
# Vertical faces A-B-C-D of the box
bA=Body()
bA.mask=3
wire=False
color=[0,0.5,1]
highlight=False
bA.shape=
utils._
bA.state.pos = [0.5*lengthOfBa
O.bodies.append(bA)
bB=Body()
bB.mask=3
wire=False
color=[0,0.5,1]
highlight=False
bB.shape=
utils._
bB.state.pos = [-0.5*lengthOfB
O.bodies.append(bB)
bC=Body()
bC.mask=3
wire=True
color=[0,0.5,1]
highlight=False
bC.shape=
utils._
bC.state.pos = [0,0.5*
O.bodies.append(bC)
bD=Body()
bD.mask=3
wire=False
color=[0,0.5,1]
highlight=False
bD.shape=
utils._
bD.state.pos = [0,0.5*
O.bodies.append(bD)
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>25000:
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(
from yade import qt
qt.Controller()
v=qt.View()
O.saveTmp()
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Robert Caulk
- Solved:
- 2019-11-25
- Last query:
- 2019-11-25
- Last reply:
- 2019-11-25
Robert Caulk (rcaulk) said : | #1 |
If you want to use potential blocks, you need to compile the source code with ENABLE_
[1]https:/
[2]https:/
Hi Robert,
Thank you for your prompt reply. Since I am new to Yade, I might have some questions which are/might seem stupid. Hoping for your patience in this regard.
I have downloaded the trunk version (git clone https:/
I tried to run the code in trunk but I had the same problem. What am I doing wrong here? How to actually enable potential blocks?
Regards,
Debdeep.
Robert Caulk (rcaulk) said : | #3 |
Please tell us which of the steps do not work for you in the source code compilation instructions [1]
I am trying to undertake the compilation process as mentioned in [1]. I have finished till the starting of compilation (the step marked with: cmake -DCMAKE_
Robert Caulk (rcaulk) said : | #5 |
>But after this, I cannot proceed
Please be specific about why you cannot proceed beyond the cmake step.
By this, I mean the specific command that I am supposed to enter. As mentioned in [1], the next command shows:
cmake -DOPTION1=VALUE1 -DOPTION2=VALUE2
However, I am not sure I get exactly what to type and proceed. By the way, I am still inside the 'build' directory.
|
#7 |
cmake -DCMAKE_
Thanks Robert Caulk, that solved my question.
Thanks Robert for the solution. However, just out of curiosity, I wanted to know that since I am already running a couple of simulations using Yade (triaxial test, pretty time consuming), should I wait for the simulations to finish before compiling the source, or I can carry it out independently of the already running simulations?
Hi,
The Potential Blocks are enabled in yadedaily, if you want to have a quick look.
In any case, following Robert's detailed suggestions, it would be good to learn how to compile YADE from source, in case you need to use any other feature which is not enabled by default in the standard, pre-packaged YADE stable release (e.g. YADE 2018.02b.).
In the source-code, the Potential Blocks are enabled by default (no need to use: -DENABLE_
In theory, you can compile the source code in parallel with your simulations, but be advised that compilation will require available CPUs and RAM, so make sure you can bear the computational cost of compiling the code in parallel with running your simulations. If you are not in any hurry, I'd say wait :)
All the best,
Vasileios
Thank you Vasileios for the detailed explanation! I will wait for the current simulations to finish before proceeding with compiling the source code.