← Back to team overview

yade-users team mailing list archive

Re: BexContainer not thread-synchronized; call sync() first!

 

Hi Luc,

Here is the python code I use to run directional analysis on Yade
0.20.2.
 I would like that you test  it for Bzr before  submitting it.






Le vendredi 26 février 2010 à 17:45 +0100, Luc Sibille a écrit :
> Hi Nejib,
> 
> There is written somewhere in the engine:
> 
> height0 = height; depth0 = depth; width0 = width;
> 
> If this line is not commented, you will have only the strain increment 
> developed during the current simulation. If you want the total 
> deformation, you just need to comment this line.
> 
>   Luc
> 
> I think that depends on
> 
> nejib hadda a écrit :
> > Hi Luc, 
> > 
> > Just a question about the ThreeDTriaxialEngine, did you wrote it in the
> > manner that it gives directly the increment of the  deformations
> > (delta_eps_ii) and not total deformations (esp_ii) or something goes
> > wrong with my simulations!
> > 
> > Thanks
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Le lundi 22 février 2010 à 15:38 +0100, Luc SIBILLE a écrit :
> >> Hi all, Hi Nejib,
> >>
> >>    I am currently updating the ThreeDTriaxial engine for the last bazaar
> >> version, thus maybe Nejib you don't need to do it yourself, but it is
> >> up to you. I will keep you update if it works or not.
> >>
> >>   Best
> >>
> >>   Luc
> >>
> >>> Hi evrybody !
> >>>
> >>> I fixed to ThreeDtriaxial test on the 0.20.2 version of Yade.
> >>>
> >>> Bruno, I am not used to bazar version and I've never been working on it,
> >>> but since you say that it is newer than the one I have and currently
> >>> evrybody is developping it, I'm going to switch on it.
> >>>
> >>>
> >>>
> >>>
> >>> Le vendredi 19 février 2010 à 12:01 +0100, nejib hadda a écrit :
> >>>> Hi,
> >>>>
> >>>> I fixed the problem of sync() for yade 0.20.2 in ThreeDTriaxialEngine by
> >>>> adding:
> >>>>
> >>>> void ThreeDTriaxialEngine::updateParameters ( MetaBody * ncb )
> >>>>
> >>>> Now yade can load the xml file and run it until it comes to write data
> >>>> to the Wallstresses file:
> >>>>
> >>>> For example, in my xml file I ask Yade to records data evry 50
> >>>> iterations, and the current iteration in my xml file is 3221: Yade
> >>>> crashes at the 3251st iteration but not for a sync() problem but rather
> >>>> it throws me an error message related to The  TriaxialStateRecorder.cpp
> >>>> file
> >>>>
> >>>> "TriaxialStateRecorder::action (this=0x9ec08f8, ncb=0xb44e220) at
> >>>> pkg/dem/Engine/DeusExMachina/TriaxialStateRecorder.cpp:89"
> >>>>
> >>>> the problem is located here:
> >>>>
> >>>> void TriaxialStateRecorder::action (MetaBody * ncb )
> >>>> {.
> >>>>  .
> >>>>  .
> >>>> if ( ! ( Omega::instance().getCurrentIteration() %
> >>>> triaxialCompressionEngine->computeStressStrainInterval == 0 ) )
> >>>>
> >>>> 		triaxialCompressionEngine->computeStressStrain ( ncb );
> >>>> .
> >>>> .
> >>>> .
> >>>>
> >>>> In the Xml file, I ommited the TriaxialStateRecorder engine, and load it
> >>>> in yade it runs with no crashes.
> >>>>
> >>>> May be someone can Have an idea to fix this problem, Thanks !
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Le jeudi 18 février 2010 à 20:18 +0100, Václav Šmilauer a écrit :
> >>>>>> I'm using the new version of yade 0.20.2, I replaced the triaxial
> >>>>>> compression engine by the TreeDTriaxialEngine.
> >>>>> 0.20.2 is quite old, given changes we've done recently...
> >>>>>
> >>>>>> Can you tell me how can I sync'ing forces in this engine!
> >>>>> Have a look at TriaxialStressController::applyCondition(MetaBody*
> >>>> ncb),
> >>>>> it is just a single line:
> >>>>>
> >>>>> 	ncb->bex.sync();
> >>>>>
> >>>>> you can put it to ThreeDTriaxialEngine, although that one doesn't
> >>>> access
> >>>>> "bex" (forces) at all; it looks like bug elsewhere, but you would have
> >>>>> track down where exactly is this bex being read.
> >>>>>
> >>>>> v
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> Mailing list: https://launchpad.net/~yade-users
> >>>>> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> >>>>> Unsubscribe : https://launchpad.net/~yade-users
> >>>>> More help   : https://help.launchpad.net/ListHelp
> >>>>
> >>>> _______________________________________________
> >>>> Mailing list: https://launchpad.net/~yade-users
> >>>> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> >>>> Unsubscribe : https://launchpad.net/~yade-users
> >>>> More help   : https://help.launchpad.net/ListHelp
> >>>
> >>> _______________________________________________
> >>> Mailing list: https://launchpad.net/~yade-users
> >>> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> >>> Unsubscribe : https://launchpad.net/~yade-users
> >>> More help   : https://help.launchpad.net/ListHelp
> >>>
> >>
> > 
> > 
> 

# -*- coding: utf-8 -*-

# 2010 © Nejib HADDA <nejib.hadda@xxxxxxxxxxx>




#This script run directionnel analysis controlled in stresses (such the case here) or in strains (just make few modifications)
#Run it from the console after launching YADE, use the command: execfile ('Directional_Analysis.py')

print ('            \n')
print ('Collecting data...\n') 	## Collect whatever parameter you want to check from your xml file at a given deviatoric stress ratio before proceeding

o=Omega()
o.load('filename.xml')

print ('----------------------------------------------------------------------------')
S1=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['sigma1']
S2=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['sigma2']
S3=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['sigma3']
FA=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['frictionAngleDegree']
UFA=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['updateFrictionAngle']

neta	=3*(S2-S1)/(S2+2*S1) 		## Deviatoric stress ratio

print ('Friction angle		= %g ' %FA)
print ('updateFrictionAngle	= %g ' %UFA)
print ('Deviatoric stress ratio	= %g ' %neta)
print ('----------------------------------------------------------------------------\n')

Dir	=36;		## Set the number of directions (each 10°)
dsigma	=1000		## Set the norm of dsigma
i	=1

import math

Iter_Nbr=50000

ofile = open('Dir_Analysis', "w")
ofile.write("iteration s11 s22 s33 e11 e22 e33 unb_force porosity kineticE \n")

	

while i <= Dir:
  o=Omega()
  o.load('filename.xml') #same file above



  alpha=2*pi*i/Dir
  print ('alpha = %g\n' %alpha)	
  print ('Starting the %d/%d Direction\n' %(i ,Dir))
  ## you can make changes here for any engine's parameter instead of in the xml file, just add what you need
  
  Sig11=S1+(dsigma*cos(alpha)/sqrt(2))
  Sig22=S2+(dsigma*sin(alpha))
  Sig33=S3+(dsigma*cos(alpha)/sqrt(2))

  k=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['sigma1']=(Sig11) 
  l=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['sigma2']=(Sig22)
  m=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['sigma3']=(Sig33)
  p=[j for j in o.engines if j.name=='ThreeDTriaxialEngine'][0] ['frictionAngleDegree']=35
  
  n=[j for j in o.engines if j.name=='Recorder3D'][0] ['outputFile']=('WallStresses-%d'%i)
  ##Recorder3D is an engine that I added in Yade 0.20.2 to record wall Stresses and strains, need to be changed for the bzr version
  
  print ('sigma1 = %g' %l)
  print ('sigma2 = %g' %k)
  print ('sigma3 = %g\n' %m)
  print ('Computation in progress...')

  o.save('scene_init-%d.xml'%i) ## Changes are saved here before processing and then file is loaded 
  o.load('scene_init-%d.xml'%i)
  o.dt=1e-5
  o.run(Iter_Nbr) ## Choose a value of Iter_Nbr which ensures that the stability is reached
  o.wait()
  o.save('scene-final-%d.xml'%i) #(useless !??)
  
  ##Copying the last line of WallStresses-%i file created at each direction in the Dir_Analysis file
  filename = "WallStresses-%d"%i
  file = open(filename, "r")
  lines = file.readlines()
  ofile.write(lines[-1])
  file.close()

  o.reset() 
  i+=1

ofile.close()



Follow ups

References