Re: [Yade-users] [Question #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread Jan Stránský
>
>
> could it be done using pyRunner somehow? To call function
> changeMaterial(), run for 50 iters, call changeMaterialBack() and continue
> untill pyRunner calls function again.
>

sure:

def changeMaterial():
   if O.iter % 1050 != 1000: return # do nothing at wrong iterations
   ...

def changeMaterialBack():
   if O.iter % 1050 != 0: return # do nothing at wrong iterations
   ...

O.engines = [
   ...
   PyRunner(iterPeriod=1,command="changeMaterial()", # iterPeriod is 1, but
the function itself determine if something needs to be done
   PyRunner(iterPeriod=1,command="changeMaterialBack()", # iterPeriod is 1,
but the function itself determine if something needs to be done
   ...
]


> I forgot to mention that I used similar approach, but my problem is that I
> don’t know  for how long my simulation is going to run, since I need to
> iterate until stop criterion isn’t met.
>

instead for loop you can use while loop:

while not someStopCondition():
   O.run(1000,True)
   changeMaterial()
   O.run(50,True)
   changeMaterialBack()

cheers
Jan
___
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 #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread Jan Stránský
Question #265693 on Yade changed:
https://answers.launchpad.net/yade/+question/265693

Jan Stránský proposed the following answer:
>
>
> could it be done using pyRunner somehow? To call function
> changeMaterial(), run for 50 iters, call changeMaterialBack() and continue
> untill pyRunner calls function again.
>

sure:

def changeMaterial():
   if O.iter % 1050 != 1000: return # do nothing at wrong iterations
   ...

def changeMaterialBack():
   if O.iter % 1050 != 0: return # do nothing at wrong iterations
   ...

O.engines = [
   ...
   PyRunner(iterPeriod=1,command="changeMaterial()", # iterPeriod is 1, but
the function itself determine if something needs to be done
   PyRunner(iterPeriod=1,command="changeMaterialBack()", # iterPeriod is 1,
but the function itself determine if something needs to be done
   ...
]


> I forgot to mention that I used similar approach, but my problem is that I
> don’t know  for how long my simulation is going to run, since I need to
> iterate until stop criterion isn’t met.
>

instead for loop you can use while loop:

while not someStopCondition():
   O.run(1000,True)
   changeMaterial()
   O.run(50,True)
   changeMaterialBack()

cheers
Jan

-- 
You received this question notification because you are a member of
yade-users, which 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 #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread velimier
Question #265693 on Yade changed:
https://answers.launchpad.net/yade/+question/265693

velimier posted a new comment:
Thanks for your answers,
could it be done using pyRunner somehow? To call function changeMaterial(), run 
for 50 iters, call changeMaterialBack() and continue untill pyRunner calls 
function again.
I forgot to mention that I used similar approach, but my problem is that I 
don’t know  for how long my simulation is going to run, since I need to iterate 
until stop criterion isn’t met.

-- 
You received this question notification because you are a member of
yade-users, which 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 #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread Jan Stránský
Question #265693 on Yade changed:
https://answers.launchpad.net/yade/+question/265693

Jan Stránský proposed the following answer:
Hi Veljko,

Luc's answer in python words

O.run(1000,True)
changeMaterial()
O.run(50,True)
changeMaterialBack()
O.run(1000,True)

you cold also do it in cycles:

for c in range(20):
O.run(1000,True)
changeMaterial()
O.run(50)
changeMaterialBack

also be careful with specific implementation of changeMaterial (yes/no
deleting interactions as changing particle material has no effect on
existing interactions and so on)

cheers
Jan


2015-04-22 16:16 GMT+02:00 Luc Sibille :

> Question #265693 on Yade changed:
> https://answers.launchpad.net/yade/+question/265693
>
> Status: Open => Answered
>
> Luc Sibille proposed the following answer:
> Hi
> I am not sure tu really understand... you can just do the following:
>
> 1/ Run simulation for 1000 iterations,
> 2/ change materials properties and contact physics (in agreement with
> material properties)
> 3/ Run simulation for 50 iterations,
> 4/ change materials properties and contact physics (in agreement with
> material properties)
> 5/ Run simulation for 1000 iterations,
>
> Best,
> Luc
>
> --
> You received this question notification because you are a member of
> yade-users, which 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
>

-- 
You received this question notification because you are a member of
yade-users, which 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 #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread Jan Stránský
Hi Veljko,

Luc's answer in python words

O.run(1000,True)
changeMaterial()
O.run(50,True)
changeMaterialBack()
O.run(1000,True)

you cold also do it in cycles:

for c in range(20):
O.run(1000,True)
changeMaterial()
O.run(50)
changeMaterialBack

also be careful with specific implementation of changeMaterial (yes/no
deleting interactions as changing particle material has no effect on
existing interactions and so on)

cheers
Jan



2015-04-22 16:16 GMT+02:00 Luc Sibille :

> Question #265693 on Yade changed:
> https://answers.launchpad.net/yade/+question/265693
>
> Status: Open => Answered
>
> Luc Sibille proposed the following answer:
> Hi
> I am not sure tu really understand... you can just do the following:
>
> 1/ Run simulation for 1000 iterations,
> 2/ change materials properties and contact physics (in agreement with
> material properties)
> 3/ Run simulation for 50 iterations,
> 4/ change materials properties and contact physics (in agreement with
> material properties)
> 5/ Run simulation for 1000 iterations,
>
> Best,
> Luc
>
> --
> You received this question notification because you are a member of
> yade-users, which 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
>
___
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 #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread Luc Sibille
Question #265693 on Yade changed:
https://answers.launchpad.net/yade/+question/265693

Status: Open => Answered

Luc Sibille proposed the following answer:
Hi
I am not sure tu really understand... you can just do the following:

1/ Run simulation for 1000 iterations,
2/ change materials properties and contact physics (in agreement with material 
properties)
3/ Run simulation for 50 iterations,
4/ change materials properties and contact physics (in agreement with material 
properties)
5/ Run simulation for 1000 iterations,

Best,
Luc

-- 
You received this question notification because you are a member of
yade-users, which 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


[Yade-users] [Question #265693]: Change sphere material for specific number of iterations and then restore previous one

2015-04-22 Thread velimier
New question #265693 on Yade:
https://answers.launchpad.net/yade/+question/265693

Hi,
here is my problem. I want to change sphere material in my simulation  (lets 
say) after every 1000 iterations, then to run simulation with new material for 
50 iterations  and finally to restore previous material and continue simulation 
for another 1000 iterations and so on. It's not how to change material, but how 
to achieve this 'timing ratio'. Any suggestions?

Veljko

-- 
You received this question notification because you are a member of
yade-users, which 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 #265223]: Unrealistic result of the “TesselationWrapper”

2015-04-22 Thread Shenyang Cai
Question #265223 on Yade changed:
https://answers.launchpad.net/yade/+question/265223

Status: Answered => Open

Shenyang Cai is still having a problem:
Hi Bruno,

I believe that I have misinterpreted the usage of "TesselationWrapper"
in the user's manual. I have posted my script If you are still
interested in helping me out.


from yade import pack
import math

#setting frict materials -
fyoung = 8e9
fpoisson = 0.25
frictAng = math.atan(0.6)
fden = 2500

#setting rock materials -
ryoung = 2e7
rpoisson = 0.25
rfrictAng = math.atan(0.6)
reps = 0.06
rden = 2500


frict = O.materials.append(FrictMat(young = fyoung,
poisson = fpoisson,
frictionAngle = frictAng,
density = fden))


rock = O.materials.append(CpmMat(young = ryoung,
  poisson = rpoisson,
  frictionAngle = rfrictAng,
  epsCrackOnset = reps,
  density = rden,
  relDuctility = 0))


#building boxes -
box_length = 200.0
box_height = 80.0
box_depth = 4.8

box = geom.facetBox((box_length/2, box_depth/2, box_height/2),
(box_length/2, box_depth/2, box_height/2),
wallMask = 30,
material = frict)

wall = utils.wall((0, box_depth/2, box_height/2), axis = 0, material = frict)

O.bodies.append(box)
O.bodies.append(wall)

#adding deposit -
pred = pack.inAlignedBox((0,0,0),(box_length, box_depth, 20))
spheres = pack.regularOrtho(pred, radius = 0.75, gap = 0)
s = O.bodies.append(spheres)

for i in s:
O.bodies[i].material = O.materials[rock]


#defining engines -
checkPeriod = 100
savePeriod = 5000 # save files for every iterPeriod steps
thres = 500 #start simulation after this iter
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()], verletDist = 0),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_CpmMat_CpmMat_CpmPhys(cohesiveThresholdIter = thres), 
Ip2_FrictMat_CpmMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack(), Law2_ScGeom_CpmPhys_Cpm()],
),

NewtonIntegrator(damping = 0.3, gravity = (0, 0, -9.81)),
PyRunner(command = 'startPushing()', iterPeriod = checkPeriod, label = 
'controller'),
]

O.dt = 0.2 *utils.PWaveTimeStep()

TW = TesselationWrapper()
TW.triangulate()
TW.computeVolumes()

#pushing stage -
v = 0.2
def startPushing():
if O.iter < thres: # if the step has not reached "thres", we do nothing
return
TW.setState(0) # set initial configuration for the definition of 
displacement increments
wall.state.vel = Vector3(v, 0, 0)
controller.command = 'stopSimulation()'


def stopSimulation():
l = wall.state.pos[0]
 
if (O.iter- thres) % savePeriod == 0: #for every "savePeriod" steps we 
write an file of strain
TW.setState(1)
TW.defToVtk( "%.2f%%.vtk" % ((l/box_length)*100) ) #write the 
percentage of shortening in file names


if l > 0.5 * box_length:
O.pause()


I don't know if I put the "TesselationWrapper" in the right way and my 
paraview(4.0.1, 64bit for Linux) always crushes when trying to open those VTK 
files.
Thanks!

-- 
You received this question notification because you are a member of
yade-users, which 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