Re: [Yade-users] [Question #403663]: Modeling 2 materilas by CPM model

2016-11-22 Thread Jan Stránský
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Open => Answered

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

you should have one instance for each material, i.e.

mat1 = 
concreteId1 = O.materials.append(mat1) # not another CpmMat...

otherwise the matches does not work (mathes are based on mat.id, you can
try to print O.materials[1].id and mat2.id)
​
cheers
Jan

-- 
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 #403663]: Modeling 2 materilas by CPM model

2016-11-21 Thread Seti
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Answered => Open

Seti is still having a problem:
Hi Jan,


Thanks for your help, , in a sample with just two materials. I have done a 
series of parametric studies to understand how changing( say increasing) the 
percentage of material #1 has effect on the strength of sample.  By increasing 
the percentage of mat 1 ( %10, %30, %70) the strength of sample has been 
increased respectively. However when I increase the percentage of mat 1 to 90% 
I have drop in stress - strain curve ( strength even less that 30 %) 

Is there any issue with the script or there is a convergence problem
here?

Thanks so much for your help.


#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division

from yade import plot,pack,timing
import time, sys, os, copy

#import matplotlib
#matplotlib.rc('text',usetex=True)
#matplotlib.rc('text.latex',preamble=r'\usepackage{concrete}\usepackage{euler}')


"""
A fairly complex script performing uniaxial tension-compression test on 
hyperboloid-shaped specimen.
Most parameters of the model (and of the setup) can be read from table using 
yade-multi.
After the simulation setup, tension loading is run and stresses are 
periodically saved for plotting
as well as checked for getting below the maximum value so far. This indicates 
failure (see stopIfDamaged
function). After failure in tension, the original setup is loaded anew and the 
sense of loading reversed.
After failure in compression, strain-stress curves are saved via 
plot.saveGnuplot and we exit,
giving some useful information like peak stresses in tension/compression.
Running this script for the first time can take long time, as the specimen is 
prepared using triaxial
compression. Next time, however, an attempt is made to load 
previously-generated packing 
(from /tmp/triaxPackCache.sqlite) and this expensive procedure is avoided.
The specimen length can be specified, its diameter is half of the length and 
skirt of the hyperboloid is 
4/5 of the width.
The particle size is constant and can be specified using the sphereRadius 
parameter.
The 3d display has displacement scaling applied, so that the fracture looks 
more spectacular. The scale
is 1000 for tension and 100 for compression.
"""


# default parameters or from table
readParamsFromTable(noTableOk=True, # unknownOk=True,
young=30e9,
poisson=.2,

sigmaT=1.1e9,
frictionAngle=atan(.57),
epsCrackOnset=1e-4,
relDuctility=30,

intRadius=1.5,
dtSafety=.8,
damping=0.4,
strainRateTension=.1,
strainRateCompression=.1,
setSpeeds=True,
# 1=tension, 2=compression (ANDed; 3=both)
doModes=2,

specimenLength=.15,
sphereRadius=3.5e-3,

# isotropic confinement (should be negative)
isoPrestress=0,
)

from yade.params.table import *

if 'sigmaT=3.5e6, compression' in O.tags.keys():
O.tags['id']=O.tags['id']+O.tags['sigmaT=3.5e6, compression']


# make geom; the dimensions are hard-coded here; could be in param table if 
desired
# z-oriented hyperboloid, length 20cm, diameter 10cm, skirt 8cm
# using spheres 7mm of diameter
mat1=CpmMat(young=young,frictionAngle=atan(.32),poisson=poisson,density=4800,sigmaT=sigmaT,relDuctility=relDuctility,epsCrackOnset=epsCrackOnset,isoPrestress=isoPrestress)
mat2=CpmMat(young=30e9,frictionAngle=frictionAngle,poisson=poisson,density=4800,sigmaT=sigmaT,relDuctility=relDuctility,epsCrackOnset=epsCrackOnset,isoPrestress=isoPrestress)
concreteId1=O.materials.append(CpmMat(young=young,frictionAngle=atan(.32),poisson=poisson,density=4800,sigmaT=sigmaT,relDuctility=relDuctility,epsCrackOnset=epsCrackOnset,isoPrestress=isoPrestress))
concreteId2=O.materials.append(CpmMat(young=young,frictionAngle=frictionAngle,poisson=poisson,density=4800,sigmaT=sigmaT,relDuctility=relDuctility,epsCrackOnset=epsCrackOnset,isoPrestress=isoPrestress))
#sp=pack.randomDensePack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.17*specimenLength),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',returnSpherePack=True)

#
sp=pack.SpherePack()
pred=pack.inCylinder((0,0,0.002),(0,0,0.3),0.05)
O.bodies.append(pack.randomDensePack(pred,radius=0.008))

#pred=pack.inCylinder((0,0,0),(0,0,0.2),0.1)

#sp=pack.randomDensePack(pred,radius=0.002,material=concreteId)
#O.bodies.append(TS1)
##

#sp=pack.randomDensePack(pack.inAlignedBox((-.25*specimenLength,-.25*specimenLength,-.5*specimenLength),(.25*specimenLength,.25*specimenLength,.5*specimenLength)),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',returnSpherePack=True)


sp.toSimulation()

for b in O.bodies:
  if random.random() < 0.3:
b.mat = mat1
b.shape.color = (1,0,0)
  else:
b.mat = mat2
b.shape.color = (0,1,1)



Re: [Yade-users] [Question #403663]: Modeling 2 materilas by CPM model

2016-11-14 Thread Jan Stránský
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Open => Answered

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

for b in O.bodies:
>   if random.random() < 0.2:
> b.mat = mat1
> b.shape.color = (1,0,0)
>  elif random.random() < 0.1:
> b.mat = mat2
> b.shape.color = (0,1,0)


1) you should use only one random.random() call within the if-else structure
2) then you should use different numbers (if it was <0.2, else if <0.1 does
not make sense)

