Re: [Yade-users] [Question #688837]: calculate the mass of the particles

2020-02-17 Thread Estefany Carmona Alvarez
Question #688837 on Yade changed:
https://answers.launchpad.net/yade/+question/688837

Description changed to:
I have generated a code for the simulation of the sand free fall.

This simulation consists of dropping the spheres that simulate the sand,
so that they are deposited inside two cylindrical vessels. As a result
of this simulation I need to obtain the weight or mass of the particles
that remain within each cylinder.

In the Yade documentation that I have consulted, I saw that the
state.mass function fulfills this need, but since I do not have enough
domain in this programming language, I needed to know if anyone has any
example of how to use this code or if they have more information ...

I appreciate your collaboration


The code I am using is as follows:
postscript: the code comments are in Spanish (Latin)


from yade import pack, plot

#Altura de caida del material
hc=0

#EQUIPO

#coordenadas centro
x=0
y=0
z=0

#coordenadas extension

f=0.45
a=0.50
h=1


#estrutura del equipo de pluviacion 
O.bodies.append(geom.facetBox((x,y,z),(f,a,(h+hc)),wallMask=31,wire=True))

#Mallas
#O.bodies.append(utils.wall((0,0,(.2+hc)),axis=2,color=(1,0.945,0.078),sense=-1))

#(0,0,(.2+hc)),axis=2,color(1,0.945,0.078),sense=0))


  #O.bodies.append(utils.wall((0,0,.2),axis=2,sense=0))

#PROBETA

#Radio
radius=0.05

#Altura de la probeta
height=0.1

#Probeta 1
#Coordenadas centro
xp1=0.1
yp1=0
zp1=1

O.bodies.append(geom.facetCylinder((xp1,yp1,(-zp1-hc+(height/2))),
radius=radius, height=height, fixed=True, wallMask=6,
color=(0.933,0.090,.894), wire=False))

#Probeta 2
#Coordenadas centro
xp2=0.1
yp2=0
zp2=1

O.bodies.append(geom.facetCylinder((-xp2,yp2,(-zp2-hc+(height/2))),
radius=radius, height=height, fixed=True, wallMask=6, color=(0,0,1),
wire=False))


#coordenadas perimetro de particulas
#esquina inferior
xi=0.225
yi=0.225
zi=0.2

#esquina superior
xs=0.225
ys=0.25
zs=0.5

#porosidad 
p=0.903

#tamices
#los diametrso y los porcentajes acumulados siempre se deben ubicar de menor a 
mayor
#por cada t debe haber un p

#Diametro de la abertura de tamices psdSizes
t1=0.008
t2=0.015
t3=0.030
t4=0.085
t5=0.200
t6=0.475

#Porcentajes retenidos del material psdCumm
p1=0
p2=0.002
p3=0.111
p4=0.889
p5=0.9994
p6=1

#Material 
#angulo de friccion 
angulo=radians(36) #radianes
#densidad del material
densidad=1418 #(kg/m3)
#Modulo de Young
young=(1e8) #Pa
#Poisson
poisson=0.5
#contenidod de vacios 
porosidad=0.9
#Algoritmo YADE para el material
snd=O.materials.append(FrictMat(young=young,frictionAngle=radians(angulo),density=densidad,
#label="SndG"
))

#Algoritmo YADE para el cuerpo de las esferas

sp=pack.SpherePack()

sp.makeCloud((xi,-yi,(zi+hc)), (-xs,ys,(zs+hc)), porosity=porosidad,
psdSizes=[t1,t2,t3,t4,t5,t6], psdCumm=[p1,p2,p3,p4,p5,p6],
distributeMass=False)


sp.toSimulation(material=snd,color=(0.882,0.866,0.839))

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),
Bo1_Facet_Aabb(),
Bo1_Cylinder_Aabb(),
Bo1_Wall_Aabb()
]),
InteractionLoop(
# handle sphere+sphere and facet+sphere collisions

[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
#GravityEngine(gravity=(0,0,-9.81)),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
PyRunner()
]
O.dt=PWaveTimeStep()

-- 
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 #688837]: calculate the mass of the particles

2020-02-17 Thread Estefany Carmona Alvarez
New question #688837 on Yade:
https://answers.launchpad.net/yade/+question/688837

I have generated a code for the simulation of the sand free fall.

This simulation consists in dropping the spheres that simulate the sand as a 
result of the material, so that they are deposited inside two cylindrical 
containers. As a result of this simulation I need to obtain the weight or mass 
of the particles that remain within each cylinder.

In the Yade documentation that I have consulted, I saw that the state.mass 
function fulfills this need, but since I do not have enough domain in this 
programming language, I needed to know if anyone has any example of how to use 
this code or if they have more information ...

I appreciate your collaboration

-- 
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 #688837]: calculate the mass of the particles

2020-02-17 Thread Estefany Carmona Alvarez
Question #688837 on Yade changed:
https://answers.launchpad.net/yade/+question/688837

Description changed to:
I have generated a code for the simulation of the sand free fall.

This simulation consists of dropping the spheres that simulate the sand,
so that they are deposited inside two cylindrical vessels. As a result
of this simulation I need to obtain the weight or mass of the particles
that remain within each cylinder.

In the Yade documentation that I have consulted, I saw that the
state.mass function fulfills this need, but since I do not have enough
domain in this programming language, I needed to know if anyone has any
example of how to use this code or if they have more information ...

I appreciate your collaboration

-- 
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 #688690]: pack.SpherePack.save() function saved particles data format

2020-02-17 Thread gaoxuesong
Question #688690 on Yade changed:
https://answers.launchpad.net/yade/+question/688690

Status: Answered => Solved

gaoxuesong confirmed that the question is solved:
I have tried and removed the '\r' following your method.

Thanks Jan. Your instructions are really helpful.

-- 
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 #688789]: How to restart a simulation from a saved point with restoring geometry movement?

2020-02-17 Thread gaoxuesong
Question #688789 on Yade changed:
https://answers.launchpad.net/yade/+question/688789

Status: Answered => Solved

gaoxuesong confirmed that the question is solved:
Hi Jan,

Thank you very much. Yes, you are right. The simulation will proceed if
i use the original O.engines.

I've got some tips:
1. There's no need to save the ids of the facets binded to a movement engine. 
Even though i can not get the ids in the restart simulation, the engine knows 
those facets. 
2. The functions invoked by PyRunner should be included in the restart python 
script and they can be modified. 
3.  The arguments in Rotation and Translation engine should be assigned 
explicitly when updated. 

Thanks.

-- 
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 #688690]: pack.SpherePack.save() function saved particles data format

2020-02-17 Thread Jan Stránský
Question #688690 on Yade changed:
https://answers.launchpad.net/yade/+question/688690

Jan Stránský proposed the following answer:
> on Windows 10

^M, carriage return, \n\r... is a "windows newline character" (big
quotation marks). Usually it is OK, but sometimes you might meet a
problem.

> what does the '/\r//' mean in your command?

's/\r//'
= replace string between first slashes with string between second slashes
= replace \r with nothing = remove \r (carriage return)

> Which editor can show the carriage return symbols, such as '^M'?

e.g. vim. Open a file and run
:e ++ff=unix
I am sure emacs can do it, too.

> but there is no format error.

it is not an error, just the newline symbols are different. Text editors should 
have no problem.
But, obviously, SpherePack.load does not count with it.

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 #688763]: ossillation_rotation

2020-02-17 Thread nobody
Question #688763 on Yade changed:
https://answers.launchpad.net/yade/+question/688763

Status: Answered => Open

nobody is still having a problem:
Hi Jan,

as you mentioned, I just change the elif to else:

###
def ossillation_rotation():
for b in O.bodies:
if isinstance(b.shape,Facet):
rotationAngle = b.state.rot().norm()
if rotationAngle > 0  and rotationAngle <= math.pi:
cylinderRot.angularVelocity=rate
coneRot.angularVelocity=rate
else:
cylinderRot.angularVelocity=-1*rate
coneRot.angularVelocity=-1*rate


even if I use this, the shaft still rotates in one direction.

best,
Yong

-- 
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 #688690]: pack.SpherePack.save() function saved particles data format

2020-02-17 Thread gaoxuesong
Question #688690 on Yade changed:
https://answers.launchpad.net/yade/+question/688690

gaoxuesong posted a new comment:
Which editor can show the carriage return symbols, such as '^M'? 
I have opened the translated file using the Ubuntu default editor but there is 
no format error.

-- 
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 #688690]: pack.SpherePack.save() function saved particles data format

2020-02-17 Thread gaoxuesong
Question #688690 on Yade changed:
https://answers.launchpad.net/yade/+question/688690

gaoxuesong posted a new comment:
Hi Jan,

I use a Spyder editor integrated in Anaconda on Windows 10 to
conduct the translation code. By the way, what does the '/\r//' mean in
your command?

Thanks.

-- 
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 #688763]: ossillation_rotation

2020-02-17 Thread Jan Stránský
Question #688763 on Yade changed:
https://answers.launchpad.net/yade/+question/688763

Status: Open => Answered

Jan Stránský proposed the following answer:
>   if rotationAngle > 0 and rotationAngle <= math.pi:
>   elif rotationAngle > 0 and rotationAngle <= math.pi:

still the same, you have an if condition and exactly the same elif condition. 
It does not make sense.
If the condition is met, the first if branch is executed and and nothing else.
If the condition is not met, nor it is in elif.
Result = the code in elif branch (setting -1*rate) is NEVER executed -> the 
rate is never switched, resulting in "the shaft still rotates in one direction".

why not simply else instead of elif? is there any other option?

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 #688763]: ossillation_rotation

2020-02-17 Thread nobody
Question #688763 on Yade changed:
https://answers.launchpad.net/yade/+question/688763

Status: Needs information => Open

nobody gave more information on the question:
hi Jan,

here is the code:
###
from yade import ymport
from yade import pack,export,geom
import itertools
from numpy import *
import numpy as np
from yade import plot, export, utils
import math
target=0.12
young=4e8
finalcompFricDegree=19.5
rate = 10*(2*pi/60)
# sphere particles material 
properties 
sphereMat=O.materials.append(CohFrictMat(young=young,poisson=0.3,frictionAngle=radians(finalcompFricDegree),isCohesive=False,alphaKr=0.2,alphaKtw=0,etaRoll=0.5,momentRotationLaw=True,density=2648))
#O.bodies.append(ymport.text("rotation.txt",material = sphereMat))
O.bodies.append([
sphere((0.1,0.1,0.1),.03,color=(0,1,0)),
])
 create the penetrator and 
shaft and the cylinder ##
facetMat=O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=radians(finalcompFricDegree),density=0))
O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=0,density=0,label='walls'))

