Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-07 Thread doclarens
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

doclarens posted a new comment:
hanks, Janek. I still have a problem, I use the AttributeError: 'module'
object has no attribute 'setLiveForceAlwaysUpdate'  to set the current
cell configuration to be the reference one, but when I use print  File
"plottest.py", line 136, in  to print the current strain, the
strain is not equal to zero. https://dentnis.com

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Zhicheng Gao
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Status: Answered => Solved

Zhicheng Gao confirmed that the question is solved:
Thanks Janek Kozicki, that solved my question.

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Janek Kozicki
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Status: Open => Answered

Janek Kozicki proposed the following answer:
AttributeError: 'module' object has no attribute
'setLiveForceAlwaysUpdate'

You need to upgrade your version to 2021.01a, this was fixed only 5
months ago.

The other one is a different question, you need to open a new question
for that.

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Zhicheng Gao
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Zhicheng Gao gave more information on the question:
Dear Janek,
  According to your suggestion, I add plot.setLiveForceAlwaysUpdate(True) to my 
code,  but the following error occurred:
Traceback (most recent call last):
  File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
  File "plottest.py", line 136, in 
plot.setLiveForceAlwaysUpdate(True)
AttributeError: 'module' object has no attribute 'setLiveForceAlwaysUpdate'

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Zhicheng Gao
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Status: Answered => Open

Zhicheng Gao is still having a problem:
Thanks, Janek. I still have a problem, I use the
O.cell.trsf=Matrix3.Identity to set the current cell configuration to be
the reference one, but when I use print(O.cell.trsf, triax.strain) to
print the current strain, the strain is not equal to zero.

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Janek Kozicki
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Janek Kozicki proposed the following answer:
"ValueError: shape mismatch" this happens because a plot uses two lists
of points: arguments (say "x") and values (say "y"). Plotting happens at
the same time when calculations are pushing more data points to the
plot. Plotting fails when the amount of "x" differs from the amount of
"y" which happens quite often if calcuations are adding "x" then "y" in
a separate thread. And when their sizes differ then it can't be plotted.
This function setLiveForceAlwaysUpdate makes sure that calculations are
paused during plot refresh, so the problem won't happen.

This bug was reported in https://gitlab.com/yade-dev/trunk/-/issues/110
and fixed in https://gitlab.com/yade-
dev/trunk/-/merge_requests/570/diffs

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Janek Kozicki
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Status: Open => Answered

Janek Kozicki proposed the following answer:
Try https://yade-
dem.org/doc/yade.plot.html#yade.plot.setLiveForceAlwaysUpdate

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #697421]: The problem of plot

2021-06-06 Thread Zhicheng Gao
Question #697421 on Yade changed:
https://answers.launchpad.net/yade/+question/697421

Zhicheng Gao gave more information on the question:
this is my code:
##__ First section, generate sample_

from __future__ import print_function
from yade import pack, qt, plot
from math import *

nRead=readParamsFromTable(
## model parameters
num_spheres=100,
targetPorosity= .387,
confiningPressure=-10,
## material parameters
compFricDegree=15,#contact friction during the confining phase
finalFricDegree=30,#contact friction during the deviatoric loading
young=2e8,
poisson=.2,
density=2600,
alphaKr=7.5,
alphaKtw=0,
competaRoll=.22,
finaletaRoll=.22,
etaTwist=0,
normalCohesion=0,
shearCohesion=0,
## fluid parameters
fluidDensity=1000,
dynamicViscosity=.001,
## control parameters
damp=0,
stabilityThreshold=.001,
## output specifications
filename='suffusion',
unknowOk=True
)

from yade.params.table import *

O.periodic=True
O.cell.hSize=Matrix3(.001,0,0, 0,.001,0, 0,0,.001)
# create materials for spheres
#shear strength is the sum of friction and adhesion, so the 
momentRotationLaw=True
O.materials.append(CohFrictMat(alphaKr=alphaKr,alphaKtw=alphaKtw,density=density,etaRoll=competaRoll,etaTwist=etaTwist,frictionAngle=radians(compFricDegree),momentRotationLaw=True,normalCohesion=normalCohesion,poisson=poisson,shearCohesion=shearCohesion,young=young,label='spheres'))

# generate particles packing
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(.001,.001,.001),psdSizes=[0.8,0.000125,0.0001592,0.0002003,0.0003153,0.000399,0.000502,0.0005743],psdCumm=[0.0,0.00628,0.0565,0.198,0.721,0.915,0.991,1.0],num=num_spheres,seed=1)
sp.toSimulation(material='spheres')

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D()],

[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(label='contact',setCohesionNow=False,setCohesionOnNewContacts=False)],

[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True)],
),
PeriodicFlowEngine(dead=1,label="flow"),#introduced as a dead engine 
for the moment, see 2nd section

GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
PeriTriaxController(label='triax',
# specify target values and whether they are strains or stresses
goal=(confiningPressure,confiningPressure,confiningPressure), 
stressMask=7,
# type of servo-control, the strain rate isn't determined, it 
shloud check the unbalanced force
dynCell=True,maxStrainRate=(10,10,10),
# wait until the unbalanced force goes below this value
maxUnbalanced=stabilityThreshold,relStressTol=1e-3,
doneHook='compactionFinished()'
),
NewtonIntegrator(damping=0)
]
qt.View()

import sys
def compactionFinished():
#check the current porosity
# if the current porosity is lager than target Porosity and 
comFricDegree is lager than 10,
# then we decrease friction value and apply it to all the bodies and 
contacts,
# else we decrease rolling friction value.
global compFricDegree, competaRoll
if  porosity()>targetPorosity and compFricDegree>5:
# we decrease friction value and apply it to all the bodies and 
contacts
compFricDegree = 0.95*compFricDegree
setContactFriction(radians(compFricDegree))
print('Friction:', compFricDegree,'porosity:', porosity())
# python syntax, make each step printout
sys.stdout.flush()
elif porosity()>targetPorosity:
# we decrease rolling fiction value and apply it to all the bodies 
and contacts
competaRoll=0.95*competaRoll
for b in O.bodies:
b.mat.etaRoll=competaRoll
for i in O.interactions:
i.phys.etaRoll=competaRoll
print('Rollingfriction:', b.mat.etaRoll, 'porosity:', porosity())
sys.stdout.flush()
else:
# after sample preparation, save the state
O.save('compactedState'+filename+'.yade.gz')
print('Compacted state saved', 'porosity', porosity())
# next time, called python command
triax.doneHook=''
O.pause()

# enable energy tracking in the code
O.trackEnergy=True

# define function to record history
def history():
plot.addData(unbalanced=unbalancedForce(),i=O.iter,exx=-triax.strain[0],
eyy=-triax.strain[1], ezz=-triax.strain[2],
sxx=-triax.stress[0],syy=-triax.stress[1],szz=-triax.stress[2],