something like:

###
r = random.random()
if r < 0.2: ... # 0-20%, in total 20 %
else if r < 0.3: ... # 20%-30%, in total 10%
else if r < 0.6: ... # 30 % - 60%, in total 30%

###

cheers
Jan


2016-11-13 11:12 GMT+01:00 Seti :

> Question #403663 on Yade changed:
> https://answers.launchpad.net/yade/+question/403663
>
> Status: Solved => Open
>
> Seti is still having a problem:
> Hi Jan,
>
> Just a quick question, I am wondering to combine more materials in CPM
> model ( say 5 items), would you please advise me how I can specify the
> percentage of each material?
> My idea is as per below:
>
> ##
> from yade import pack
> import random
>
> mat1 = CpmMat() # ...
> mat2 = CpmMat() # ...
> mat3 = CpmMat() # ...
> mat4 = CpmMat() # ...
> mat5 = CpmMat() # ...
>
> sp = pack.randomDensePack(pack.inAlignedBox((0,0,0),(1,1,1)),
> radius=.05,spheresInCell=500,returnSpherePack=True)
> sp.toSimulation()
>
> for b in O.bodies:
>   if random.random() < 0.2:
> b.mat = mat1
> b.shape.color = (1,0,0)
>  elif random.random() < 0.1:
> b.mat = mat2
> b.shape.color = (0,1,0)
>  elif random.random() < 0.3:
> b.mat = mat3
> b.shape.color = (0,0,1)
>  elif random.random() < 0.2:
> b.mat = mat4
> b.shape.color = (1,1,0)
>   else:
> b.mat = mat5
>   b.shape.color = (0,1,1)
>
>
> Cheers,
> Seti
>
> --
> 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
>

-- 
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 #403663]: Modeling 2 materilas by CPM model

2016-11-13 Thread Seti
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Solved => Open

Seti is still having a problem:
Hi Jan,

Just a quick question, I am wondering to combine more materials in CPM model ( 
say 5 items), would you please advise me how I can specify the percentage of 
each material? 
My idea is as per below: 

##
from yade import pack
import random

mat1 = CpmMat() # ...
mat2 = CpmMat() # ...
mat3 = CpmMat() # ...
mat4 = CpmMat() # ...
mat5 = CpmMat() # ...

sp = pack.randomDensePack(pack.inAlignedBox((0,0,0),(1,1,1)),
radius=.05,spheresInCell=500,returnSpherePack=True)
sp.toSimulation()

for b in O.bodies:
  if random.random() < 0.2:
b.mat = mat1
b.shape.color = (1,0,0)
 elif random.random() < 0.1:
