swap failure in InteractionLoop
Hey guys,
I have an Ip like:
Ip2_CohFrictMat
which makes a CohBurgersPhy (viscoelastic Burgers model) from an interaction of CohFrictMat and CohBurgersMat.
Since two types of material are in contact we need to determine the order of bodies with iffrent materials in contact and swap the order, if necessary. I was using the following:
#=================
void Ip2_CohFrictMat
{
if(interactio
shared_
int i1 = b1->getClassInd
int i2 = b2->getClassInd
int cbmi = CohBurgersMat:
CohFrictMat* mat1;
CohBurgersMat* mat2;
if (i2 == cbmi) { // b2 is CohburgersMat and b1 is CohFrictMat
mat1 = dynamic_
mat2 = dynamic_
} else if (i1 == cbmi) { // b1 is CohburgersMat and b2 is CohFrictMat
mat1 = dynamic_
mat2 = dynamic_
} else { // should not happen, but to be sure..
LOG_FATAL(
}
ScGeom6D* geom= YADE_CAST<
.
.
.
#=============
This was working well with any order of materials in contact. However, I upgraded from Ubuntu 12.04 to Ubuntu 14.04 yesterday and I got an updated Yade trunk. Compilation of my Burger's model files went through. But, swapping function is not working now!
I'm getting the following error now:
python: /home/bemaj3/
Aborted (core dumped)
Is there any new change in InteractionLoop which causes this problem?
Thanks
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 |
Hi,
the crashing line in interactionloop is in the code since 2010 unchanged.
I think this part of your code should be rewritten. Try something like this:
CohFrictMat* mat_fm=
if (mat_fm) {.....
But it should be checked. I would also recommend you to commit
your model into the main trunk, cover it with unit/check tests
to provide the continuous integration.
Cheers
Anton
2015-07-17 0:46 GMT+03:00 behzad <email address hidden>:
> New question #269315 on Yade:
> https:/
>
> Hey guys,
>
> I have an Ip like:
>
> Ip2_CohFrictMat
>
> which makes a CohBurgersPhy (viscoelastic Burgers model) from an
> interaction of CohFrictMat and CohBurgersMat.
>
> Since two types of material are in contact we need to determine the order
> of bodies with iffrent materials in contact and swap the order, if
> necessary. I was using the following:
>
> #=================
>
> void Ip2_CohFrictMat
> shared_
> shared_
> {
>
> if(interaction-
> shared_
>
>
> int i1 = b1->getClassInd
> int i2 = b2->getClassInd
> int cbmi = CohBurgersMat:
> CohBurgersMat
> CohFrictMat* mat1;
> CohBurgersMat* mat2;
> if (i2 == cbmi) { // b2 is CohburgersMat and b1 is CohFrictMat
> mat1 = dynamic_
> mat2 = dynamic_
> } else if (i1 == cbmi) { // b1 is CohburgersMat and b2 is CohFrictMat
> mat1 = dynamic_
> mat2 = dynamic_
> } else { // should not happen, but to be sure..
> LOG_FATAL("TODO");
> }
>
> ScGeom6D* geom= YADE_CAST<
> .
> .
> .
> #=============
>
> This was working well with any order of materials in contact. However, I
> upgraded from Ubuntu 12.04 to Ubuntu 14.04 yesterday and I got an updated
> Yade trunk. Compilation of my Burger's model files went through. But,
> swapping function is not working now!
>
> I'm getting the following error now:
>
>
> python: /home/bemaj3/
> virtual void InteractionLoop
> Aborted (core dumped)
>
>
>
> Is there any new change in InteractionLoop which causes this problem?
> Thanks
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#2 |
Hi Anton,
Can you please clarify the approach you're proposing?
CohFrictMat* mat_fm=
if (mat_fm) {.....
And I don't get what's wrong with my code? It's checking the index of bodies material and and that of CohBurgersMat and then compares them.
Revision history for this message
|
#3 |
Hi Behzad,
please provide also a Python script (even if we can't run it). Do you use
more particle shapes?
See also the source code (InteractionLoo
different shapes, the interaction may be swapped (ok and intended
behavior). Then if you use also different materials, the interaction might
want to swap again, which results in this error.
This happens only in unlucky situation, I used spheres-CpmMat,
facets-FrictMat combination. But (by luck) the definition of Ig2 is
Facet-Sphere and Ip2 is FrictMat-CpmMat (the same order)
The code is unchanged since 2010, but probably nobody needed this
combination (different shapes AND different materials AND different order
in definitions) :-)
I see some possible solutions:
1) define both Ip2_Mat1_Mat2 and Ip2_Mat2_Mat1 (to save code, one of them
calling the other).
2) change InteractionLoop slightly (replace this assert with some other
code, probably would need general discussion among devs)
3) change InteractionLoop completely (nobody would want to do that :-)
In my point of view, 1) is ok, 2) maybe.. So for now you can go 1)
direction :-)
cheers
Jan
2015-07-17 21:11 GMT+02:00 behzad <email address hidden>:
> Question #269315 on Yade changed:
> https:/
>
> Status: Answered => Open
>
> behzad is still having a problem:
> Hi Anton,
>
> Can you please clarify the approach you're proposing?
>
> CohFrictMat* mat_fm=
> if (mat_fm) {.....
>
>
> And I don't get what's wrong with my code? It's checking the index of
> bodies material and and that of CohBurgersMat and then compares them.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#4 |
well, I tried the first method. But, the problem is still there.
When I define the Ip2 functors in the engines, the one which is defined first is the active one!
I mean, I have defined two separate Ip2 functors:
Ip2_CohBurgersM
Ip2_CohFrictMat
In my simulation, I define the engines as:
O.engines=[
ForceResetter(),
ForceEngine(
InsertionSortCo
InteractionLoop(
[Ig2_Sphere_
[Ip2_CohBurgers
Ip2_CohBurgersM
Ip2_CohFrictMat
[Law2_ScGeom6D_
),
NewtonIntegrato
PyRunner(
PyRunner(
]
In the case above, Ip2_CohBurgersM
Now, if I define first Ip2_CohFrictMat
That's strange (for me). This shouldn't happen.
And but "not working" I mean, I again get the error of
" python: /home/bemaj3/
Aborted (core dumped)"
Regards,
Behzad
Revision history for this message
|
#5 |
Hi Behzad,
just to confirm we are discussing the same problem, I'll repeat my two
requests from #3:
please provide also a Python script (even if we can't run it). Do you use
> more particle shapes?
furhtermore, please attach also the .hpp and .cpp files with your
implementation so we can see or compile it and try, the problem might be
also there (e.g. forgotten switch of FUNCTOR2D arguments)
I thought this approach should have worked, sorry it does not. To solve it,
somebody should dive deeply inside the code and find out what is going on
for these combinations of shapes and materials.. I opened a bug [1], but
currently I don't have time capacities to solve it myself..
cheers
Jan
[1] https:/
2015-07-22 22:56 GMT+02:00 behzad <email address hidden>:
> Question #269315 on Yade changed:
> https:/
>
> Status: Answered => Open
>
> behzad is still having a problem:
> well, I tried the first method. But, the problem is still there.
>
> When I define the Ip2 functors in the engines, the one which is defined
> first is the active one!
>
> I mean, I have defined two separate Ip2 functors:
>
> Ip2_CohBurgersM
>
> Ip2_CohFrictMat
>
>
> In my simulation, I define the engines as:
>
> O.engines=[
> ForceResetter(),
> ForceEngine(
> InsertionSortCo
> InteractionLoop(
> [Ig2_Sphere_
> [Ip2_CohBurgers
> setCohesionOnNe
> Ip2_CohBurgersM
> setCohesionOnNe
> Ip2_CohFrictMat
> setCohesionOnNe
>
> [Law2_ScGeom6D_
> ),
> NewtonIntegrato
> PyRunner(
> PyRunner(
> ]
>
>
> In the case above, Ip2_CohBurgersM
> Now, if O.bodies[0] is CohBurgersMat and O.bodies[1] is CohFrictMat, it
> works but not the reverse.
>
> Now, if I define first Ip2_CohFrictMat
> is CohFrictMat and O.bodies[1] is CohBurgersMat, it works but not the
> reverse.
>
> That's strange (for me). This shouldn't happen.
> And but "not working" I mean, I again get the error of
> " python:
> /home/bemaj3/
> void InteractionLoop
> Aborted (core dumped)"
>
> Regards,
> Behzad
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#6 |
Hi Jan,
This is the link to the codes:
https:/
and my Python script is:
=======
=======
O.reset()
from yade import utils, plot
from yade import pack, qt
id_Mat1=
kms=2.0e8,
density=2600, poisson=0.3, frictionAngle= 0.4))
Mat1=O.
id_Mat3=
kms=2.0e8,
density=2600, poisson=0.3, frictionAngle= 0.4))
Mat3=O.
id_Mat2=
normalCohesion= 1e25, shearCohesion= 1e23))
Mat2=O.
s1=utils.
s2=utils.
O.bodies.append(s1)
O.bodies.append(s2)
O.engines=[
ForceResetter(),
ForceEngine(
InsertionSortCo
InteractionLoop(
[Ig2_Sphere_
[Ip2_CohFBMat_
Ip2_CohBurgersM
[Law2_ScGeom6D_
),
NewtonIntegrato
PyRunner(
PyRunner(
]
def AutoData():
f_app=2e1
t_loading=5
cmn=6e6
# kmn=4.0e6
kmn=2.0e6 # in case of CohFrictMat-
kkn=2.0e6
ckn=6e6
j1= 1/kmn
j2= 1/kkn
j3= kkn/ckn
j4= 1/cmn
a1= cmn/kmn+
a2=cmn*
b1= cmn
b2=cmn*cmn/kmn
z1=(-a1+
z2=(-a1-
aa1=(b2*
aa2=(b2*
if O.time < t_loading:
displacement=
else:
displacement=
plot.plots=
plot.plot()
O.dt=1e-6
qt.View()
=======
=======
as for "forgotten switch of FUNCTOR2D arguments", I didn't put any kind of switch!
Regards,
Thanks for the comments.
Revision history for this message
|
#7 |
Hi Behzad,
thanks for the files. According to your script, the answer to my question "Do
you use more particle shapes?" form #3 is no. All my comments were for the
"yes" case :-)
So the problem is quite opposite, two materials for the same shape. The
problem is somewhere in the core implementation. Unluckily for you, nobody
used/needed this case so far :-) Just now I have no idea how (and time) to
solve it..
cheers
Jan
2015-07-22 23:26 GMT+02:00 behzad <email address hidden>:
> Question #269315 on Yade changed:
> https:/
>
> Status: Answered => Open
>
> behzad is still having a problem:
>
> Hi Jan,
>
> This is the link to the codes:
>
> https:/
>
>
> and my Python script is:
>
> =======
> =======
>
> O.reset()
> from yade import utils, plot
> from yade import pack, qt
>
>
>
> id_Mat1=
> kms=2.0e8,
> 1e23, isCohesive= True, young=2e8,
> density=2600, poisson=0.3, frictionAngle= 0.4))
> Mat1=O.
>
>
> id_Mat3=
> kms=2.0e8,
> 1e23, isCohesive= True, young=2e8,
> density=2600, poisson=0.3, frictionAngle= 0.4))
> Mat3=O.
>
>
> id_Mat2=
> True,
> normalCohesion= 1e25, shearCohesion= 1e23))
> Mat2=O.
>
>
> s1=utils.
> s2=utils.
>
> O.bodies.append(s1)
> O.bodies.append(s2)
>
>
> O.engines=[
> ForceResetter(),
> ForceEngine(
> InsertionSortCo
> InteractionLoop(
> [Ig2_Sphere_
> [Ip2_CohFBMat_
> setCohesionOnNe
> Ip2_CohBurgersM
> setCohesionOnNe
>
> [Law2_ScGeom6D_
> ),
> NewtonIntegrato
> PyRunner(
> PyRunner(
> ]
>
>
> def AutoData():
> f_app=2e1
> t_loading=5
> cmn=6e6
> # kmn=4.0e6
> kmn=2.0e6 # in case of CohFrictMat-
> kkn=2.0e6
> ckn=6e6
> j1= 1/kmn
> j2= 1/kkn
> j3= kkn/ckn
> j4= 1/cmn
> a1= cmn/kmn+
> a2=cmn*
> b1= cmn
> b2=cmn*cmn/kmn
> z1=(-a1+
> z2=(-a1-
> aa1=(b2*
> aa2=(b2*
> if O.time < t_loading:
>
> displacement=
> else:
>
> displacement=
>
> plot.addData(
> ].state.
>
>
> plot.plots=
> plot.plot()
>
> O.dt=1e-6
>
> qt.View()
>
> =======
> =======
>
>
> as for "forgotten switch of FUNCTOR2D arguments", I didn't put any kind of
> switch!
>
> Regards,
>
>
> Thanks for the comments.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Revision history for this message
|
#8 |
hmm, I see.
But, something has been recently changed and made this thing not working. Check it out:
https:/
You and I had a talk about this few months ago. Finally, we got a solution by defining only one Ip2_mat1_mat2... functor, but checking the orders inside the functor.
This method was working till I updated to latest trunk version, last week.
Anyway, thanks again.
Cheers,
Behzad
Revision history for this message
|
#9 |
Maybe (I'm more or less speculating, as a small piece of help), there has been some changes making your material class index verification now inefficient.
Basically, I think Anton proposed you in #1 another way checking who is CohBurger and who is CohFrict. If I remember well (it is maybe worth for you to check) the dynamic cast should return true if things go well, i.e. if b1 is of CohFrictMat type (regarding Anton's code example). And false otherwise.
Then, it is a way that could replace your index verifications and solve your problem (if the problem is indeed at the index level ????)
Revision history for this message
|
#10 |
Hi Jerome,
I think the problem is at the index level but surprisingly tried the following and it doesn't work:
CohFrictMat* check1;
check1 = dynamic_
CohFrictMat* mat1;
CohBurgersMat* mat2;
if (check1) {
mat1 = dynamic_
mat2 = dynamic_
} else { // b1 is CohburgersMat and b2 is CohFrictMat
mat1 = dynamic_
mat2 = dynamic_
}
Can you help with this problem?
Provide an answer of your own, or ask behzad for more information if necessary.