#facets =
O.bodies.append(geom.facetCylinder((200e-3,200e-3,300e-3),200e-3,600e-3,wallMask=6,material='walls',segmentsNumber=100))

x0=0.2;y0=0.2;z0=0.39665
cylinderIDS= O.bodies.append(geom.facetCylinder((x0,y0,z0-0.02),
radius=0.0125,height=0.15,orientation=Quaternion((0, 0, 1), 
0),wallMask=5,segmentsNumber=10, angleRange=None,material=facetMat))
coneIDS= O.bodies.append(geom.facetCone((x0,y0,z0-0.085825-0.02),

radiusTop=0.0125,radiusBottom=0.0,height=0.02165,orientation=Quaternion((0, 0, 
1), 0),wallMask=6,segmentsNumber=10, angleRange=None,material=facetMat))
cylinder =O.bodies[-2].id
conecheck=O.bodies[-1].id
  set the global engine for the 
simulation##
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom()],

[Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],

[Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True,label='cohesiveLaw')]
),

GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.8),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.7),

HelixEngine(angularVelocity=rate,linearVelocity=-0.05,rotateAroundZero=True,zeroPoint=(x0,y0,z0),rotationAxis=(0,0,1),ids=cylinderIDS,label
 ="cylinderRot"),

HelixEngine(angularVelocity=rate,linearVelocity=-0.05,rotateAroundZero=True,zeroPoint=(x0,y0,z0),rotationAxis=(0,0,1),ids=coneIDS,label
 = "coneRot"),