b.mat = mat2
b.shape.color = (0,1,0)
 elif random.random() < 0.3:
b.mat = mat3
b.shape.color = (0,0,1)
 elif random.random() < 0.2:
b.mat = mat4
b.shape.color = (1,1,0)
  else:
b.mat = mat5
  b.shape.color = (0,1,1)


Cheers,
Seti

-- 
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 #403663]: Modeling 2 materilas by CPM model

2016-10-31 Thread Seti
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Answered => Solved

Seti confirmed that the question is solved:
Thanks Jan Stránský, 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 #403663]: Modeling 2 materilas by CPM model

2016-10-31 Thread Jan Stránský
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Open => Answered

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

random.random() returns uniform distribution random number in the range
(0,1), so random.random()<0.2 means that 0.2=20/100=20% of spheres will
have mat1, the rest 80% mat2. You can use of course any other value than
0.2.

The indentation error comes from your script, probably from copy-paste
process. I will rewrite the code with only spaces (I used tabs originally)
co copy-paste again should work. Please try it and let us know.

##
from yade import pack
import random

mat1 = CpmMat() # ...
mat2 = CpmMat() # ...

sp = pack.randomDensePack(pack.inAlignedBox((0,0,0),(1,1,1)),
radius=.05,spheresInCell=500,returnSpherePack=True)
sp.toSimulation()

for b in O.bodies:
  if random.random() < 0.2:
b.mat = mat1
b.shape.color = (1,0,0)
  else:
b.mat = mat2
  b.shape.color = (0,1,1)
##

cheers
Jan


2016-10-31 13:23 GMT+01:00 Seti :

> Question #403663 on Yade changed:
> https://answers.launchpad.net/yade/+question/403663
>
> Status: Answered => Open
>
> Seti is still having a problem:
> Hi Jan,
>
> Thanks so much for your reply,  would you please let me know what is
> meaning of " if random.random() < 0.2:" commend in your example?
>
> I have tried  to do a quick test based on your recommendation, below
> error will be pop up related to  "if random.random() < 0.2:" line
>
> "IndentationError: expected an indented block"
>
>
> Cheers,
> Seti
>
> --
> 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
>

-- 
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 #403663]: Modeling 2 materilas by CPM model

2016-10-31 Thread Seti
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Answered => Open

Seti is still having a problem:
Hi Jan,

Thanks so much for your reply,  would you please let me know what is
meaning of " if random.random() < 0.2:" commend in your example?

I have tried  to do a quick test based on your recommendation, below
error will be pop up related to  "if random.random() < 0.2:" line

"IndentationError: expected an indented block"


Cheers,
Seti

-- 
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 #403663]: Modeling 2 materilas by CPM model

2016-10-31 Thread Jan Stránský
Question #403663 on Yade changed:
https://answers.launchpad.net/yade/+question/403663

Status: Open => Answered

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

something like this?
##
from yade import pack
import random

mat1 = CpmMat() # ...
mat2 = CpmMat() # ...

sp =
pack.randomDensePack(pack.inAlignedBox((0,0,0),(1,1,1)),radius=.05,spheresInCell=500,returnSpherePack=True)
sp.toSimulation()

for b in O.bodies:
if random.random() < 0.2:
b.mat = mat1
b.shape.color = (1,0,0)
else:
b.mat = mat2
b.shape.color = (0,1,1)
##

cheers
Jan


2016-10-31 12:14 GMT+01:00 Seti :

> New question #403663 on Yade:
> https://answers.launchpad.net/yade/+question/403663
>
> Hi All,
>
> I have the same question which has been asked in  Q # 372295. I really
> need to know how I can control the percentage of spheres when I am
> modelling  different materials through CPM model.
>
> Can you please shed some lights on this issue?
>
>
> Cheers,
> Seti
>
> --
> 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
>

-- 
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


[Yade-users] [Question #403663]: Modeling 2 materilas by CPM model

2016-10-31 Thread Seti
New question #403663 on Yade:
https://answers.launchpad.net/yade/+question/403663

Hi All,

I have the same question which has been asked in  Q # 372295. I really need to 
know how I can control the percentage of spheres when I am modelling  different 
materials through CPM model.

Can you please shed some lights on this issue? 


Cheers,
Seti

-- 
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