diff --git a/doc/src/Howto_viscosity.rst b/doc/src/Howto_viscosity.rst index dff414ce9d..cb5b4f87c8 100644 --- a/doc/src/Howto_viscosity.rst +++ b/doc/src/Howto_viscosity.rst @@ -1,10 +1,11 @@ Calculate viscosity =================== -The shear viscosity eta of a fluid can be measured in at least 5 ways +The shear viscosity eta of a fluid can be measured in at least 6 ways using various options in LAMMPS. See the examples/VISCOSITY directory for scripts that implement the 5 methods discussed here for a simple -Lennard-Jones fluid model. Also, see the :doc:`Howto kappa ` doc page for an analogous discussion for +Lennard-Jones fluid model and 1 method for SPC/E water model. +Also, see the :doc:`Howto kappa ` doc page for an analogous discussion for thermal conductivity. Eta is a measure of the propensity of a fluid to transmit momentum in @@ -130,9 +131,24 @@ time-integrated momentum fluxes play the role of Cartesian coordinates, whose mean-square displacement increases linearly with time at sufficiently long times. +The sixth is periodic perturbation method. It is also a non-equilibrium MD method. +However, instead of measure the momentum flux in response of applied velocity gradient, +it measures the velocity profile in response of applied stress. +A cosine-shaped periodic acceleration is added to the system via the +:doc:`fix accelerate/cos ` command, +and the :doc:`compute viscosity/cos` command is used to monitor the +generated velocity profile and remove the velocity bias before thermostating. + +.. note:: + + An article by :ref:`(Hess) ` discussed the accuracy and efficiency of these methods. + ---------- .. _Daivis-viscosity: **(Daivis and Todd)** Daivis and Todd, Nonequilibrium Molecular Dynamics (book), Cambridge University Press, https://doi.org/10.1017/9781139017848, (2017). + +.. _Hess3: +**(Hess)** Hess, B. The Journal of Chemical Physics 2002, 116 (1), 209-217. diff --git a/examples/USER/misc/viscosity/README b/examples/USER/misc/viscosity/README deleted file mode 100644 index 1221509ea7..0000000000 --- a/examples/USER/misc/viscosity/README +++ /dev/null @@ -1,5 +0,0 @@ -The input script in in.1000SPCE.lmp gives an example on how to calculate -the shear viscosity of SPCE water with the periodic perturbation method. -For a production run, much longer simulation is required. -Note that the acceleration amplitude of `fix accelerate/cos` should be carefully chosen, -and an extrapolation is generally required to get the viscosity at zero-shear. diff --git a/examples/VISCOSITY/README b/examples/VISCOSITY/README index 38bee0c58d..8235fa1f77 100644 --- a/examples/VISCOSITY/README +++ b/examples/VISCOSITY/README @@ -1,5 +1,6 @@ -This directory has 5 scripts that compute the viscosity (eta) of a -Lennard-Jones fluid using 5 different methods. See the discussion in +This directory has 6 scripts that compute the viscosity (eta) of fluid +using 6 different methods. 5 of them are for a Lennard-Jones fluid +and the last one is for SPC/E water model. See the discussion in Section 6.21 of the manual for an overview of the methods and pointers to doc pages for the commands which implement them. Citations for the various methods can also be found in the manual. @@ -10,7 +11,7 @@ enough to generate good statistics and highly accurate results. ------------- -These are the 5 methods for computing viscosity. The first 3 are +These are the 5 methods for computing viscosity of a LJ fluid. The first 3 are non-equilibrium methods; the last 2 are equilibrium methods. in.wall = move a wall to shear the fluid between two walls @@ -89,3 +90,18 @@ heat/flux doc page - the resulting value prints at the end of the run and is in the log file eta = 1.07 + +------------- + +in.cos.1000SPCE is an example script of using cosine periodic perturbation method +to calculate the viscosity of SPC/E water model. + +The reciprocal of eta is computed within the script, and printed out as v_invVis +in thermo_style command. The result will converge after hundreds of picoseconds. +Then eta is obtained from the reciprocal of time average of v_invVis. + +eta = 0.75 mPa*s + +Note that the calculated viscosity by this method decreases with increased acceleration. +It is therefore generally necessary to perform calculation at different accelerations +and extrapolate the viscosity to zero shear. diff --git a/examples/USER/misc/viscosity/data.1000SPCE.lmp b/examples/VISCOSITY/data.cos.1000SPCE similarity index 100% rename from examples/USER/misc/viscosity/data.1000SPCE.lmp rename to examples/VISCOSITY/data.cos.1000SPCE diff --git a/examples/USER/misc/viscosity/in.1000SPCE.lmp b/examples/VISCOSITY/in.cos.1000SPCE similarity index 94% rename from examples/USER/misc/viscosity/in.1000SPCE.lmp rename to examples/VISCOSITY/in.cos.1000SPCE index 1da02bae22..415341f0eb 100644 --- a/examples/USER/misc/viscosity/in.1000SPCE.lmp +++ b/examples/VISCOSITY/in.cos.1000SPCE @@ -15,7 +15,7 @@ angle_style harmonic dihedral_style none improper_style none -read_data data.1000SPCE.lmp +read_data data.cos.1000SPCE variable T equal 300 variable P equal 1.0 @@ -29,7 +29,7 @@ fix com all momentum 100 linear 1 1 1 fix rigid all shake 1e-4 20 0 b 1 a 1 # Viscosity ################################## -variable A equal 0.02e-5 # angstrom/fs^2 +variable A equal 0.05e-5 # angstrom/fs^2 fix cos all accelerate/cos ${A} compute cos all viscosity/cos diff --git a/examples/USER/misc/viscosity/log.1000SPCE.lammps b/examples/VISCOSITY/log.30Apr20.cos.1000SPCE.g++.1 similarity index 100% rename from examples/USER/misc/viscosity/log.1000SPCE.lammps rename to examples/VISCOSITY/log.30Apr20.cos.1000SPCE.g++.1