PyRunner(command='stop_loading()',iterPeriod=1),
PyRunner(command ="ossillation_rotation()",iterPeriod = 10),
]

def ossillation_rotation():
for b in O.bodies:
if isinstance(b.shape,Facet):
rotationAngle = b.state.rot().norm()
if rotationAngle > 0  and rotationAngle <= math.pi:
cylinderRot.angularVelocity=rate
coneRot.angularVelocity=rate
elif rotationAngle > 0  and rotationAngle <= math.pi:
cylinderRot.angularVelocity=-1*rate
coneRot.angularVelocity=-1*rate
## stop the simulation 
###
def stop_loading():
if 
((O.bodies[conecheck].state.pos[2]-O.bodies[conecheck].state.refPos[2])*(-1))>target:
O.pause()
#O.run()
#O.saveTmp()

it still rotates in one direction.

best,
Yong

-- 
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 #688763]: ossillation_rotation

2020-02-17 Thread Jan Stránský
Question #688763 on Yade changed:
https://answers.launchpad.net/yade/+question/688763

Status: Open => Needs information

Jan Stránský requested more information:
> I change the code as you mentioned.

please provide the code

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 #688685]: permeability - PFV

2020-02-17 Thread Othman Sh
Question #688685 on Yade changed:
https://answers.launchpad.net/yade/+question/688685

