diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index daf3152c34..fb986fb73e 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -45,7 +45,7 @@ Syntax radius = cylinder radius (distance units) * zero or more keyword/value pairs may be appended to args -* keyword = *wiggle* or *shear* +* keyword = *wiggle* or *shear* or *contacts* .. parsed-literal:: @@ -56,6 +56,9 @@ Syntax *shear* values = dim vshear dim = *x* or *y* or *z* vshear = magnitude of shear velocity (velocity units) + *contacts* value = none + generate contact information for each particle + Examples """""""" @@ -68,6 +71,7 @@ Examples fix 3 all wall/gran/region granular hooke 1000.0 50.0 tangential linear_nohistory 1.0 0.4 damping velocity region myBox fix 4 all wall/gran/region granular jkr 1e5 1500.0 0.3 10.0 tangential mindlin NULL 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall region myCone fix 5 all wall/gran/region granular dmt 1e5 0.2 0.3 10.0 tangential mindlin NULL 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall damping tsuji region myCone + fix 6 all wall/gran hooke 200000.0 NULL 50.0 NULL 0.5 0 xplane -10.0 10.0 contacts Description """"""""""" @@ -171,6 +175,7 @@ the clockwise direction for *vshear* > 0 or counter-clockwise for *vshear* < 0. In this case, *vshear* is the tangential velocity of the wall at whatever *radius* has been defined. + **Restart, fix_modify, output, run start/stop, minimize info:** This fix writes the shear friction state of atoms interacting with the @@ -181,11 +186,37 @@ info on how to re-specify a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. -None of the :doc:`fix_modify ` options are relevant to this -fix. No global or per-atom quantities are stored by this fix for -access by various :doc:`output commands `. No parameter -of this fix can be used with the *start/stop* keywords of the -:doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +If the :code:`contacts` option is used, this fix generates a per-atom array +with 8 columns as output, containing the contact information for owned +particles (nlocal on each processor). All columns in this per-atom array will +be zero if no contact has occurred. The values of these columns are listed in +the following table: + ++-------+----------------------------------------------------+----------------+ +| Index | Value | Units | ++=======+====================================================+================+ +| 1 | 1.0 if particle is in contact with wall, | | +| | 0.0 otherwise | | ++-------+----------------------------------------------------+----------------+ +| 2 | Force :math:`f_x` exerted on the wall | force units | ++-------+----------------------------------------------------+----------------+ +| 3 | Force :math:`f_y` exerted on the wall | force units | ++-------+----------------------------------------------------+----------------+ +| 4 | Force :math:`f_z` exerted on the wall | force units | ++-------+----------------------------------------------------+----------------+ +| 5 | :math:`\Delta x` between wall surface and particle | distance units | ++-------+----------------------------------------------------+----------------+ +| 6 | :math:`\Delta y` between wall surface and particle | distance units | ++-------+----------------------------------------------------+----------------+ +| 7 | :math:`\Delta z` between wall surface and particle | distance units | ++-------+----------------------------------------------------+----------------+ +| 8 | Radius :math:`r` of atom | distance units | ++-------+----------------------------------------------------+----------------+ + +None of the :doc:`fix_modify ` options are relevant to this fix. +No parameter of this fix can be used with the *start/stop* keywords of the +:doc:`run ` command. This fix is not invoked during :doc:`energy +minimization `. Restrictions """""""""""" diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 620baa0942..ecf850f11e 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -8,7 +8,7 @@ Syntax .. parsed-literal:: - fix ID group-ID wall/gran/region fstyle fstyle_params wallstyle regionID + fix ID group-ID wall/gran/region fstyle fstyle_params wallstyle regionID keyword values ... * ID, group-ID are documented in :doc:`fix ` command * wall/region = style name of this fix command @@ -36,6 +36,12 @@ Syntax * wallstyle = region (see :doc:`fix wall/gran ` for options for other kinds of walls) * region-ID = region whose boundary will act as wall +* keyword = *contacts* + + .. parsed-literal:: + + *contacts* value = none + generate contact information for each particle Examples """""""" @@ -46,6 +52,7 @@ Examples fix 3 all wall/gran/region granular hooke 1000.0 50.0 tangential linear_nohistory 1.0 0.4 damping velocity region myBox fix 4 all wall/gran/region granular jkr 1e5 1500.0 0.3 10.0 tangential mindlin NULL 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall region myCone fix 5 all wall/gran/region granular dmt 1e5 0.2 0.3 10.0 tangential mindlin NULL 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall damping tsuji region myCone + fix wall all wall/gran/region hooke/history 1000.0 200.0 200.0 100.0 0.5 1 region myCone contacts Description """"""""""" @@ -215,11 +222,37 @@ uninterrupted fashion. use the same fix ID for fix wall/gran/region, but assign it a region with a different region ID. -None of the :doc:`fix_modify ` options are relevant to this -fix. No global or per-atom quantities are stored by this fix for -access by various :doc:`output commands `. No parameter -of this fix can be used with the *start/stop* keywords of the -:doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +If the :code:`contacts` option is used, this fix generates a per-atom array +with 8 columns as output, containing the contact information for owned +particles (nlocal on each processor). All columns in this per-atom array will +be zero if no contact has occurred. The values of these columns are listed in +the following table: + ++-------+----------------------------------------------------+----------------+ +| Index | Value | Units | ++=======+====================================================+================+ +| 1 | 1.0 if particle is in contact with wall, | | +| | 0.0 otherwise | | ++-------+----------------------------------------------------+----------------+ +| 2 | Force :math:`f_x` exerted on the wall | force units | ++-------+----------------------------------------------------+----------------+ +| 3 | Force :math:`f_y` exerted on the wall | force units | ++-------+----------------------------------------------------+----------------+ +| 4 | Force :math:`f_z` exerted on the wall | force units | ++-------+----------------------------------------------------+----------------+ +| 5 | :math:`\Delta x` between wall surface and particle | distance units | ++-------+----------------------------------------------------+----------------+ +| 6 | :math:`\Delta y` between wall surface and particle | distance units | ++-------+----------------------------------------------------+----------------+ +| 7 | :math:`\Delta z` between wall surface and particle | distance units | ++-------+----------------------------------------------------+----------------+ +| 8 | Radius :math:`r` of atom | distance units | ++-------+----------------------------------------------------+----------------+ + +None of the :doc:`fix_modify ` options are relevant to this fix. +No parameter of this fix can be used with the *start/stop* keywords of the +:doc:`run ` command. This fix is not invoked during :doc:`energy +minimization `. Restrictions """""""""""" diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index e5ed1579ba..c856b8ff5f 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -370,7 +370,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : vshear = force->numeric(FLERR,arg[iarg+2]); wshear = 1; iarg += 3; - } else if (strcmp(arg[iarg],"store_contacts") == 0) { + } else if (strcmp(arg[iarg],"contacts") == 0) { peratom_flag = 1; size_peratom_cols = 8; peratom_freq = 1; @@ -426,10 +426,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } if (peratom_flag) { - int nlocal = atom->nlocal; - for (int i = 0; i < nlocal; i++) - for (int m = 0; m < size_peratom_cols; m++) - array_atom[i][m] = 0.0; + clear_stored_contacts(); } time_origin = update->ntimestep; @@ -596,6 +593,10 @@ void FixWallGran::post_force(int /*vflag*/) rwall = 0.0; + if (peratom_flag) { + clear_stored_contacts(); + } + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -668,7 +669,7 @@ void FixWallGran::post_force(int /*vflag*/) // store contact info if (peratom_flag) { - array_atom[i][0] = (double)atom->tag[i]; + array_atom[i][0] = 1.0; array_atom[i][4] = x[i][0] - dx; array_atom[i][5] = x[i][1] - dy; array_atom[i][6] = x[i][2] - dz; @@ -702,6 +703,15 @@ void FixWallGran::post_force(int /*vflag*/) } } +void FixWallGran::clear_stored_contacts() { + const int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + for (int m = 0; m < size_peratom_cols; m++) { + array_atom[i][m] = 0.0; + } + } +} + /* ---------------------------------------------------------------------- */ void FixWallGran::post_force_respa(int vflag, int ilevel, int /*iloop*/) diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index f147e29433..3aa518209a 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -110,6 +110,8 @@ class FixWallGran : public Fix { // store particle interactions int store; + + void clear_stored_contacts(); }; } diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 95553b83b7..7ccd90ebf8 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -178,6 +178,10 @@ void FixWallGranRegion::post_force(int /*vflag*/) region->set_velocity(); } + if (peratom_flag) { + clear_stored_contacts(); + } + for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (!region->match(x[i][0],x[i][1],x[i][2])) continue;