Re: [Yade-users] [Question #680317]: different result after scenetostring

2019-06-11 Thread Launchpad Janitor
Question #680317 on Yade changed:
https://answers.launchpad.net/yade/+question/680317

Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

-- 
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 #680317]: different result after scenetostring

2019-05-26 Thread zhou qian
Question #680317 on Yade changed:
https://answers.launchpad.net/yade/+question/680317

Status: Solved => Open

zhou qian is still having a problem:
Hi:
I need to use JCFpmMat in my program.
I want to know if I use JCFpmMat with sceneToString, will it loss any 
parameters?
It seems there are't any read_only paras but I want to make sure it won't get 
wrong.
Yours,
Joe

-- 
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 #680317]: different result after scenetostring

2019-04-18 Thread zhou qian
Question #680317 on Yade changed:
https://answers.launchpad.net/yade/+question/680317

Status: Answered => Solved

zhou qian 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 #680317]: different result after scenetostring

2019-04-18 Thread Jan Stránský
Question #680317 on Yade changed:
https://answers.launchpad.net/yade/+question/680317

Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Joe,
nice finding.
The reason is that O.sceneToString only saves "python" variables, defined in 
YADE_CLASS_...macros.
CpmPhys has some read-only variables defined outside this macro [1] that are 
not saved and are reset by O.stringToScene.
You can try:
###
print max(i.phys.epsT.norm() for i in O.interactions)
print max(i.phys.sigmaT.norm() for i in O.interactions)
scene = O.sceneToString() !
O.stringToScene(scene) !
print max(i.phys.epsT.norm() for i in O.interactions)
print max(i.phys.sigmaT.norm() for i in O.interactions)

v2 = (trsf2-O.cell.trsf)/(500*O.dt)
O.cell.velGrad = v2
O.run(500,True)

print(O.cell.trsf)
print(utils.getStress())
print max(i.phys.shearForce.norm() for i in O.interactions) #!
###
if O.sceneToString() and O.stringToScene(scene) is used or not, the shear 
strain and shear forces and therefore stress are different.

A solution would be to change the source code and put all these variables to 
YADE_BASE...
To preserve the read-onlyness, probably Attr::readonly flag (similar to e.g. 
[2]) should be used.
So basically replacing
Real omega = 0
...
.def_readonly("omega",::omega,"...")
to
((Real,omega,0,Attr::readonly,"..."))

cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/blob/master/pkg/dem/ConcretePM.hpp#L145
[2] https://gitlab.com/yade-dev/trunk/blob/master/core/Scene.hpp#L78

-- 
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 #680317]: different result after scenetostring

2019-04-18 Thread zhou qian
New question #680317 on Yade:
https://answers.launchpad.net/yade/+question/680317

Hi:
I noticed that the results of my simulation is different if I use 
'scenetostring' and 'stringtoscene' (I also tested save and load). I generated 
a periotric cell and change to strain from (0,0,0,0,0,0,0,0,0) to 
(0,0,0,0,0,0,0,0,-0.2) to (0,0,0,0,0,0,0,0,-0.1). 
Here are my codes:

from libyade import yade
from yade import*
from yade import pack, Vector3, Vector3, utils
from minieigen import Vector3, Matrix3, Matrix6

def randomPeriPack(radius,initSize,seed):
O.switchScene(); O.resetThisScene()
sp=pack.SpherePack()
O.periodic=True
O.cell.setBox(initSize)
sp.makeCloud(Vector3().Zero,O.cell.refSize,radius,0.,-1,True,seed=seed)

O.engines=[ForceResetter(),InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=.05*radius),InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_FrictPhys_CundallStrack()]),PeriIsoCompressor(charLen=2*radius,stresses=[-100e9,-1e8],maxUnbalanced=1e-2,doneHook='O.pause();',globalUpdateInt=20,keepProportions=True),NewtonIntegrator(damping=.8)]

O.materials.append(FrictMat(young=30e9,frictionAngle=.1,poisson=.3,density=1e3))
for s in sp: O.bodies.append(utils.sphere(s[0],s[1]))
O.dt=utils.PWaveTimeStep()
O.timingEnabled=True
O.run(); O.wait()
for b in O.bodies: b.state.pos = O.cell.wrap(b.state.pos)
ret=pack.SpherePack()
ret.fromSimulation()
O.switchScene()
return ret

young = 4e6
O.materials.append(CpmMat(young=young,poisson=.2,epsCrackOnset=1e100,sigmaT=1e100,relDuctility=2))
sp = randomPeriPack(.01,.1*Vector3.Ones,10)
sp.toSimulation()
O.engines = [
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.5,label='is2aabb')],allowBiggerThanPeriod=True),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.5,label='ss2d3dg')],
[Ip2_CpmMat_CpmMat_CpmPhys()],
[Law2_ScGeom_CpmPhys_Cpm()]),
NewtonIntegrator(damping=.1),
]
O.dt = 0.
O.step()
O.dt = 0.0002
is2aabb.aabbEnlargeFactor = 1.
ss2d3dg.interactionDetectionFactor = 1.

Strain1 = Matrix3(0,0,0,0,0,0,0,0,-0.2)
Strain2 = Matrix3(0,0,0,0,0,0,0,0,-0.1)
I = Matrix3.Identity

trsf1 = Strain1+I
trsf2 = Strain2+I
v1 = (trsf1-O.cell.trsf)/(500*O.dt)
O.cell.velGrad = v1
O.run(500,True)

print(O.cell.trsf)

scene = O.sceneToString() !
O.stringToScene(scene) !

v2 = (trsf2-O.cell.trsf)/(500*O.dt)
O.cell.velGrad = v2
O.run(500,True)

print(O.cell.trsf)
print(utils.getStress())

If you run the script, I think the result of stress[8] should be -567126, and 
if you delete the scenetostring and stringtoscene, the result is -733878.  My 
yade version is 2017.01a. Maybe my yade version is relatively old??

Yours,
Joe

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