Fix wall/gran: modify the code to include a touch flag

diego.peinado's picture
Submitted by diego.peinado on Wed, 02/16/2011 - 16:45

Hello Christoph, I would like to include a flag that changes its state when a particle touchs for first time the wall. This is like the:
touch = firsttouch[i];

in the pair_gran_hooke_history.cpp compute function. I want to see when the contact is lost in order to make some variable assignments. So in: void FixWallGran::post_force(int vflag), I can modify the code and make something like:

if (wallstyle != MESHGRAN_FWG){
rsq = dx*dx + dy*dy + dz*dz;
if (rsq > radius[i]*radius[i])
{
if (touch[i]){
touch[i]=0;
do_variables_assignment();
}

if(history) reset_history(i,0);
}
....
The problem is that I do not understand quite well what is being done with the variables:
int maxpartners;
int *npartners;
int ***partner;
double ***contacthistory;

They are like a fix_contact_history, but the touch flag is in the Neighbour list, in the pair interaction scheme. With the wall interaction, I can not see how are they managed. Why npartners, a particle can be in contact with more than one wall, a wall with several particles? In pair interactions, there is a list with the number of particles near each particle (npartners), for each particle there is a list of the indexes for the particles in its neighbourhood, and for each of these, a list of dnum contact history terms. But with walls, what are the meaning for these variables? Perhaps it has to do with the mesh gran walls, but here I have to admit that I do not understand how its made at all (of course my fault). It is possible that the structure is the same than in the case of the pair interaction, but the lists for each particle is only of one element for the wall-particle interaction, and in the case of the mesh, it is more complicated?

Ok, this is quite difficult for me ... :), I would only know if it's possible to have such a contact flag, in a easy way, and if possible that can work also with mesh gran walls.

Thanks,