Status: Answered => Open

Othman Sh is still having a problem:
It make sense to me. But when I tried it still I got errors. So I went
back to the oedometer code [1] and removed the triax part and reduced
the code to just permeability. I realized that it will work until I
remove the walls surrounding the packing. If I remove the walls and set
flow.boundaryUseMaxMin=[1,1,1,1,1,1] then it will give me this error

negative volume for an ordinary pore (temp warning, should still be safe)
*** stack smashing detected ***:  terminated
Aborted (core dumped)

Any idea why?


So now the code below  with the aabbWalls works fine (although the 
averageVelocity() results is super high!). 

Do you think that having a box (6 walls) surrounding a cylindrical
sphere packing will give different results than if the cylindrical
sphere packing was surrounded by a cylindrical wall?


Thanks,
Othman

[1] 
https://github.com/yade/trunk/blob/master/examples/FluidCouplingPFV/oedometer.py
---
# -*- coding: utf-8 -*-


from __future__ import print_function
from builtins import range
from yade import pack, ymport
radiuscyl=.08
heightcyl=.25
dP=4e3 #Pa
visc=1e-3 #Pa.sec
density=1000 #kg/m3
g=9.81 #m/s2

young=1e6

mn,mx=Vector3(0.12051283763637842,0.12120598296516694,0.18575942022891825),Vector3(0.2788652537183969,0.27855505606930653,0.24827692256149453)
# corners of the box that contain the packing. Obtained from aabbExtrema

O.materials.append(FrictMat(young=young,poisson=0.2,density=1900,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)
yade.qt.View()

# spheres #
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(.4,.4,2),rMean=0.0083,rRelFuzz=0.1,seed=1)
### cylinder extraction 

pred=pack.inCylinder((.2,.2,0),(.2,.2,heightcyl),radiuscyl) 

spFilter=filterSpherePack(pred,sp,Material=Material, returnSpherePack=True) 

spFilter.toSimulation()

Height=max(utils.aabbDim())

