a question in neigh_gran cpp

Submitted by xiuhan on Mon, 11/03/2014 - 18:10

Dear all,
I saw in the file neigh_gran.cpp, in the ´void Neighbor::granular_bin_no_newton_ghost(NeighList *list)´ part, there is

if (fix_history) {
if (rsq < radsum*radsum)
{
for (m = 0; m < npartner[i]; m++)
if (partner[i][m] == tag[j]) break;
if (m < npartner[i]) {
touchptr[n] = 1;
for (d = 0; d < dnum; d++) {
shearptr[nn++] = contacthistory[i][m*dnum+d];
}
? } else {
? touchptr[n] = 0;
? for (d = 0; d < dnum; d++) {
? shearptr[nn++] = 0.0;
}
}
} else {
touchptr[n] = 0;
for (d = 0; d < dnum; d++) {
shearptr[nn++] = 0.0;
}
}
}

My question is when ¨rsq < radsum*radsum¨ is met, then the two particles should be seen as in touch with each other, right? They may have already been registered as partners ( if (m < npartner[i]) ) , or they have not been registered as partners yet (else). BUT touchptr in both cases should be set to 1, right?
That´s why I have question about the codes starting with question mark where rouchptr is set to 0. I don´t really understand it.

Another question is, I saw in many places of the code the variable ¨firstdouble¨, but I´ve never seen where this ¨firstdouble¨ variable got its value. I often see that the ¨firstshear¨ variable gets the value from firstdouble, okay. BUT where does firstdouble got his own value??

Can someone help me a bit with these quesions?
Thank you so much~

ckloss's picture

ckloss | Sun, 11/16/2014 - 16:04

Hi,

touchptr is set in the granular interaction itself. Please note that this is not a simple flag, but a bitfield, i.e. each contact model can define its own "touch" criterion

Best wishes
Christoph