refactoring of code and doc files

This commit is contained in:
Steve Plimpton 2020-01-13 15:22:02 -07:00
parent aa70f8cc6b
commit d3348371e1
5 changed files with 171 additions and 139 deletions

View File

@ -21,13 +21,9 @@ Syntax
.. parsed-literal::
*xlo*\ ,\ *ylo*\ ,\ *zlo* arg = EDGE or constant or variable
arg = EDGE or constant or variable
EDGE = current lo edge of simulation box
constant = number like 0.0 or -30.0 (distance units)
variable = :doc:`equal-style variable <variable>` like v_x or v_wiggle
*xhi*\ ,\ *yhi*\ ,\ *zhi* arg = EDGE or constant or variable
EDGE = current hi edge of simulation box
constant = number like 50.0 or 100.3 (distance units)
constant = number like 0.0 or 30.0 (distance units)
variable = :doc:`equal-style variable <variable>` like v_x or v_wiggle
* zero or more keyword/value pairs may be appended
@ -62,11 +58,12 @@ by a distance delta (e.g. due to :doc:`fix nve <fix_nve>`), then it is
put back inside the face by the same delta, and the sign of the
corresponding component of its velocity is flipped.
When used in conjunction with :doc:`fix nve <fix_nve>` and :doc:`run\_style verlet <run_style>`, the resultant time-integration algorithm is
equivalent to the primitive splitting algorithm (PSA) described by
:ref:`Bond <Bond1>`. Because each reflection event divides
the corresponding timestep asymmetrically, energy conservation is only
satisfied to O(dt), rather than to O(dt\^2) as it would be for
When used in conjunction with :doc:`fix nve <fix_nve>` and
:doc:`run\_style verlet <run_style>`, the resultant time-integration
algorithm is equivalent to the primitive splitting algorithm (PSA)
described by :ref:`Bond <Bond1>`. Because each reflection event
divides the corresponding timestep asymmetrically, energy conservation
is only satisfied to O(dt), rather than to O(dt\^2) as it would be for
velocity-Verlet integration without reflective walls.
Up to 6 walls or faces can be specified in a single command: *xlo*\ ,
@ -156,17 +153,19 @@ perturbation on the particles:
Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are
functionally the same as the corresponding style without the suffix.
They have been optimized to run faster, depending on your available
hardware, as discussed on the :doc:`Speed packages <Speed_packages>` doc
page. The accelerated styles take the same arguments and should
hardware, as discussed on the :doc:`Speed packages <Speed_packages>`
doc page. The accelerated styles take the same arguments and should
produce the same results, except for round-off and precision issues.
These accelerated styles are part of the GPU, USER-INTEL, KOKKOS,
USER-OMP and OPT packages, respectively. They are only enabled if
LAMMPS was built with those packages. See the :doc:`Build package <Build_package>` doc page for more info.
LAMMPS was built with those packages. See the :doc:`Build package
<Build_package>` doc page for more info.
You can specify the accelerated styles explicitly in your input script
by including their suffix, or you can use the :doc:`-suffix command-line switch <Run_options>` when you invoke LAMMPS, or you can use the
:doc:`suffix <suffix>` command in your input script.
by including their suffix, or you can use the :doc:`-suffix
command-line switch <Run_options>` when you invoke LAMMPS, or you can
use the :doc:`suffix <suffix>` command in your input script.
See the :doc:`Speed packages <Speed_packages>` doc page for more
instructions on how to use the accelerated styles effectively.
@ -177,11 +176,13 @@ instructions on how to use the accelerated styles effectively.
**Restart, fix\_modify, output, run start/stop, minimize info:**
No information about this fix is written to :doc:`binary restart files <restart>`. None of the :doc:`fix\_modify <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 <Howto_output>`.
No information about this fix is written to :doc:`binary restart files
<restart>`. None of the :doc:`fix\_modify <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 <Howto_output>`.
No parameter of this fix can be used with the *start/stop* keywords of
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
the :doc:`run <run>` command. This fix is not invoked during
:doc:`energy minimization <minimize>`.
Restrictions
""""""""""""
@ -192,17 +193,18 @@ Any dimension (xyz) that has a reflecting wall must be non-periodic.
A reflecting wall should not be used with rigid bodies such as those
defined by a "fix rigid" command. This is because the wall/reflect
displaces atoms directly rather than exerts a force on them. For
rigid bodies, use a soft wall instead, such as :doc:`fix wall/lj93 <fix_wall>`. LAMMPS will flag the use of a rigid
fix with fix wall/reflect with a warning, but will not generate an
error.
rigid bodies, use a soft wall instead, such as :doc:`fix wall/lj93
<fix_wall>`. LAMMPS will flag the use of a rigid fix with fix
wall/reflect with a warning, but will not generate an error.
Related commands
""""""""""""""""
:doc:`fix wall/lj93 <fix_wall>`, :doc:`fix oneway <fix_oneway>`
**Default:** none
**Default:**
The default for the units keyword is lattice.
----------

View File

@ -1,98 +0,0 @@
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Commands_all.html)
:line
fix wall/stochastic command :h3
[Syntax:]
fix ID group-ID wall/reflect/stochastic reflectionstyle seed face pos temp velx vely velz accomx accomy accomz ... :pre
ID, group-ID are documented in "fix"_fix.html command :ulb,l
wall/reflect/stochastic = style name of this fix command :l
one or more face/arg pairs may be appended :l
reflectionstyle = diffusive or maxwell or cercignanilampis :l
seed = random seed for stochastic wall (must be less than 900000000) :l
face = {xlo} or {xhi} or {ylo} or {yhi} or {zlo} or {zhi} :l
{xlo},{ylo},{zlo} pos = EDGE or constant
EDGE = current lo edge of simulation box
constant = number like 0.0 or -30.0 (distance units)
temp = wall temperature
velx, vely, velz = wall velocity along x, y, z directions
accomx, accomy, accomz = accommodation coefficients along x, y, z directions (only for maxwell and cercignanilampis reflection style)
{xhi},{yhi},{zhi} pos = EDGE or constant or variable
EDGE = current hi edge of simulation box
constant = number like 50.0 or 100.3 (distance units)
temp = wall temperature
velx, vely, velz = wall velocity along x, y, z directions
accomx, accomy, accomz = accommodation coefficients along x, y, z directions (only for maxwell and cercignanilampis style) :pre
zero or more keyword/value pairs may be appended :l
keyword = {units} :l
{units} value = {lattice} or {box}
{lattice} = the wall position is defined in lattice units
{box} = the wall position is defined in simulation box units :pre
:ule
[Examples:]
fix zwalls all wall/reflect/stochastic diffusive 23424 zlo EDGE 300 0.1 0.1 0 zhi EDGE 200 0.1 0.1 0
fix ywalls all wall/reflect/stochastic maxwell 345533 ylo 5.0 300 0.1 0.0 0.0 0.8 yhi 10.0 300 0.1 0.0 0.0 0.8
fix xwalls all wall/reflect/stochastic cercignanilampis 2308 xlo 0.0 300 0.0 0.1 0.9 0.8 0.7 xhi EDGE 300 0.0 0.1 0 0.9 0.8 0.7 units box :pre
[Description:]
This fix models the stochastic and inelastic collisions between fluid atoms and a solid boundary. The solid surface with finite temperature and moving speed can exchange energy with the fluid atoms. Different from the command fix wall/reflect which is equivalent to the mirror reflection, the post collision velocity of the fluid atoms in the stochastic wall model is random. The randomness can come from many sources: thermal motion of solid atoms, the surface roughness, etc... Three stochastic wall models are implemented.
Diffusive wall (reflectionstyle = diffusive): all the gas atoms are
reflected diffusively. Their velocity distribution corresponds to the
equilibrium distribution at the wall temperature.
Maxwell model (reflectionstyle = maxwell): the reflection is partially
diffusive and partially specular. The accommodation coefficient is the
portion of the diffusive reflection "Maxwell"_#Maxwell.
Cercignani/Lampis model: 3 accommodations coefficients are used, two
velocity accommodation coefficients and one normal kinetic energy
accommodation "CL"_#CL, "To"_#To. The code will recognize automatically
the normal direction of the wall and the other two tangential
directions. For example, if accomx = 0.5, accomy = 0.2, accomz = 0.3 and
the wall is normal to direction y, accomx and accomz are the tangential
velocity accommodation coefficients and accomy is the normal kinetic
energy accommodation coefficients.
The {units} keyword determines the distance units used to define a wall
position. A {box} value selects standard distance units as defined by
the "units"_units.html command, e.g. Angstroms for units = real or
metal. A {lattice} value means the distance units are in lattice
spacings. The "lattice"_lattice.html command must have been previously
used to define the lattice spacings.
:line
[Restrictions:]
Due to the similarities, this fix has the same limitation as the the
wall/reflect. Any dimension (xyz) that has a wall must be non-periodic. It
should not be used with rigid bodies such as those defined by a "fix rigid"
command. Furthermore, the wall velocity must lie on the same plane as the wall. Package USER-MISC is required to use this fix.
[Related commands:]
"fix wall/reflect"_fix_wall_reflect.html,
[Default:] none
:line
:link(Maxwell)
[(Maxwell)] J.C. Maxwell, Philos. Tans. Royal Soc. London, 157: 49-88 (1867).
:link(CL)
[(Cercignani)] C. Cercignani and M. Lampis. Trans. Theory Stat. Phys. 1, 2, 101 (1971).
:link(To)
[(To)] Q.D. To, V.H. Vu, G. Lauriat, and C. Leonard. J. Math. Phys. 56, 103101 (2015).

View File

@ -0,0 +1,126 @@
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Commands_all.html)
:line
fix wall/reflect/stochastic command :h3
[Syntax:]
fix ID group-ID wall/reflect/stochastic rstyle seed face args ... keyword value ... :pre
ID, group-ID are documented in "fix"_fix.html command :ulb,l
wall/reflect/stochastic = style name of this fix command :l
rstyle = diffusive or maxwell or ccl :l
seed = random seed for stochasticity (positive integer) :l
one or more face/args pairs may be appended :l
face = {xlo} or {xhi} or {ylo} or {yhi} or {zlo} or {zhi} :l
args = pos temp velx vely velz accomx accomy accomz
pos = EDGE or constant
EDGE = current lo or hi edge of simulation box
constant = number like 0.0 or 30.0 (distance units)
temp = wall temperature (temperature units)
velx,vely,velz = wall velocity in x,y,z directions (velocity units)
accomx,accomy,accomz = accommodation coeffs in x,y,z directions (unitless)
not specified for rstyle = diffusive
single accom coeff specified for rstyle maxwell
all 3 coeffs specified for rstyle cll :pre
zero or more keyword/value pairs may be appended :l
keyword = {units} :l
{units} value = {lattice} or {box}
{lattice} = the wall position is defined in lattice units
{box} = the wall position is defined in simulation box units :pre
:ule
[Examples:]
fix zwalls all wall/reflect/stochastic diffusive 23424 zlo EDGE 300 0.1 0.1 0 zhi EDGE 200 0.1 0.1 0
fix ywalls all wall/reflect/stochastic maxwell 345533 ylo 5.0 300 0.1 0.0 0.0 0.8 yhi 10.0 300 0.1 0.0 0.0 0.8
fix xwalls all wall/reflect/stochastic cercignanilampis 2308 xlo 0.0 300 0.0 0.1 0.9 0.8 0.7 xhi EDGE 300 0.0 0.1 0 0.9 0.8 0.7 units box :pre
[Description:]
Bound the simulation with one or more walls which reflect particles
in the specified group when they attempt to move through them.
Reflection means that if an atom moves outside the wall on a timestep
(e.g. due to the "fix nve"_fix_nve.html command), then it is put back
inside the wall with a changed velocity.
This fix models treats the wall as a moving solid boundary with a
finite temperature, which can exchange energy with particles that
collide with it. This is different than the simpler "fix
wall/reflect"_fix_wall_reflect.html command which models mirror
reflection. For this fix, the post collision velocity of each
particle is treated stochastically. The randomness can come from many
sources: thermal motion of the wall atoms, surface roughness, etc.
Three stochastic reflection models are currently implemented.
For rstyle {diffusive}, particles are reflected diffusively. Their
velocity distribution corresponds to an equilibrium distribution of
particles at the wall temperature. No accomondation coeffs are
specified.
For rstyle {maxwell}, particle reflection is Maxwellian which means
partially diffusive and partially specular ("Maxwell"_#Maxwell). A
single accommodation coeff is specified which must be between 0.0 and
1.0 inclusive. It determines the fraction of the collision which is
diffusive versus specular. An accomodation coeff of 1.0 is fully
diffusive; a coeff of 0.0 is fully specular.
For rstyle {cll}, particle collisons are computed by the
Cercignani/Lampis model. See "CL"_#CL and "To"_#To for details.
Three accommodations coefficient are specified. Each must be between
0.0 and 1.0 inclusive. Two are velocity accommodation coefficients;
one is a normal kinetic energy accommodation. The normal coeff is the
one corresponding to the normal of the wall itself. For example if
the wall is {ylo} or {yhi}, {accomx} and {accomz} are the tangential
velocity accommodation coefficients, and {accomy} is the normal
kinetic energy accommodation coefficient.
The optional {units} keyword determines the distance units used to
define a wall position. A {box} value selects standard distance units
as defined by the "units"_units.html command, e.g. Angstroms for units
= real or metal. A {lattice} value means the distance units are in
lattice spacings. The "lattice"_lattice.html command must have been
previously used to define the lattice spacings.
:line
[Restrictions:]
This fix has the same limitations as the "fix
wall/reflect"_fix_wall_reflect.html command. Any dimension (xyz) that
has a wall must be non-periodic. It should not be used with rigid
bodies such as those defined by the "fix rigid"_fix_rigid.html
command. The wall velocity must lie on the same plane as the wall
itself.
This fix is part of the USER-MISC package. It is only enabled if
LAMMPS was built with that package. See the "Build
package"_Build_package.html doc page for more info.
[Related commands:]
"fix wall/reflect"_fix_wall_reflect.html
[Default:]
The default for the units keyword is lattice.
:line
:link(Maxwell)
[(Maxwell)] J.C. Maxwell, Philos. Tans. Royal Soc. London, 157: 49-88
(1867).
:link(CL)
[(Cercignani)] C. Cercignani and M. Lampis. Trans. Theory
Stat. Phys. 1, 2, 101 (1971).
:link(To)
[(To)] Q.D. To, V.H. Vu, G. Lauriat, and
C. Leonard. J. Math. Phys. 56, 103101 (2015).

View File

@ -29,7 +29,7 @@
using namespace LAMMPS_NS;
using namespace FixConst;
enum{NONE=0,DIFFUSIVE=1,MAXWELL=2,CERCIGNANILAMPIS=3};
enum{NONE,DIFFUSIVE,MAXWELL,CCL};
/* ---------------------------------------------------------------------- */
@ -51,16 +51,16 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) :
nwall = 0;
int scaleflag = 1;
reflectionstyle = NONE;
rstyle = NONE;
if (strcmp(arg[3],"diffusive") == 0) {
reflectionstyle = DIFFUSIVE;
rstyle = DIFFUSIVE;
arginc = 6;
} else if (strcmp(arg[3],"maxwell") == 0) {
reflectionstyle = MAXWELL;
rstyle = MAXWELL;
arginc = 7;
} else if (strcmp(arg[3],"cercignanilampis") == 0) {
reflectionstyle = CERCIGNANILAMPIS;
} else if (strcmp(arg[3],"ccl") == 0) {
rstyle = CCL;
arginc = 9;
} else error->all(FLERR,"Illegal fix wall/reflect/stochastic command");
@ -73,7 +73,7 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) :
if ((strcmp(arg[iarg],"xlo") == 0) || (strcmp(arg[iarg],"xhi") == 0) ||
(strcmp(arg[iarg],"ylo") == 0) || (strcmp(arg[iarg],"yhi") == 0) ||
(strcmp(arg[iarg],"zlo") == 0) || (strcmp(arg[iarg],"zhi") == 0)) {
if (iarg+2 > narg)
if (iarg+arginc > narg)
error->all(FLERR,"Illegal fix wall/reflect/stochastic command");
int newwall;
@ -108,13 +108,15 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) :
int dim = wallwhich[nwall] / 2;
if ((wallvel[nwall][dir] !=0) & (dir == dim))
error->all(FLERR,"The wall velocity must be tangential");
if (reflectionstyle == CERCIGNANILAMPIS) {
// DIFFUSIVE = no accomodation coeffs
// MAXWELL = one for all dimensions
// CLL = one for each dimension
if (rstyle == CCL)
wallaccom[nwall][dir]= force->numeric(FLERR,arg[iarg+dir+6]);
} else if (reflectionstyle == MAXWELL) {
// one accommodation coefficient for all directions
else if (rstyle == MAXWELL)
wallaccom[nwall][dir]= force->numeric(FLERR,arg[iarg+6]);
}
}
nwall++;
@ -227,7 +229,7 @@ void FixWallReflectStochastic::wall_particle(int m, int which, double coord)
// only needed for Maxwell model
if (reflectionstyle == MAXWELL) difftest = random->uniform();
if (rstyle == MAXWELL) difftest = random->uniform();
for (dir = 0; dir < 3; dir++) {
@ -237,14 +239,14 @@ void FixWallReflectStochastic::wall_particle(int m, int which, double coord)
// diffusive reflection
if (reflectionstyle == DIFFUSIVE) {
if (rstyle == DIFFUSIVE) {
if (dir != dim)
v[i][dir] = wallvel[m][dir] + random->gaussian(0,factor);
else v[i][dir] = sign*random->rayleigh(factor);
// Maxwell reflection
} else if (reflectionstyle == MAXWELL) {
} else if (rstyle == MAXWELL) {
if (difftest < wallaccom[m][dir]) {
if (dir != dim)
v[i][dir] = wallvel[m][dir] + random->gaussian(0,factor);
@ -255,7 +257,7 @@ void FixWallReflectStochastic::wall_particle(int m, int which, double coord)
// Cercignani Lampis reflection
} else if (reflectionstyle == CERCIGNANILAMPIS) {
} else if (rstyle == CCL) {
if (dir != dim)
v[i][dir] = wallvel[m][dir] +
random->gaussian((1-wallaccom[m][dir]) *

View File

@ -33,7 +33,7 @@ class FixWallReflectStochastic : public FixWallReflect {
private:
int seedfix;
double walltemp[6],wallvel[6][3],wallaccom[6][3];
int reflectionstyle;
int rstyle;
class RanMars *random;