#Fix all particles in their positions. No deformation
for i in O.bodies:
i.state.blockedDOFs='xyzXYZ'

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],label="iloop"
),
FlowEngine(dead=1,label="flow"),#introduced as a dead engine for the 
moment, see 2nd section

GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
NewtonIntegrator(damping=0.2)
]


#B. Activate flow engine and set boundary conditions in order to get 
permeability
flow.dead=0
flow.useSolver=3
flow.permeabilityFactor=1
flow.viscosity=visc
flow.bndCondIsPressure=[0,0,0,0,1,1]
flow.bndCondValue=[0,0,0,0,0,dP]
flow.boundaryUseMaxMin=[0,0,0,0,1,1]
O.dt=0.1e-8
O.dynDt=False

O.run(1,1)

Q=max(flow.averageVelocity())
Permeability=abs((density*g*Q*Height)/dP)
print ("average velocity: ",Q, "Permeability m/s: ",Permeability,"Permeability 
in/hr: ", Permeability*141732)

-- 
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 #688763]: ossillation_rotation

2020-02-17 Thread nobody
Question #688763 on Yade changed:
https://answers.launchpad.net/yade/+question/688763

Status: Answered => Open

nobody is still having a problem:
Hi Jan,

sorry for the late reply!

I change the code as you mentioned.
But it still doesn't work. the shaft still rotates in one direction. I think 
this is related to the reference orientation. 
under the elif condition.


if condition:
   cylinderRot.angularVelocity=rate
elif theSameCondition:
   cylinderRot.angularVelocity=-1*rate
If the reference orientation didn't change, for example, when the shaft rotates 
200 degrees, if the elif condition work, the shaft will rotate in another 
direction, maybe with one timestep, the rotation angle will again be 200 
degrees. so, we can't see the shaft rotates in another direction.

best,
Yong

-- 
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 #688652]: CpmMat elastic calibration difficulty

2020-02-17 Thread Jan Stránský
Question #688652 on Yade changed:
https://answers.launchpad.net/yade/+question/688652

Status: Open => Answered

Jan Stránský proposed the following answer:
I could not reproduce the problem. Using plain yade and yade-batch
yielded almost the same results.. Are you sure your script and analyzed
data are consistent?

almost = do not use realPeriod if you expect exactly the same results
(as each run it is executed at different times), use iterPeriod or
virtPeriod instead

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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Jan Stránský
Question #688822 on Yade changed:
https://answers.launchpad.net/yade/+question/688822

Status: Open => Answered

Jan Stránský proposed the following answer:
well, it is not tough (MWE below, probably could be simplified by a 
meshing/triangulation library)
I just found it unnecessary without enough information
cheers
Jan

###
import stl # pip install stl

class Triangle:
   def __init__(self,p1,p2,p3):
  self.points = [Vector3(p) for p in (p1,p2,p3)]
   def scale(self,factor):
  self.points = [p*factor for p in self.points]
  return self
   def shift(self,v):
  self.points = [p+v for p in self.points]
  return self
   def refine(self): # split 1 triangle into 4
  p1,p2,p3 = self.points
  p4 = (.5*(p1+p2)).normalized()
  p5 = (.5*(p2+p3)).normalized()
  p6 = (.5*(p3+p1)).normalized()
  return [
 Triangle(p1,p4,p6),
 Triangle(p2,p5,p4),
 Triangle(p3,p6,p5),
 Triangle(p4,p5,p6),
  ]
   def toStlFacet(self):
  minieigen2stl = lambda v: stl.Vector3d(*tuple(v))
  p1,p2,p3 = self.points
  normal = (p2-p1).cross(p3-p1).normalized()
  normal = minieigen2stl(normal)
  vertices = [minieigen2stl(p) for p in self.points]
  return stl.Facet(normal,vertices)
   
def triangulateUnitSphere(): # octahedron, you can use whatever instead, e.g. 
icosahedron
   xm,xp = [(v,0,0) for v in (-1,+1)]
   ym,yp = [(0,v,0) for v in (-1,+1)]
   zm,zp = [(0,0,v) for v in (-1,+1)]
   return [
  Triangle(xp,yp,zp),
  Triangle(xm,yp,zp),
  Triangle(xp,ym,zp),
  Triangle(xm,ym,zp),
  Triangle(xp,yp,zm),
  Triangle(xm,yp,zm),
  Triangle(xp,ym,zm),
  Triangle(xm,ym,zm),
   ]

def triangulateOneSphere(sph,smooth=1):
   ret = triangulateUnitSphere()
   #
   for ismooth in range(smooth):
  ret2 = []
  for t in ret:
 ret2.extend(t.refine())
  ret = ret2
   #
   c = sph.state.pos
   r = sph.shape.radius
   for t in ret:
  t.scale(r).shift(c)
   #
   return ret

def triangulateSpheres(smooth=1):
   ret = []
   for b in O.bodies:
  if not isinstance(b.shape,Sphere): continue
  ret.extend(triangulateOneSphere(b,smooth))
   return ret

def spheres2stl(fName,smooth=1):
   triangles = triangulateSpheres(smooth)
   triangles = [t.toStlFacet() for t in triangles]
   solid = stl.Solid()
   solid.facets = triangles
   with open(fName,"w") as f:
  solid.write_ascii(f)

O.bodies.append((
   sphere((0,0,0),1),
   sphere((5,4,3),2),
   sphere((0,1,4),3),
))

spheres2stl("sphs.stl")
spheres2stl("sphs-smooth.stl",smooth=3)
###

-- 
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 #688826]: Installation on Centos 7

2020-02-17 Thread Robert Caulk
Question #688826 on Yade changed:
https://answers.launchpad.net/yade/+question/688826

Status: Open => Answered

Robert Caulk proposed the following answer:
Hello,

It is possible [1], but requires a relatively good handle on the
compilation and linking of third party libraries in linux as well as the
compilation of yade itself. In comparison to ubuntu where you simply
type apt-get install yade :-).

