calculate external work in Uniaxial Strainer
Hello Yade users !
I try to calculate the external work on a sample in tensile test.
In fact, i calculate the external work with this simple formulate
"Wext_increment
I want to integrate this formulate in the sources UniaxialStraine
In uniaxialStraine
In order to verify the behavior of incremental displacement, i define "dAX" in uniaxialStraine
((Real,
My problem is that in the simulation of tensile test , dAX=0 during the simulation.
I call dAX in the python script strainer.dAX
I don't understand where is the problem.
https:/
https:/
Best regards.
Jabrane.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Hello,
You tried to modify the source code, that's it ? Did you also modify UniaxialStraine
As a side note, did you consider to use TriaxialStressC
https:/
Jerome
Revision history for this message
|
#2 |
Hi Jabrane,
you came to c++ variables and scopes [2].
to get correct behavior, one option is to change the declaration of dAX
[1]. Currently (Real dAX=....) it creates a new variable, unrelated to
strainer.dAX.
Just delete Real (i.e. assign directly dAX=...) and then dAX refers to the
class member strainer.dAX.
Another option is leave it as it is and add
this->dAX = dAX;
somewhere after dAX is computed.
cheers
Jan
[1]
https:/
[2]
http://
2016-06-14 17:37 GMT+02:00 Yor1 <email address hidden>:
> New question #295301 on Yade:
> https:/
>
> Hello Yade users !
>
> I try to calculate the external work on a sample in tensile test.
> In fact, i calculate the external work with this simple formulate
> "Wext_increment
> I want to integrate this formulate in the sources UniaxialStraine
> In uniaxialStraine
> named "dAX".
> In order to verify the behavior of incremental displacement, i define
> "dAX" in uniaxialStraine
> ((Real,
> UniaxialStraine
>
> My problem is that in the simulation of tensile test , dAX=0 during the
> simulation.
> I call dAX in the python script strainer.dAX
> I don't understand where is the problem.
>
> https:/
> https:/
>
> Best regards.
> Jabrane.
>
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#3 |
Hello Jerome and Jan
Thank you of your response.
Jerome, I simulate the tensile test with TriaxialStressC
I get sigma=sigma2=
Jan, your solution work but i can't have a definitive opinion until i calculate Wext.
But i have a question how do you know that dAX is a local variable ?
Best regards.
Jabrane.
Revision history for this message
|
#4 |
Hi Jabrane,
But i have a question how do you know that dAX is a local variable ?
it just comes from how C++ works / is defined, nothing else.
"Real dAX" in cpp file inside a function simply declares a local variable.
No matter if the class has a member with the same name.
cheers
Jan
2016-06-14 19:37 GMT+02:00 Yor1 <email address hidden>:
> Question #295301 on Yade changed:
> https:/
>
> Yor1 posted a new comment:
> Hello Jerome and Jan
>
> Thank you of your response.
>
> Jerome, I simulate the tensile test with TriaxialStressC
> positive strainRate but i doesn't work.
> I get sigma=sigma2=
>
> Jan, your solution work but i can't have a definitive opinion until i
> calculate Wext.
> But i have a question how do you know that dAX is a local variable ?
>
> Best regards.
> Jabrane.
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#5 |
Hello Jan,
The behavior of dAX is related to the line in which i put "this->dAX = dAX"
In fact i put "this->dAX = dAX" just after https:/
and just after https:/
The question is where do I put "this->dAX = dAX" to get the real behavior?
Best regards.
Jabrane.
Revision history for this message
|
#6 |
Hi Jabrane,
you should put "this->dAX = dAX" to a place such that dAX is not changed
afterwards. e.g. it is changed at
https:/
So after line 121 (in the original file) it should be the correct position
Jan
2016-06-14 19:47 GMT+02:00 Jan Stránský <
<email address hidden>>:
> Question #295301 on Yade changed:
> https:/
>
> Jan Stránský proposed the following answer:
> Hi Jabrane,
>
> But i have a question how do you know that dAX is a local variable ?
>
>
> it just comes from how C++ works / is defined, nothing else.
>
> "Real dAX" in cpp file inside a function simply declares a local variable.
> No matter if the class has a member with the same name.
>
> cheers
> Jan
>
>
> 2016-06-14 19:37 GMT+02:00 Yor1 <email address hidden>:
>
> > Question #295301 on Yade changed:
> > https:/
> >
> > Yor1 posted a new comment:
> > Hello Jerome and Jan
> >
> > Thank you of your response.
> >
> > Jerome, I simulate the tensile test with TriaxialStressC
> > positive strainRate but i doesn't work.
> > I get sigma=sigma2=
> >
> > Jan, your solution work but i can't have a definitive opinion until i
> > calculate Wext.
> > But i have a question how do you know that dAX is a local variable ?
> >
> > Best regards.
> > Jabrane.
> >
> > --
> > You received this question notification because your team yade-users is
> > an answer contact for Yade.
> >
> > _______
> > Mailing list: https:/
> > Post to : <email address hidden>
> > Unsubscribe : https:/
> > More help : https:/
> >
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#7 |
Hi Jan,
Thank you for the answer.
Your alternative work but it doesn't resolve my problem because the external work obtained is underestimated (i compare it with the elastic energy).
I tried a second alternative which based on the difference of the total displacement between iteration "i" and "i+1".
The problem is that in UniaxialStraine
I tried these lines of code but it doesn't work:
Real displacement; Real S;
S=axialLength-
displacement=
I obtained displacement=0. May be this solution is stupid but i don't know how to do the get the difference in
UniaxialStraine
Best regards.
Jabrane.
Revision history for this message
|
#8 |
>
>
> Your alternative work but it doesn't resolve my problem because the
> external work obtained is underestimated (i compare it with the elastic
> energy).
>
Do you have some values? for example
https:/
changes the value to half, but if you compute work from it, you should
multiply it by 2 again.. Could you also post a script you use?
> I tried a second alternative which based on the difference of the total
> displacement between iteration "i" and "i+1".
> The problem is that in UniaxialStraine
> because we can't control the
> I tried these lines of code but it doesn't work:
>
> Real displacement; Real S;
> S=axialLength-
> displacement=
> I obtained displacement=0. May be this solution is stupid but i don't know
> how to do the get the difference in
> UniaxialStraine
>
of course :-) displacement=
= (axialLength-
values of axisLength and originalLength
the solution is to store the previous value inside the class
cheers
Jan
Revision history for this message
|
#9 |
Hi Jan,
This is the script which i use:
from yade import ymport, utils , plot
import math
PACKING='X1Y2Z1_2k'
OUT=PACKING+
DAMP=0.4 s
saveData=100
iterMax=40000
saveVTK=1000
strainRate=0.002
intR=1.5028
DENS=4000
YOUNG=65e9
FRICT=10
ALPHA=0.4
TENS=8e6
COH=160e6
def sphereMat(): return JCFpmMat(
O.bodies.
dim=utils.
xinf=dim[0][0]
xsup=dim[1][0]
X=xsup-xinf
yinf=dim[0][1]
ysup=dim[1][1]
Y=ysup-yinf
zinf=dim[0][2]
zsup=dim[1][2]
Z=zsup-zinf
bb=utils.
negIds,
O.engines=[
ForceResetter(),
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
UniaxialStrain
GlobalStiffnes
NewtonIntegrat
PyRunner(
]
O.step();
SSgeom.
Saabb.aabbEnlar
layerSize=0.2
for o in O.bodies:
if isinstance(
if ( o.state.
o.
O.run(iterMax)
Revision history for this message
|
#10 |
Hi Jabrane,
thanks for the script. However, I was mainly interested in how you compute
the elastic energy and the work :-)
Jan
2016-06-16 9:28 GMT+02:00 Yor1 <email address hidden>:
> Question #295301 on Yade changed:
> https:/
>
> Yor1 posted a new comment:
> Hi Jan,
>
> This is the script which i use:
>
> from yade import ymport, utils , plot
> import math
>
> PACKING='X1Y2Z1_2k'
> OUT=PACKING+
>
> DAMP=0.4 s
> saveData=100
> iterMax=40000
> saveVTK=1000
>
> strainRate=0.002
>
> intR=1.5028
> DENS=4000
> YOUNG=65e9
> FRICT=10
> ALPHA=0.4
> TENS=8e6
> COH=160e6
>
> def sphereMat(): return JCFpmMat(
> = ALPHA,frictionA
>
>
> O.bodies.
>
> dim=utils.
> xinf=dim[0][0]
> xsup=dim[1][0]
> X=xsup-xinf
> yinf=dim[0][1]
> ysup=dim[1][1]
> Y=ysup-yinf
> zinf=dim[0][2]
> zsup=dim[1][2]
> Z=zsup-zinf
>
> bb=utils.
>
> negIds,
>
> O.engines=[
> ForceResetter(),
>
> InsertionSortCo
> InteractionLoop(
>
> [Ig2_Sphere_
>
> [Ip2_JCFpmMat_
>
> [Law2_ScGeom_
> ),
>
> UniaxialStraine
>
> GlobalStiffness
> defaultDt=
> NewtonIntegrato
>
> PyRunner(
>
> #VTKRecorder(
> ]
>
> O.step();
>
> SSgeom.
> Saabb.aabbEnlar
>
> layerSize=0.2
> for o in O.bodies:
> if isinstance(
> if (
> o.state.
> ( o.state.
> o.shape.
>
> O.run(iterMax)
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#11 |
Hi Jan,
I compute the elastic energy in the recorder (in the script) with these lines:
for i in O.interactions:
if not i.isReal : continue
E+
With these lines i guarantee that i calculate the elastic energy in all contacts (contact between spheres, contact between sphere and wall, etc ...)
For the external work i try to compute it in the sources in https:/
if(asymmetry==0){
dAX*=.5;
Best regards.
Jabrane.
Revision history for this message
|
#12 |
Hi Jabrane,
dAX*=.5;
> displacement=2*dAX;
> externalWork += displacement(
> externalWork += externalWork;
a few points:
1) displacement(
I consider there should be multiplication displacement*(
sumPosForces+
2) also from your previous post with S=axialLength-
displacement=
commands do
externalWork += displacement(
dspl*force to externalWork, so far OK
externalWork += externalWork; // this is equal to externalWork =
2*externalWork.. I don's see any reason for this
3) sumPosForces and sumNegForces are updated at the very end of action
function by computeAxialForce, and only once per stressUpdateInt
to compute it more accurately, you should put your computation after this
update and use some low value (1 to get really exact results) for
stressUpdateInt
please consider to update you computations and let us know about new results
cheers
Jan
2016-06-16 14:13 GMT+02:00 Yor1 <email address hidden>:
> Question #295301 on Yade changed:
> https:/
>
> Yor1 posted a new comment:
> Hi Jan,
>
> I compute the elastic energy in the recorder (in the script) with these
> lines:
>
> for i in O.interactions:
> if not i.isReal : continue
> E+=0.5*
> i.phys.
>
> With these lines i guarantee that i calculate the elastic energy in all
> contacts (contact between spheres, contact between sphere and wall, etc
> ...)
>
> For the external work i try to compute it in the sources in
> https:/
>
> if(asymmetry==0){
>
> dAX*=.5;
>
> Best regards.
> Jabrane.
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#13 |
Hi Jan,
I calculate the displacement and the external work with these lines:
if(asymmetry==0){ dAX*=.5;
externalWork += displacement*
The eslastic energy and the external work are equal in the pre-pic stage and that is reasonable for me.
Now i have to modify the calculation of the damping energy. In fact with NewtonIntegrator, the damped energy is calculated in all the particles. But in my case, i have to calculate the damping energy in the particles that don't belong to posIds and negIds.
Best regards
Jabrane
Revision history for this message
|
#14 |
>
> displacement=
I don't like that the work depends on number of particles, it should not..
Jan
2016-06-16 18:37 GMT+02:00 Yor1 <email address hidden>:
> Question #295301 on Yade changed:
> https:/
>
> Yor1 posted a new comment:
> Hi Jan,
>
> I calculate the displacement and the external work with these lines:
>
> if(asymmetry==0){
> dAX*=.5;
> externalWork += displacement*
>
>
> The eslastic energy and the external work are equal in the pre-pic stage
> and that is reasonable for me.
> Now i have to modify the calculation of the damping energy. In fact with
> NewtonIntegrator, the damped energy is calculated in all the particles. But
> in my case, i have to calculate the damping energy in the particles that
> don't belong to posIds and negIds.
>
> Best regards
> Jabrane
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#15 |
I change the manner that i calculate the displacement
if(asymmetry==0){
dAX*=.5;
for(size_t i=0; i<max(posIds.
displacemen
}
}
I'm inspiring from the calculation of the displacement for "asymmetry!=1" and "assymetry!=-1".
For example, the displacement in the case of "asymmetry!=1" is calculated like this:
if(asymmetry!=1){
for(size_t i=0; i<negIds.size(); i++){
negCoords[
axisVel(
}
}
Jabrane.
Revision history for this message
|
#16 |
>
>
>
> if(asymmetry!=1){
> for(size_t i=0; i<negIds.size(); i++){
> negCoords[i]-=dAX;
> axisVel(negIds[i]) = -dAX/scene->dt; // update
> current position
>
> }
>
> }
>
>
there is no computation of displacement here.. just each **coordinate**
(from 0 to negIds.size()) is updated by displacement dAX, so .. Really try
to understand what the code does before being inspired, otherwise it might
be "dangerous" :-)
dAX (or maximum 2*dAX) is the actual change in length of the specimen. If
you compute external work like this (multiplying it by number of fixed
particles) and it equals the elastic energy, there must be a problem
somewhere..
Jan
Revision history for this message
|
#17 |
Hello Jan !
I modified the computation of the displacement and the external work by these formula:
displacement += strainRate*
externalWork += displacement*
And it works and that resolves my problem.
Jabrane.
Can you help with this problem?
Provide an answer of your own, or ask Yor1 for more information if necessary.