← Back to team overview

yade-users team mailing list archive

[Question #685339]: RuntimeError: Secondary views not supported

 

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

Hello,

I am using Ubuntu 18.04, and Yade 2019-08-08.git-775ae74

Unfortunately there is no question about  run time error on forums, so I couldn't find the answer.
Also, I have read the wiki and tutorials, struggle with codes as a beginner in yade and asked some questions. Finally, I slightly changed https://.../script-session1.py. I got some errors such as syntax ones and fixed them and Jan kindly solved some of my questions as well, but I get the following error now:

ehsan@ehsan:~/Desktop$ /home/ehsan/yade/install/bin/yade-2019-08-08.git-775ae74 Q.py
Welcome to Yade 2019-08-08.git-775ae74 
Using python version: 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0]
TCP python prompt on localhost:9000, auth cookie `ydeusa'
XMLRPC info provider on http://localhost:21000
Running script Q.py
The constructor with a shareWidget is deprecated, use the regular contructor instead.
Number of elements:  2006
Box Volume:  5.3940427e-317
Box Volume calculated:  1000.0
unbalanced force: 0.028635486048758475  mean stress engine:  -49967.412175869984  mean stress (Calculated):  -49968.34690148215
porosity= 0.42855173543019676
void ratio= 0.7499396918333777
-----Phase_01: Isotropic compression 50kPa--(^_^)---
unbalanced force: 0.007193260745831804  mean stress engine:  -50004.49167253919  mean stress (Calculated):  -50003.46882462894
porosity= 0.4280204122032604
void ratio= 0.7483141380131962
-----Phase_01: Isotropic compression 50kPa--(^_^)---
###      Isotropic phase saved      ###
Traceback (most recent call last):
  File "/home/ehsan/yade/install/bin/yade-2019-08-08.git-775ae74", line 336, in runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 82, in execfile
    exec_(code, myglobals, mylocals)
  File "Q.py", line 165, in <module>
    qt.View()
RuntimeError: Secondary views not supported
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

In [1]: 

*****************************************************************************
This is my code:

############################################################################################################################
#########         	TRIAXIAL PROBLEM, Y IS THE VERTICAL AXIS, X IS THE RIGHT AXIS, Z IS THE FRONT AXIS         #########
############################################################################################################################

import numpy as np
import math
from yade import pack, plot, qt, export, utils
from datetime import datetime

######################################################
#########         DEFINING VARIABLES         #########

nRead=readParamsFromTable(
	num_spheres=2000,
	compFricDegree = 30,
	key='_triax_base_',
	unknownOk=True
)

from yade.params import table

num_spheres=table.num_spheres		
key=table.key
targetPorosity = 0.43 			
compFricDegree = table.compFricDegree 	
finalFricDegree = 30 			
rate=-0.02 				
damp=0.2 				
stabilityThreshold=0.01 		
young=15e6 			
poisson=0.4
mn,mx=Vector3(0,0,0),Vector3(10,10,10)
sigmaIso=-50e3				

######################################################
#########         DEFINING MATERIALS         #########

O.materials.append(FrictMat(young=young,poisson=poisson,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))		
O.materials.append(FrictMat(young=young,poisson=poisson,frictionAngle=0,density=0,label='frictionlesswalls'))				

####################################################
#########         DEFINING PACKING         #########

walls=aabbWalls([mn,mx],thickness=0,material='frictionlesswalls')				
wallIds=O.bodies.append(walls)									
sp=pack.SpherePack()
volume = (mx[0]-mn[0])*(mx[1]-mn[1])*(mx[2]-mn[2])						
mean_rad = pow(0.09*volume/num_spheres,0.3333)									
clumps=False 											
if clumps:
    volume = (mx[0]-mn[0])*(mx[1]-mn[1])*(mx[2]-mn[2])						
    mean_rad = pow(0.09*volume/num_spheres,0.3333)							
    c1=pack.SpherePack([((-0.2*mean_rad,0,0),0.5*mean_rad),((0.2*mean_rad,0,0),0.5*mean_rad)])	
    sp.makeClumpCloud(mn,mx,[c1],periodic=False)							
    sp.toSimulation(material='spheres')								
    O.bodies.updateClumpProperties()								
else:
    sp.makeCloud(mn,mx,-1,0.3333,num_spheres,False, 0.95,seed=1) 					
    O.bodies.append([sphere(center,rad,material='spheres') for center,rad in sp])

##########################################################
#########         DEFINING TRIAXIAL TEST         #########

triax=TriaxialStressController(			
	maxMultiplier=1.+2e4/young, 		
	finalMaxMultiplier=1.+2e3/young, 	
	thickness = 0,
	stressMask = 7,
	internalCompaction=False		
)

######################################################
#########         DEFINING FUNCTIONS         #########

def checkUnbalanced():
	if unbalancedForce()<.05:
		O.pause()
		plot.saveDataTxt('bbb.txt.bz2')
def history():											
	plot.addData(e11=-triax.strain[0], e22=-triax.strain[1], e33=-triax.strain[2],
			ev=-triax.strain[0]-triax.strain[1]-triax.strain[2],
			s11=-triax.stress(triax.wall_right_id)[0],
			s22=-triax.stress(triax.wall_top_id)[1],
			s33=-triax.stress(triax.wall_front_id)[2],
			i=O.iter,unbalanced=unbalancedForce()
)

####################################################
#########         DEFINING ENGINES         #########

newton=NewtonIntegrator(damping=damp)
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),
	GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),	
	triax,
	TriaxialStateRecorder(iterPeriod=100,file='WallStresses'+table.key),
	newton,
	PyRunner(iterPeriod=20,command='history()',label='recorder'),
	PyRunner(command='checkUnbalanced()',realPeriod=2)
]
Gl1_Sphere.stripes=True											
if nRead==0: yade.qt.Controller(), yade.qt.View()
print ('Number of elements: ', len(O.bodies))
print ('Box Volume: ',  triax.boxVolume)
print ('Box Volume calculated: ', volume)

###############################################################
#########         APPLYING CONFINING PRESSURE         #########

triax.internalCompaction=False			
setContactFriction=radians(compFricDegree)
triax.stressmask=7
triax.goal1=sigmaIso
triax.goal2=sigmaIso
triax.goal3=sigmaIso
while 1:
    O.run(1000, True)
    unb=unbalancedForce()	
    meanS=(triax.stress(triax.wall_right_id)[0]+triax.stress(triax.wall_top_id)[1]+triax.stress(triax.wall_front_id)[2])/3	
    print ('unbalanced force:',unb,' mean stress engine: ',triax.meanStress,' mean stress (Calculated): ',meanS)
    print ('porosity=',triax.porosity)
    print ('void ratio=',triax.porosity/(1-triax.porosity))
    print ('-----Phase_01: Isotropic compression 50kPa--(^_^)---')
    if unb<stabilityThreshold and abs(sigmaIso-triax.meanStress)/sigmaIso<0.001:
        break
O.save('confinedPhase'+key+'.xml')
print ('###      Isotropic phase saved      ###')
e22Check=triax.strain[1]
######################################################
#########         DEVIATORIC LOADING         #########

triax.internalCompaction=False			
setContactFriction=radians(compFricDegree)	
triax.stressMask = 5				
triax.goal2=rate				
triax.goal1=sigmaIso				
triax.goal3=sigmaIso			
#while 1:
    #O.run(1000, True)
    #unb=unbalancedForce()	
    #axialS=triax.stress(triax.wall_top_id)[1]
    #print ('step=', O.iter, 'unbalanced force:',unb,' sigma2: ',axialS, 'q=', axialS-sigmaIso)
    #print ('axial deformation (%)', (triax.strain[1]-e22Check)*100)
    #if abs((triax.strain[1]-e22Check)-0.01)<=0.001:
        #O.save('firstpoint.xml')
   # if abs((triax.strain[1]-e22Check)-0.02)<=0.001:
     #   O.save('secondpoint.xml')
   # if abs((triax.strain[1]-e22Check)-0.03)<=0.001:
  #      O.save('thirdpoint.xml')
   # if abs((triax.strain[1]-e22Check)-0.05)<=0.001:
 #       O.save('fourthpoint.xml')
  #  if triax.strain[1]-e22Check>=0.3 : 
#        break
#O.save('final.xml')

########################################################
#########         RECORD AND PLOT DATA         #########

qt.View()
O.run(5000,True)
plot.plots={'e22':('s11','s22','s33'),'e22':('ev')}						
plot.labels={'s11':'$\sigma_{11}$' , 's22':'$\sigma_{22}$' , 's33':'$\sigma_{33}$' , 'e11':'$\epsilon_{11}$' , 'e22':'$\epsilon_{22}$' , 'e33':'$\epsilon_{33}$' , 'ev':'$\epsilon_{V}$'}
plot.plot()											
plot.saveDataTxt('results'+key)									
plot.saveGnuplot('plotScript'+key)								

********************************************************

And also before the error, I get 1 notice as "The constructor with a shareWidget is deprecated, use the regular contructor instead.". I don't know if this affects my code or not.

Could you please let me know if there is any other mistake in this code?

Thank you very much for your help.

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