Cheers,

Robert

[1]https://answers.launchpad.net/yade/+question/687614

-- 
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 #688826]: Installation on Centos 7

2020-02-17 Thread Jinny Kim
New question #688826 on Yade:
https://answers.launchpad.net/yade/+question/688826

To whom it may concern,

I want to install Yade on Centos 7, but I am not sure if it is possible. 
Because as far as I understand, Yade is supported by only Ubuntu and Debian. 
Can anyone help me to install Yade on Centos7? Thank you for your help in 
advance.

Sincerely,

-- 
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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Rioual
Question #688822 on Yade changed:
https://answers.launchpad.net/yade/+question/688822

Status: Answered => Open

Rioual is still having a problem:
Dear Jan,

- My problem is related to the problem of evaporation dynamics in a porous 
material made with Yade so Comsol is indeed relevant.
- Maybe i will have to find another way to treat the problem from the 
coordinates and radii of the spheres calculated in Yade if making a stl file is 
too tough

Thank you for your input,

V.

-- 
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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Jan Stránský
Question #688822 on Yade changed:
https://answers.launchpad.net/yade/+question/688822

Jan Stránský proposed the following answer:
> - How do you triangulate the spherical packing ??

depending on the meaning of a question:

1) triangulate it such that it suits your needs in comsol

2)
def triangulateOneSphere(b):
   ...
   return triangles
triangles = [triangulateOneSphere(b) for b in O.bodies]

triangulateOneSphere: google "sphere triangulation", depends on how fine
you want/need the triangulation

> - "save triangles": do you mean i have to build by hands the stl file
as explained in wikipedia i.e. save as a "built up" text file ???

yes. There might be some python stl library for easier processing

Before continuing:
- why do you want to use comsol (what is the background)? is there an 
alternative, like Paraview?
- is there another file format / method you can use more naturally (than 
triangulating spheres)? Like [1]?

cheers
Jan

https://www.comsol.com/forum/thread/211861/input-geometry-from-
coordinates

