# Failed in Parametric Studies

Asked by Rong Zhao on 2019-11-17

I would like to make a parametric studies on periodic triaxial test. To be specific, I just want to generate the different packing with different porosity by control of friction angel ranging from 0 degree to 100 degrees. Then I conduct the axial loading. It should be noted that the friction angel is set to 0.5 in radian before the axial loading phase.

First, isotropic compaction is ended by calling compactionFinished1() until -1e5 is reached in all directions.
Second, by calling compactionFinished2(), isotropic compaction is run again to set the friction angel being 0.5 in radian before the axial loading.
Third, constant-strain deformation along the z-axis while maintaining constant stress (sigmaIso) laterally is ended by calling triaxFinished().

Here are the codes.
=========================
from __future__ import print_function

compFricDegree=0,
noTableOk=True
)

young=1e7
poisson=0.3
density=1000
sigmaIso=-1e5

#import matplotlib
#matplotlib.use('Agg')

# generate loose packing

O.periodic=True
sp=pack.SpherePack()
if 0:
## uniform distribution
sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.3,periodic=True)
else:
## create packing from clumps
# configuration of one clump
c1=pack.SpherePack([((0,0,0),.03333),((.03,0,0),.017),((0,.03,0),.017)])
# make cloud using the configuration c1 (there could c2, c3, ...; selection between them would be random)
sp.makeClumpCloud((0,0,0),(2,2,2),[c1],periodic=True,num=500)

# setup periodic boundary, insert the packing
sp.toSimulation(material='clumps')

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
PeriTriaxController(label='triax',
# specify target values and whether they are strains or stresses
# type of servo-control
dynCell=True,maxStrainRate=(10,10,10),
# wait until the unbalanced force goes below this value
maxUnbalanced=.01,relStressTol=1e-3,
# call this function when goal is reached and the packing is stable
doneHook='compactionFinished1()'
),
NewtonIntegrator(damping=.2),
]
O.dt=.5*PWaveTimeStep()

sxx=-triax.stress[0],syy=-triax.stress[1],szz=-triax.stress[2],
exx=-triax.strain[0],eyy=-triax.strain[1],ezz=-triax.strain[2],
#DeviatorStress=-triax.stress[2]-(-triax.stress[0]-triax.stress[1])/2,
# save all available energy data
Etot=O.energy.total(),**O.energy
)
plot.saveDataTxt('data1' + O.tags['d.id'] + '.txt')

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

# define what to plot
plot.plots={'i':('unbalanced',),'i ':('sxx','syy','szz'),' i':('exx','eyy','ezz'),
# energy plot
#' i ':(O.energy.keys,None,'Etot')
'ezz':('DeviatorStress',)
}
# show the plot
plot.plot()

def compactionFinished1():
O.materials[0].frictionAngle=.5
# set the current cell configuration to be the reference one
O.cell.trsf=Matrix3.Identity
triax.doneHook='compactionFinished2()'

def compactionFinished2():
# set the current cell configuration to be the reference one
print(O.iter+1, porosity())
# O.materials[0].frictionAngle=.5
O.cell.trsf=Matrix3.Identity
# change control type: keep constant confinement in x,y, 20% compression in z
triax.goal=(sigmaIso,sigmaIso,-.2)
# allow faster deformation along x,y to better maintain stresses
triax.maxStrainRate=(1.,1.,.1)
# next time, call triaxFinished instead of compactionFinished
triax.doneHook='triaxFinished()'
# do not wait for stabilization before calling triaxFinished
triax.maxUnbalanced=10

sxx=-triax.stress[0],syy=-triax.stress[1],szz=-triax.stress[2],
exx=-triax.strain[0],eyy=-triax.strain[1],ezz=-triax.strain[2],
DeviatorStress=-triax.stress[2]-(-triax.stress[0]-triax.stress[1])/2,
)
plot.saveDataTxt('data2_' + O.tags['d.id'] + '.txt')

def triaxFinished():
print('Finished')
O.pause()

O.saveTmp()
O.run()
=========================

When this code is run using yade, it succeed. However, it failed when run in yade-batch.

Here is parameter table.
=========================
compFricDegree
0
10
20
30
40
50
60
70
80
90
100

=========================

Here is one of the logs.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Using python version: 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0]
Warning: no X rendering available (see https://bbs.archlinux.org/viewtopic.php?id=13189)
XMLRPC info provider on http://localhost:21000
TCP python prompt on localhost:9000, auth cookie `ekaysu'
Running script 06-periodic-triaxial-test-clumps_friP_comp2_batch.py
/usr/lib/python3/dist-packages/matplotlib/__init__.py:831: MatplotlibDeprecationWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
mplDeprecation)
/usr/lib/python3/dist-packages/matplotlib/__init__.py:801: MatplotlibDeprecationWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
mplDeprecation)
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::log::v2_mt_posix::system_error> >'
what(): Failed to set TLS value: Invalid argument
Aborted (core dumped)

=================== JOB SUMMARY ================
id : compFricDegree=10
status : 34304 (FAILED)
duration: 00:00:01
started : Sun Nov 17 16:20:46 2019
finished: Sun Nov 17 16:20:47 2019
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

How to solve this problem, Thanks!

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2019-11-18
2019-11-18
 Jérôme Duriez (jduriez) said on 2019-11-18: #1

Hi,

It seems your batch version comes from a compiled version of recent source code (2019-11-07.git-09bc730).

Does the "yade" you're using to successfully run this script is obtained the same way ? (compilation of same source code to home/zhaorong/myYade/install/bin/yade-2019-11-07.git-09bc730)

 Rong Zhao (zhaorong) said on 2019-11-18: #2

Thanks, Jérôme Duriez (jduriez) .

>>>Does the "yade" you're using to successfully run this script is obtained the same way ? (compilation of same source code to home/zhaorong/myYade/install/bin/yade-2019-11-07.git-09bc730)

>>>Yes, it is.

 Jérôme Duriez (jduriez) said on 2019-11-18: #3

A first thing would be to remove plot.plot() from your (maybe too long here ;-) ) script. Interactive plotting is not expected / meaningful during batch execution.