-- 
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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Robert Caulk
Question #688822 on Yade changed:
https://answers.launchpad.net/yade/+question/688822

Status: Open => Answered

Robert Caulk proposed the following answer:
gmsh is one option [1]

[1]http://gmsh.info/

-- 
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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Rioual
Question #688822 on Yade changed:
https://answers.launchpad.net/yade/+question/688822

Status: Answered => Open

Rioual is still having a problem:
Hello Jan,

Thanks for your reply but:

- How do you triangulate the spherical packing ??

- "save triangles": do you mean i have to build by hands
 the stl file as explained in wikipedia i.e. save as a "built up"
 text file ???

Best wishes,

V.

-- 
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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Jan Stránský
Question #688822 on Yade changed:
https://answers.launchpad.net/yade/+question/688822

Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

If it is possible (I don't know comsol), use the spherical data (center
+ radius).

STL [1] is a file format for triangulated surfaces. So if you need to use STL:
- triangulate the spherical packing
- save triangles in a .stl file [1]

cheers
Jan

[1] https://en.wikipedia.org/wiki/STL_(file_format)

-- 
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 #688345]: Precrack

2020-02-17 Thread Robert Caulk
Question #688345 on Yade changed:
https://answers.launchpad.net/yade/+question/688345

Robert Caulk posted a new comment:
To add to Jèrôme: isCohesive=False means there can be frictional
contact, but not cohesive contact. The only time a bond will truly
disappear is if the particles are not frictionally in contact with one
another because they have moved normally away from one another (tensile
break).

-- 
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 #688822]: Exporting a packing geometry made in yade in a stl format

2020-02-17 Thread Rioual
New question #688822 on Yade:
https://answers.launchpad.net/yade/+question/688822

Hello,

I would like to export a packing geometry of spheres created in yade to a .stl 
format in order to open it
 and read it in a second stage with comsol.
How can I do that ??

Thanks,

Vincent

-- 
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 #688345]: Precrack

2020-02-17 Thread Jérôme Duriez
Question #688345 on Yade changed:
https://answers.launchpad.net/yade/+question/688345

Status: Open => Answered

Jérôme Duriez proposed the following answer:
>  I noticed that the nodes are still bonded

How did you notice it, and what do you call exactly a "bond" ?

If a "bond" is a cohesive interaction (with eg a tensile threshold),
Robert's answer should most probably do the trick.

If you call a "bond" any kind of interaction, whatever its local strength 
properties, then what you want is to delete interaction, probably.
O.interactions.erase(), see [*], might help, though a thorough understanding of 
YADE interaction logic would help for proper use.


PS: GUI inspector is great. Python functions such that O.interactions.has or 
O.interactions.withBody are even better ! See [*]

[*] https://yade-dem.org/doc/yade.wrapper.html#interactioncontainer
[**] https://yade-dem.org/doc/user.html#creating-interactions, at least

-- 
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 #688791]: Unable to locate NewtonIntegrator within O.engines.

2020-02-17 Thread Jérôme Duriez
Question #688791 on Yade changed:
https://answers.launchpad.net/yade/+question/688791

Status: Needs information => Answered

Jérôme Duriez proposed the following answer:
As the error says, you are using a >0 value for
InsertionSortCollider.verletDist. Whereas the source code [*] requires
(for an efficient approximate collision detection ?) NewtonIntegrator to
belong to O.engines, which you decided against.

[*] see this if-block at https://gitlab.com/yade-
dev/trunk/-/blob/master/pkg/common/InsertionSortCollider.cpp#L393 ---
sorry I do not warranty this version is exactly the one of your YADE
2018.02b version

-- 
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 #688652]: CpmMat elastic calibration difficulty

2020-02-17 Thread Mumić
Question #688652 on Yade changed:
https://answers.launchpad.net/yade/+question/688652

Status: Answered => Open

Mumić is still having a problem:
Greetings!

The text on params.txt can be found below:

young poisson
660 0.1

Thank you!

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