From e01ef140253b9d58ba4f19347e07390ca3dc0234 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 12 Jun 2022 10:06:16 -0600 Subject: [PATCH 01/57] Adding documentation and integration fix --- doc/src/atom_style.rst | 14 ++++--- doc/src/fix_temp_integrate.rst | 75 ++++++++++++++++++++++++++++++++++ doc/src/set.rst | 9 +++- 3 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 doc/src/fix_temp_integrate.rst diff --git a/doc/src/atom_style.rst b/doc/src/atom_style.rst index bd0c193962..5b93c56887 100644 --- a/doc/src/atom_style.rst +++ b/doc/src/atom_style.rst @@ -121,6 +121,8 @@ quantities. +--------------+-----------------------------------------------------+--------------------------------------+ | *sphere* | diameter, mass, angular velocity | granular models | +--------------+-----------------------------------------------------+--------------------------------------+ +| *sphere/temp*| diameter, mass, angular velocity, temperature | thermal granular models | ++--------------+-----------------------------------------------------+--------------------------------------+ | *bpm/sphere* | diameter, mass, angular velocity, quaternion | granular bonded particle models (BPM)| +--------------+-----------------------------------------------------+--------------------------------------+ | *spin* | magnetic moment | system with magnetic particles | @@ -144,7 +146,7 @@ quantities. output the custom values. All of the above styles define point particles, except the *sphere*, -*bpm/sphere*, *ellipsoid*, *electron*, *peri*, *wavepacket*, *line*, +*sphere/temp*, *bpm/sphere*, *ellipsoid*, *electron*, *peri*, *wavepacket*, *line*, *tri*, and *body* styles, which define finite-size particles. See the :doc:`Howto spherical ` page for an overview of using finite-size particle models with LAMMPS. @@ -154,15 +156,15 @@ per-type basis, using the :doc:`mass ` command, The finite-size particle styles assign mass to individual particles on a per-particle basis. -For the *sphere* and *bpm/sphere* styles, the particles are spheres and each stores a -per-particle diameter and mass. If the diameter > 0.0, the particle -is a finite-size sphere. If the diameter = 0.0, it is a point -particle. Note that by use of the *disc* keyword with the :doc:`fix +For the *sphere*, *sphere/temp*, and *bpm/sphere* styles, the particles +are spheres and each stores a per-particle diameter and mass. If the +diameter > 0.0, the particle is a finite-size sphere. If the diameter = 0.0, +it is a point particle. Note that by use of the *disc* keyword with the :doc:`fix nve/sphere `, :doc:`fix nvt/sphere `, :doc:`fix nph/sphere `, :doc:`fix npt/sphere ` commands for the *sphere* style, spheres can be effectively treated as 2d discs for a 2d simulation if desired. See also the :doc:`set -density/disc ` command. The *sphere* and *bpm/sphere* styles take an optional 0 +density/disc ` command. These styles take an optional 0 or 1 argument. A value of 0 means the radius of each sphere is constant for the duration of the simulation. A value of 1 means the radii may vary dynamically during the simulation, e.g. due to use of diff --git a/doc/src/fix_temp_integrate.rst b/doc/src/fix_temp_integrate.rst new file mode 100644 index 0000000000..c2f1257075 --- /dev/null +++ b/doc/src/fix_temp_integrate.rst @@ -0,0 +1,75 @@ +.. index:: fix temp/integrate + +fix temp/integrate command +========================== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID temp/integrate style values ... + +* ID, group-ID are documented in :doc:`fix ` command +* temp/integrate = style name of this fix command +* one style with corresponding value(s) needs to be listed + + .. parsed-literal:: + + style = *constant* or *type* + *constant* = cp + cp = value of specifc heat (energy/(mass * temperature) units) + *type* = cp1 ... cpN + cpN = value of specifc heat for type N (energy/(mass * temperature) units) + +* + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all temp/integrate constant 1.0 + fix 1 all temp/integrate type 1.0 0.5 + +Description +""""""""""" + +Perform plain time integration to update temperature for atoms in the +group each timestep. The specific heat of atoms can be defined using either +the *constant* or *type* keywords. For style *constant*, the specific heat +is a constant value *cp* for all atoms. For style *type*, *N* different values +of the specific heat are defined, one for each of the *N* types of atoms. + + + +---------- + +.. include:: accel_styles.rst + +---------- + +Restart, fix_modify, output, run start/stop, minimize info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +No information about this fix is written to :doc:`binary restart files `. 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 `. + +Restrictions +"""""""""""" + +This fix requires that atoms store temperature and a heat flux +as defined by the :doc:`atom_style sphere/temp ` command. + +Related commands +"""""""""""""""" + +:doc:`pair granular ` + +Default +""""""" + +none diff --git a/doc/src/set.rst b/doc/src/set.rst index cc1d2766e3..d11d3fc229 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -18,7 +18,7 @@ Syntax *dipole/random* or *quat* or *spin* or *spin/random* or *quat* or *quat/random* or *diameter* or *shape* or *length* or *tri* or *theta* or *theta/random* or *angmom* or - *omega* or *mass* or *density* or *density/disc* or + *omega* or *mass* or *density* or *density/disc* or *temperature* or *volume* or *image* or *bond* or *angle* or *dihedral* or *improper* or *sph/e* or *sph/cv* or *sph/rho* or *smd/contact/radius* or *smd/mass/density* or *dpd/theta* or @@ -95,6 +95,8 @@ Syntax value can be an atom-style variable (see below) *density/disc* value = particle density for a 2d disc or ellipse (mass/distance\^2 units) value can be an atom-style variable (see below) + *temperature* value = particle temperature for a finite-size particle particle (temperature units)s + value can be an atom-style variable (see below) *volume* value = particle volume for Peridynamic particle (distance\^3 units) value can be an atom-style variable (see below) *image* nx ny nz @@ -410,6 +412,11 @@ assumed to be in mass/distance\^2 units). If none of these cases are valid, then the mass is set to the density value directly (the input density is assumed to be in mass units). +Keyword *temperature* sets the temperature of a finite-size particle +as defined by the GRANULAR package. Currently, only +:doc:`atom_style sphere/temperature ` defines particles +with this attribute. The values for the temperature must be positive. + Keyword *volume* sets the volume of all selected particles. Currently, only the :doc:`atom_style peri ` command defines particles with a volume attribute. Note that this command does not adjust the From c6d59fc5267bede32772403f683c136e36d8528a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 12 Jun 2022 10:09:26 -0600 Subject: [PATCH 02/57] adding documentation and integration fix --- src/.gitignore | 6 +- src/GRANULAR/atom_vec_sphere_temperature.cpp | 160 +++++++++++++++++++ src/GRANULAR/atom_vec_sphere_temperature.h | 51 ++++++ src/GRANULAR/fix_temp_integrate.cpp | 142 ++++++++++++++++ src/GRANULAR/fix_temp_integrate.h | 50 ++++++ src/atom.cpp | 18 +++ src/atom.h | 2 + src/set.cpp | 19 ++- 8 files changed, 445 insertions(+), 3 deletions(-) create mode 100644 src/GRANULAR/atom_vec_sphere_temperature.cpp create mode 100644 src/GRANULAR/atom_vec_sphere_temperature.h create mode 100644 src/GRANULAR/fix_temp_integrate.cpp create mode 100644 src/GRANULAR/fix_temp_integrate.h diff --git a/src/.gitignore b/src/.gitignore index 6657256e8f..7a6bc1beb4 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -421,14 +421,14 @@ /atom_vec_full.h /atom_vec_full_hars.cpp /atom_vec_full_hars.h -/atom_vec_granular.cpp -/atom_vec_granular.h /atom_vec_molecular.cpp /atom_vec_molecular.h /atom_vec_oxdna.cpp /atom_vec_oxdna.h /atom_vec_peri.cpp /atom_vec_peri.h +/atom_vec_sphere_temperature.cpp +/atom_vec_sphere_temperature.h /atom_vec_template.cpp /atom_vec_template.h /body_nparticle.cpp @@ -1510,6 +1510,8 @@ /fix_smd_wall_surface.h /fix_srp.cpp /fix_srp.h +/fix_temp_integrate.cpp +/fix_temp_integrate.h /fix_tfmc.cpp /fix_tfmc.h /fix_ttm.cpp diff --git a/src/GRANULAR/atom_vec_sphere_temperature.cpp b/src/GRANULAR/atom_vec_sphere_temperature.cpp new file mode 100644 index 0000000000..5b62a2c279 --- /dev/null +++ b/src/GRANULAR/atom_vec_sphere_temperature.cpp @@ -0,0 +1,160 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "atom_vec_sphere_temperature.h" + +#include "atom.h" +#include "error.h" +#include "fix.h" +#include "fix_adapt.h" +#include "math_const.h" +#include "modify.h" + +using namespace LAMMPS_NS; +using namespace MathConst; + +/* ---------------------------------------------------------------------- */ + +AtomVecSphereTemperature::AtomVecSphereTemperature(LAMMPS *lmp) : AtomVec(lmp) +{ + mass_type = PER_ATOM; + molecular = Atom::ATOMIC; + + atom->sphere_flag = 1; + atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1; + atom->temperature_flag = atom->heatflux_flag = 1; + + // strings with peratom variables to include in each AtomVec method + // strings cannot contain fields in corresponding AtomVec default strings + // order of fields in a string does not matter + // except: fields_data_atom & fields_data_vel must match data file + + fields_grow = {"radius", "rmass", "omega", "torque", "temperature", "heatflux"}; + fields_copy = {"radius", "rmass", "omega", "temperature"}; + fields_comm_vel = {"omega", "temperature"}; + fields_reverse = {"torque", "heatflux"}; + fields_border = {"radius", "rmass", "temperature"}; + fields_border_vel = {"radius", "rmass", "omega", "temperature"}; + fields_exchange = {"radius", "rmass", "omega", "temperature"}; + fields_restart = {"radius", "rmass", "omega", "temperature"}; + fields_create = {"radius", "rmass", "omega", "temperature"}; + fields_data_atom = {"id", "type", "radius", "rmass", "x", "temperature"}; + fields_data_vel = {"id", "v", "omega"}; +} + +/* ---------------------------------------------------------------------- + process sub-style args + optional arg = 0/1 for static/dynamic particle radii +------------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::process_args(int narg, char **arg) +{ + if (narg != 0 && narg != 1) error->all(FLERR, "Illegal atom_style sphere command"); + + radvary = 0; + if (narg == 1) { + radvary = utils::numeric(FLERR, arg[0], true, lmp); + if (radvary < 0 || radvary > 1) error->all(FLERR, "Illegal atom_style sphere command"); + } + + // dynamic particle radius and mass must be communicated every step + + if (radvary) { + fields_comm = {"radius", "rmass"}; + fields_comm_vel = {"radius", "rmass", "omega"}; + } + + // delay setting up of fields until now + + setup_fields(); +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::init() +{ + AtomVec::init(); + + // check if optional radvary setting should have been set to 1 + + for (int i = 0; i < modify->nfix; i++) + if (strcmp(modify->fix[i]->style, "adapt") == 0) { + auto fix = dynamic_cast(modify->fix[i]); + if (fix->diamflag && radvary == 0) + error->all(FLERR, "Fix adapt changes particle radii but atom_style sphere is not dynamic"); + } +} + +/* ---------------------------------------------------------------------- + set local copies of all grow ptrs used by this class, except defaults + needed in replicate when 2 atom classes exist and it calls pack_restart() +------------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::grow_pointers() +{ + radius = atom->radius; + rmass = atom->rmass; + omega = atom->omega; +} + +/* ---------------------------------------------------------------------- + initialize non-zero atom quantities +------------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::create_atom_post(int ilocal) +{ + radius[ilocal] = 0.5; + rmass[ilocal] = 4.0 * MY_PI / 3.0 * 0.5 * 0.5 * 0.5; +} + +/* ---------------------------------------------------------------------- + modify what AtomVec::data_atom() just unpacked + or initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::data_atom_post(int ilocal) +{ + radius_one = 0.5 * atom->radius[ilocal]; + radius[ilocal] = radius_one; + if (radius_one > 0.0) rmass[ilocal] *= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; + + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); + + omega[ilocal][0] = 0.0; + omega[ilocal][1] = 0.0; + omega[ilocal][2] = 0.0; +} + +/* ---------------------------------------------------------------------- + modify values for AtomVec::pack_data() to pack +------------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::pack_data_pre(int ilocal) +{ + radius_one = radius[ilocal]; + rmass_one = rmass[ilocal]; + + radius[ilocal] *= 2.0; + if (radius_one != 0.0) + rmass[ilocal] = rmass_one / (4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one); +} + +/* ---------------------------------------------------------------------- + unmodify values packed by AtomVec::pack_data() +------------------------------------------------------------------------- */ + +void AtomVecSphereTemperature::pack_data_post(int ilocal) +{ + radius[ilocal] = radius_one; + rmass[ilocal] = rmass_one; +} diff --git a/src/GRANULAR/atom_vec_sphere_temperature.h b/src/GRANULAR/atom_vec_sphere_temperature.h new file mode 100644 index 0000000000..6b1ca6f390 --- /dev/null +++ b/src/GRANULAR/atom_vec_sphere_temperature.h @@ -0,0 +1,51 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef ATOM_CLASS +// clang-format off +AtomStyle(sphere,AtomVecSphereTemperature); +// clang-format on +#else + +#ifndef LMP_ATOM_VEC_SPHERE_TEMPERATURE_H +#define LMP_ATOM_VEC_SPHERE_TEMPERATURE_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecSphereTemperature : public AtomVec { + public: + AtomVecSphereTemperature(class LAMMPS *); + void process_args(int, char **) override; + void init() override; + + void grow_pointers() override; + void create_atom_post(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; + + private: + double *radius, *rmass; + double **omega; + double *temperature, *heatflux; + + int radvary; + double radius_one, rmass_one; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/GRANULAR/fix_temp_integrate.cpp b/src/GRANULAR/fix_temp_integrate.cpp new file mode 100644 index 0000000000..bb351d7db4 --- /dev/null +++ b/src/GRANULAR/fix_temp_integrate.cpp @@ -0,0 +1,142 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "fix_temp_integrate.h" + +#include "atom.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "respa.h" +#include "update.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +enum {NONE, CONSTANT, TYPE}; + +/* ---------------------------------------------------------------------- */ + +FixTempIntegrate::FixTempIntegrate(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg < 4) error->all(FLERR,"Illegal fix command"); + + cp_style = NONE; + + int ntypes = atom->ntypes; + int iarg = 3; + while (iarg < narg) { + if (strcmp(arg[iarg+1],"constant") == 0) { + if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); + cp_style = CONSTANT; + cp = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (cp < 0.0) error->all(FLERR,"Illegal fix command"); + iarg += 2; + } else if (strcmp(arg[iarg+1],"type") == 0) { + if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); + cp_style = TYPE; + memory->create(cp_type,ntypes+1,"fix/temp/integrate:cp_type"); + for (int i = 1; i <= ntypes; i++) { + cp_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); + if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); + } + iarg += 1+ntypes; + } else { + error->all(FLERR,"Illegal fix command"); + } + iarg += 1; + } + + if (cp_style == NONE) + error->all(FLERR, "Must specify specific heat in fix temp/integrate"); + dynamic_group_allow = 1; + time_integrate = 1; +} + +/* ---------------------------------------------------------------------- */ + +int FixTempIntegrate::setmask() +{ + int mask = 0; + mask |= FINAL_INTEGRATE; + mask |= FINAL_INTEGRATE_RESPA; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixTempIntegrate::init() +{ + dt = update->dt; + + if (!atom->temperature_flag) + error->all(FLERR,"Fix temp/integrate requires atom style with temperature property"); + if (!atom->heatflux_flag) + error->all(FLERR,"Fix temp/integrate requires atom style with heatflux property"); +} + +/* ---------------------------------------------------------------------- */ + +void FixTempIntegrate::final_integrate() +{ + // update temperature of atoms in group + + double *temperature = atom->temperature; + double *heatflux = atom->heatflux; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + temperature[i] += dt * heatflux[i] / (calc_cp(i) * rmass[i]); + } + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + temperature[i] += dt * heatflux[i] / (calc_cp(i) * mass[type[i]]); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixTempIntegrate::final_integrate_respa(int ilevel, int /*iloop*/) +{ + dt = update->dt; + final_integrate(); +} + +/* ---------------------------------------------------------------------- */ + +void FixTempIntegrate::reset_dt() +{ + dt = update->dt; +} + +/* ---------------------------------------------------------------------- */ + +double FixTempIntegrate::calc_cp(int i) +{ + if (cp_style == TYPE) { + return cp_type[atom->type[i]]; + } else { + return cp; + } +} diff --git a/src/GRANULAR/fix_temp_integrate.h b/src/GRANULAR/fix_temp_integrate.h new file mode 100644 index 0000000000..738cb28a6f --- /dev/null +++ b/src/GRANULAR/fix_temp_integrate.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(temp/integrate,FixTempIntegrate); +// clang-format on +#else + +#ifndef LMP_FIX_TEMP_INTEGRATE_H +#define LMP_FIX_TEMP_INTEGRATE_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixTempIntegrate : public Fix { + public: + FixTempIntegrate(class LAMMPS *, int, char **); + + int setmask() override; + void init() override; + void final_integrate() override; + void final_integrate_respa(int, int) override; + void reset_dt() override; + + protected: + double dt; + double cp, *cp_type; + int cp_style; + + int mass_require; + + double calc_cp(int); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/atom.cpp b/src/atom.cpp index 8b3ab8c75d..ce66742779 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -123,6 +123,8 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) radius = rmass = nullptr; ellipsoid = line = tri = body = nullptr; quat = nullptr; + temperature = nullptr; + heatflux = nullptr; // molecular systems @@ -410,6 +412,9 @@ void Atom::peratom_create() add_peratom("tri",&tri,INT,0); add_peratom("body",&body,INT,0); + add_peratom("temperature",&temperature,DOUBLE,0); + add_peratom("heatflux",&heatflux,DOUBLE,0); + // BPM package add_peratom("quat",&quat,DOUBLE,4); @@ -612,6 +617,7 @@ void Atom::set_atomflag_defaults() molecule_flag = molindex_flag = molatom_flag = 0; q_flag = mu_flag = 0; rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0; + temperature_flag = heatflux_flag = 0; vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0; cs_flag = csforce_flag = vforce_flag = ervelforce_flag = etag_flag = 0; rho_flag = esph_flag = cv_flag = vest_flag = 0; @@ -2602,6 +2608,14 @@ length of the data area, and a short description. - double - 4 - four quaternion components of the particles + * - temperature + - double + - 1 + - temperature of the particles + * - heatflux + - double + - 1 + - heatflux of the particles * - i_name - int - 1 @@ -2658,6 +2672,8 @@ void *Atom::extract(const char *name) if (strcmp(name,"tri") == 0) return (void *) tri; if (strcmp(name,"body") == 0) return (void *) body; if (strcmp(name,"quat") == 0) return (void *) quat; + if (strcmp(name,"temperature") == 0) return (void *) temperature; + if (strcmp(name,"heatflux") == 0) return (void *) heatflux; if (strcmp(name,"vfrac") == 0) return (void *) vfrac; if (strcmp(name,"s0") == 0) return (void *) s0; @@ -2781,6 +2797,8 @@ int Atom::extract_datatype(const char *name) if (strcmp(name,"tri") == 0) return LAMMPS_INT; if (strcmp(name,"body") == 0) return LAMMPS_INT; if (strcmp(name,"quat") == 0) return LAMMPS_DOUBLE_2D; + if (strcmp(name,"temperature") == 0) return LAMMPS_DOUBLE; + if (strcmp(name,"heatflux") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"vfrac") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"s0") == 0) return LAMMPS_DOUBLE; diff --git a/src/atom.h b/src/atom.h index 499e5f0d0f..7ac459317c 100644 --- a/src/atom.h +++ b/src/atom.h @@ -80,6 +80,7 @@ class Atom : protected Pointers { double **omega, **angmom, **torque; int *ellipsoid, *line, *tri, *body; double **quat; + double *temperature, *heatflux; // molecular systems @@ -182,6 +183,7 @@ class Atom : protected Pointers { int molecule_flag, molindex_flag, molatom_flag; int q_flag, mu_flag; int rmass_flag, radius_flag, omega_flag, torque_flag, angmom_flag, quat_flag; + int temperature_flag, heatflux_flag; int vfrac_flag, spin_flag, eradius_flag, ervel_flag, erforce_flag; int cs_flag, csforce_flag, vforce_flag, ervelforce_flag, etag_flag; int rho_flag, esph_flag, cv_flag, vest_flag; diff --git a/src/set.cpp b/src/set.cpp index 2843281d78..7c759873a2 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -47,7 +47,7 @@ enum{ATOM_SELECT,MOL_SELECT,TYPE_SELECT,GROUP_SELECT,REGION_SELECT}; enum{TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET, MOLECULE,X,Y,Z,VX,VY,VZ,CHARGE,MASS,SHAPE,LENGTH,TRI, DIPOLE,DIPOLE_RANDOM,SPIN,SPIN_RANDOM,QUAT,QUAT_RANDOM, - THETA,THETA_RANDOM,ANGMOM,OMEGA, + THETA,THETA_RANDOM,ANGMOM,OMEGA,TEMPERATURE, DIAMETER,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER, SPH_E,SPH_CV,SPH_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, SMD_CONTACT_RADIUS,DPDTHETA,EPSILON,IVEC,DVEC,IARRAY,DARRAY}; @@ -389,6 +389,15 @@ void Set::command(int narg, char **arg) set(DENSITY); iarg += 2; + } else if (strcmp(arg[iarg],"temperature") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (!atom->temperature_flag) + error->all(FLERR,"Cannot set this attribute for this atom style"); + set(TEMPERATURE); + iarg += 2; + } else if (strcmp(arg[iarg],"volume") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); @@ -768,6 +777,7 @@ void Set::set(int keyword) case SHAPE: case DIAMETER: case DENSITY: + case TEMPERATURE: case QUAT: case IMAGE: if (modify->check_rigid_list_overlap(select)) @@ -1008,6 +1018,13 @@ void Set::set(int keyword) atom->omega[i][2] = zvalue; } + // set temperature of particle + + else if (keyword == ANGMOM) { + if (dvalue < 0.0) error->one(FLERR,"Invalid temperature in set command"); + atom->temperature[i] = dvalue; + } + // reset any or all of 3 image flags else if (keyword == IMAGE) { From 66188d9d572c7671b2a351fda086dee0ee89c37c Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 13 Jun 2022 09:00:15 -0600 Subject: [PATCH 03/57] unified naming scheme --- src/.gitignore | 4 ++-- ...emperature.cpp => atom_vec_sphere_temp.cpp} | 18 +++++++++--------- ...re_temperature.h => atom_vec_sphere_temp.h} | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) rename src/GRANULAR/{atom_vec_sphere_temperature.cpp => atom_vec_sphere_temp.cpp} (91%) rename src/GRANULAR/{atom_vec_sphere_temperature.h => atom_vec_sphere_temp.h} (84%) diff --git a/src/.gitignore b/src/.gitignore index 7a6bc1beb4..acb509551c 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -427,8 +427,8 @@ /atom_vec_oxdna.h /atom_vec_peri.cpp /atom_vec_peri.h -/atom_vec_sphere_temperature.cpp -/atom_vec_sphere_temperature.h +/atom_vec_sphere_temp.cpp +/atom_vec_sphere_temp.h /atom_vec_template.cpp /atom_vec_template.h /body_nparticle.cpp diff --git a/src/GRANULAR/atom_vec_sphere_temperature.cpp b/src/GRANULAR/atom_vec_sphere_temp.cpp similarity index 91% rename from src/GRANULAR/atom_vec_sphere_temperature.cpp rename to src/GRANULAR/atom_vec_sphere_temp.cpp index 5b62a2c279..d4e30e3154 100644 --- a/src/GRANULAR/atom_vec_sphere_temperature.cpp +++ b/src/GRANULAR/atom_vec_sphere_temp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "atom_vec_sphere_temperature.h" +#include "atom_vec_sphere_temp.h" #include "atom.h" #include "error.h" @@ -25,7 +25,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -AtomVecSphereTemperature::AtomVecSphereTemperature(LAMMPS *lmp) : AtomVec(lmp) +AtomVecSphereTemp::AtomVecSphereTemp(LAMMPS *lmp) : AtomVec(lmp) { mass_type = PER_ATOM; molecular = Atom::ATOMIC; @@ -57,7 +57,7 @@ AtomVecSphereTemperature::AtomVecSphereTemperature(LAMMPS *lmp) : AtomVec(lmp) optional arg = 0/1 for static/dynamic particle radii ------------------------------------------------------------------------- */ -void AtomVecSphereTemperature::process_args(int narg, char **arg) +void AtomVecSphereTemp::process_args(int narg, char **arg) { if (narg != 0 && narg != 1) error->all(FLERR, "Illegal atom_style sphere command"); @@ -81,7 +81,7 @@ void AtomVecSphereTemperature::process_args(int narg, char **arg) /* ---------------------------------------------------------------------- */ -void AtomVecSphereTemperature::init() +void AtomVecSphereTemp::init() { AtomVec::init(); @@ -100,7 +100,7 @@ void AtomVecSphereTemperature::init() needed in replicate when 2 atom classes exist and it calls pack_restart() ------------------------------------------------------------------------- */ -void AtomVecSphereTemperature::grow_pointers() +void AtomVecSphereTemp::grow_pointers() { radius = atom->radius; rmass = atom->rmass; @@ -111,7 +111,7 @@ void AtomVecSphereTemperature::grow_pointers() initialize non-zero atom quantities ------------------------------------------------------------------------- */ -void AtomVecSphereTemperature::create_atom_post(int ilocal) +void AtomVecSphereTemp::create_atom_post(int ilocal) { radius[ilocal] = 0.5; rmass[ilocal] = 4.0 * MY_PI / 3.0 * 0.5 * 0.5 * 0.5; @@ -122,7 +122,7 @@ void AtomVecSphereTemperature::create_atom_post(int ilocal) or initialize other atom quantities ------------------------------------------------------------------------- */ -void AtomVecSphereTemperature::data_atom_post(int ilocal) +void AtomVecSphereTemp::data_atom_post(int ilocal) { radius_one = 0.5 * atom->radius[ilocal]; radius[ilocal] = radius_one; @@ -139,7 +139,7 @@ void AtomVecSphereTemperature::data_atom_post(int ilocal) modify values for AtomVec::pack_data() to pack ------------------------------------------------------------------------- */ -void AtomVecSphereTemperature::pack_data_pre(int ilocal) +void AtomVecSphereTemp::pack_data_pre(int ilocal) { radius_one = radius[ilocal]; rmass_one = rmass[ilocal]; @@ -153,7 +153,7 @@ void AtomVecSphereTemperature::pack_data_pre(int ilocal) unmodify values packed by AtomVec::pack_data() ------------------------------------------------------------------------- */ -void AtomVecSphereTemperature::pack_data_post(int ilocal) +void AtomVecSphereTemp::pack_data_post(int ilocal) { radius[ilocal] = radius_one; rmass[ilocal] = rmass_one; diff --git a/src/GRANULAR/atom_vec_sphere_temperature.h b/src/GRANULAR/atom_vec_sphere_temp.h similarity index 84% rename from src/GRANULAR/atom_vec_sphere_temperature.h rename to src/GRANULAR/atom_vec_sphere_temp.h index 6b1ca6f390..f42b844886 100644 --- a/src/GRANULAR/atom_vec_sphere_temperature.h +++ b/src/GRANULAR/atom_vec_sphere_temp.h @@ -13,20 +13,20 @@ #ifdef ATOM_CLASS // clang-format off -AtomStyle(sphere,AtomVecSphereTemperature); +AtomStyle(sphere/temp,AtomVecSphereTemp); // clang-format on #else -#ifndef LMP_ATOM_VEC_SPHERE_TEMPERATURE_H -#define LMP_ATOM_VEC_SPHERE_TEMPERATURE_H +#ifndef LMP_ATOM_VEC_SPHERE_TEMP_H +#define LMP_ATOM_VEC_SPHERE_TEMP_H #include "atom_vec.h" namespace LAMMPS_NS { -class AtomVecSphereTemperature : public AtomVec { +class AtomVecSphereTemp : public AtomVec { public: - AtomVecSphereTemperature(class LAMMPS *); + AtomVecSphereTemp(class LAMMPS *); void process_args(int, char **) override; void init() override; From c0078fda059b734417d1080ee1b7bb54cdcf77ac Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 14 Jun 2022 09:27:14 -0600 Subject: [PATCH 04/57] Begin refactoring of pair granular --- src/GRANULAR/pair_granular.cpp | 825 ++++++++++----------------------- src/GRANULAR/pair_granular.h | 12 + 2 files changed, 248 insertions(+), 589 deletions(-) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 013c63172d..34edbc0ae3 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -28,6 +28,7 @@ #include "fix_neigh_history.h" #include "force.h" #include "math_const.h" +#include "math_extra.h" #include "math_special.h" #include "memory.h" #include "modify.h" @@ -149,37 +150,35 @@ PairGranular::~PairGranular() void PairGranular::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,nx,ny,nz; + double dx[3],fx[3],nx[3]; double radi,radj,radsum,rsq,r,rinv,factor_lj; double Reff, delta, dR, dR2, dist_to_contact; - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3; - double vtr1,vtr2,vtr3,vrel; + double vr[3],vnnr,vn[3],vt[3],wr[3],vtr[3],vrel[3]; + double temp[3], temp_dbl; - double knfac, damp_normal=0.0, damp_normal_prefactor; + double damp_normal=0.0, damp_normal_prefactor; double k_tangential, damp_tangential; double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; - double fs, fs1, fs2, fs3, tor1, tor2, tor3; + double magfs, fs[3], tor[3]; double mi,mj,meff; - double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; + double relrot[3],vrl[3]; - // for JKR - double R2, coh, F_pulloff, delta_pulloff, dist_pulloff, a, a2, E; - double t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3; + ContactModel model; + ContactGeom geom; // rolling double k_roll, damp_roll; - double torroll1, torroll2, torroll3; + int rhist0, rhist1, rhist2; + double torroll[3]; double rollmag, rolldotn, scalefac; - double fr, fr1, fr2, fr3; + double magfr, fr[3]; // twisting double k_twist, damp_twist, mu_twist; double signtwist, magtwist, magtortwist, Mtcrit; - double tortwist1, tortwist2, tortwist3; + double tortwist[3]; double shrmag,rsht,prjmag; bool frameupdate; @@ -236,9 +235,6 @@ void PairGranular::compute(int eflag, int vflag) for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = type[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; itype = type[i]; radi = radius[i]; if (use_history) { @@ -255,30 +251,21 @@ void PairGranular::compute(int eflag, int vflag) if (factor_lj == 0) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; + MathExtra::sub3(x[i], x[j], dx); jtype = type[j]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = MathExtra::lensq3(dx); radj = radius[j]; radsum = radi + radj; - - E = normal_coeffs[itype][jtype][0]; Reff = radi*radj/radsum; - touchflag = false; + // Copy data into structures to easily pass to functions + geom.rsq = rsq; + geom.Reff = Reff; + geom.radsum = radsum; + + touchflag = false; if (normal_model[itype][jtype] == JKR) { - E *= THREEQUARTERS; - if (touch[jj]) { - R2 = Reff*Reff; - coh = normal_coeffs[itype][jtype][3]; - a = cbrt(9.0*MY_PI*coh*R2/(4*E)); - delta_pulloff = a*a/Reff - 2*sqrt(MY_PI*coh*a/E); - dist_pulloff = radsum-delta_pulloff; - touchflag = (rsq < dist_pulloff*dist_pulloff); - } else { - touchflag = (rsq < radsum*radsum); - } + touchflag = touch_JKR(touch[jj], geom, model) } else { touchflag = (rsq < radsum*radsum); } @@ -294,22 +281,30 @@ void PairGranular::compute(int eflag, int vflag) r = sqrt(rsq); rinv = 1.0/r; - nx = delx*rinv; - ny = dely*rinv; - nz = delz*rinv; + // Copy data into structures to easily pass to functions + geom.r = r; + geom.rinv = rinv + geom.delta = radsum - r; + geom.dR = geom.delta*Reff; + + model.normal = normal_model[itype][jtype]; + model.damping = damping_model[itype][jtype]; + model.tangential = tangential_model[itype][jtype]; + model.roll = roll_model[itype][jtype]; + model.twist = twist_model[itype][jtype]; + model.E = normal_coeffs[itype][jtype][0]; + model.damp = normal_coeffs[itype][jtype][1]; + model.poisson = normal_coeffs[itype][jtype][2]; + model.coh = normal_coeffs[itype][jtype][3]; + + MathExtra::scale3(rinv, dx, nx); // relative translational velocity - - vr1 = v[i][0] - v[j][0]; - vr2 = v[i][1] - v[j][1]; - vr3 = v[i][2] - v[j][2]; + MathExtra::sub3(v[i], v[j], vr); // normal component - - vnnr = vr1*nx + vr2*ny + vr3*nz; //v_R . n - vn1 = nx*vnnr; - vn2 = ny*vnnr; - vn3 = nz*vnnr; + vnnr = MathExtra::dot3(vr, nx); //v_R . n + MathExtra::scale3(vnnr, nx, vn); // meff = effective mass of pair of particles // if I or J part of rigid body, use body mass @@ -322,60 +317,22 @@ void PairGranular::compute(int eflag, int vflag) if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; } - meff = mi*mj / (mi+mj); + meff = mi * mj / (mi + mj); if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; - delta = radsum - r; - dR = delta*Reff; - - if (normal_model[itype][jtype] == JKR) { + if (model.normal == JKR) { touch[jj] = 1; - R2=Reff*Reff; - coh = normal_coeffs[itype][jtype][3]; - dR2 = dR*dR; - t0 = coh*coh*R2*R2*E; - t1 = PI27SQ*t0; - t2 = 8*dR*dR2*E*E*E; - t3 = 4*dR2*E; - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0*(t1+2*t2)); - t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); - t5 = t3/t4 + t4/E; - sqrt2 = MAX(0, 2*dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); - a = INVROOT6*(t6 + sqrt(sqrt3)); - a2 = a*a; - knfac = normal_coeffs[itype][jtype][0]*a; - Fne = knfac*a2/Reff - MY_2PI*a2*sqrt(4*coh*E/(MY_PI*a)); + normal_JKR(Fne, Fncrit, geom, model); + } else if (model.normal == DMT) { + normal_DMT(Fne, Fncrit, geom, model); } else { - knfac = E; // Hooke - Fne = knfac*delta; - a = sqrt(dR); - if (normal_model[itype][jtype] != HOOKE) { - Fne *= a; - knfac *= a; - } - if (normal_model[itype][jtype] == DMT) - Fne -= 4*MY_PI*normal_coeffs[itype][jtype][3]*Reff; + normal_hooke(Fne, Fncrit, geom, model); } // NOTE: consider restricting Hooke to only have // 'velocity' as an option for damping? - - if (damping_model[itype][jtype] == VELOCITY) { - damp_normal = 1; - } else if (damping_model[itype][jtype] == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model[itype][jtype] == VISCOELASTIC) { - damp_normal = a*meff; - } else if (damping_model[itype][jtype] == TSUJI) { - damp_normal = sqrt(meff*knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; - Fdamp = -damp_normal_prefactor*vnnr; + Fdamp = normal_damping(vnnr, meff, geom, model); Fntot = Fne + Fdamp; if (limit_damping[itype][jtype] && (Fntot < 0.0)) Fntot = 0.0; @@ -391,21 +348,15 @@ void PairGranular::compute(int eflag, int vflag) // history = cumulative tangential elastic force // tangential component - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; + MathExtra::sub3(vr, vn, vt); // relative rotational velocity - wr1 = (radi*omega[i][0] + radj*omega[j][0]); - wr2 = (radi*omega[i][1] + radj*omega[j][1]); - wr3 = (radi*omega[i][2] + radj*omega[j][2]); + MathExtra::scaleadd3(radi, omega[i], radj, omega[j], wr); // relative tangential velocities - vtr1 = vt1 - (nz*wr2-ny*wr3); - vtr2 = vt2 - (nx*wr3-nz*wr1); - vtr3 = vt3 - (ny*wr1-nx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); + MathExtra::cross3(wr, nx, temp); + MathExtra::sub3(vt, temp, vtr); + vrel = MathExtra::len(vtr); // if any history is needed if (use_history) { @@ -413,20 +364,13 @@ void PairGranular::compute(int eflag, int vflag) history = &allhistory[size_history*jj]; } - if (normal_model[itype][jtype] == JKR) { - F_pulloff = 3*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else if (normal_model[itype][jtype] == DMT) { - F_pulloff = 4*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else { - Fncrit = fabs(Fntot); - } - Fscrit = tangential_coeffs[itype][jtype][2] * Fncrit; + Fncrit = critical_normal(Fne, Fntot, geom, model); + Fscrit = model.poisson * Fncrit; //------------------------------ // tangential forces //------------------------------ + k_tangential = tangential_coeffs[itype][jtype][0]; damp_tangential = tangential_coeffs[itype][jtype][1] * damp_normal_prefactor; @@ -443,9 +387,7 @@ void PairGranular::compute(int eflag, int vflag) // on unloading, rescale the shear displacements/force if (a < history[3]) { double factor = a/history[3]; - history[0] *= factor; - history[1] *= factor; - history[2] *= factor; + MathExtra::scale3(history, factor); } } // rotate and update displacements / force. @@ -455,40 +397,33 @@ void PairGranular::compute(int eflag, int vflag) if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE_FORCE) - frameupdate = fabs(rsht) > EPSILON*Fscrit; + frameupdate = fabs(rsht) > EPSILON * Fscrit; else - frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; + frameupdate = fabs(rsht) * k_tangential > EPSILON * Fscrit; if (frameupdate) { shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + history[2]*history[2]); // projection - history[0] -= rsht*nx; - history[1] -= rsht*ny; - history[2] -= rsht*nz; + MathExtra::scale3(rsht, nx, history); // also rescale to preserve magnitude - prjmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); + prjmag = MathExtra::len3(history); if (prjmag > 0) scalefac = shrmag/prjmag; else scalefac = 0; - history[0] *= scalefac; - history[1] *= scalefac; - history[2] *= scalefac; + MathExtra::scale3(scalefac, history); } // update history if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { // tangential displacement - history[0] += vtr1*dt; - history[1] += vtr2*dt; - history[2] += vtr3*dt; + MathExtra::scale3(dt, vtr, temp); + MathExtra::add3(temp, history, history); } else { // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - history[0] -= k_tangential*vtr1*dt; - history[1] -= k_tangential*vtr2*dt; - history[2] -= k_tangential*vtr3*dt; + MathExtra::scale3(k_tangential*dt, vtr, temp); + MathExtra::sub3(history, temp, history); } if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE || tangential_model[itype][jtype] == @@ -497,58 +432,41 @@ void PairGranular::compute(int eflag, int vflag) } // tangential forces = history + tangential velocity damping + MathExtra::scale3(-damp_tangential, vtr, fs); if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - fs1 = -k_tangential*history[0] - damp_tangential*vtr1; - fs2 = -k_tangential*history[1] - damp_tangential*vtr2; - fs3 = -k_tangential*history[2] - damp_tangential*vtr3; - } else { - fs1 = history[0] - damp_tangential*vtr1; - fs2 = history[1] - damp_tangential*vtr2; - fs3 = history[2] - damp_tangential*vtr3; + MathExtra::scale3(-k_tangential, history, temp); + MathExtra::add3(fs, temp, fs); } // rescale frictional displacements and forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); + magfs = MathExtra::len3(fs); if (fs > Fscrit) { - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); + shrmag = MathExtra::len3(history); if (shrmag != 0.0) { + history[0] = Fscrit*fs[0]/magfs + damp_tangential*vtr[0]; + history[1] = Fscrit*fs[1]/magfs + damp_tangential*vtr[1]; + history[2] = Fscrit*fs[2]/magfs + damp_tangential*vtr[2]; if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - history[0] = -1.0/k_tangential*(Fscrit*fs1/fs + - damp_tangential*vtr1); - history[1] = -1.0/k_tangential*(Fscrit*fs2/fs + - damp_tangential*vtr2); - history[2] = -1.0/k_tangential*(Fscrit*fs3/fs + - damp_tangential*vtr3); - } else { - history[0] = Fscrit*fs1/fs + damp_tangential*vtr1; - history[1] = Fscrit*fs2/fs + damp_tangential*vtr2; - history[2] = Fscrit*fs3/fs + damp_tangential*vtr3; + MathExtra::scale3(-1.0/k_tangential, history); } - fs1 *= Fscrit/fs; - fs2 *= Fscrit/fs; - fs3 *= Fscrit/fs; - } else fs1 = fs2 = fs3 = 0.0; + MathExtra::scale3(Fscrit/magfs, fs); + } else MathExtra::zero3(fs); } } else { // classic pair gran/hooke (no history) fs = damp_tangential*vrel; if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; else Ft = 0.0; - fs1 = -Ft*vtr1; - fs2 = -Ft*vtr2; - fs3 = -Ft*vtr3; + MathExtra::scale3(-Ft, vtr, fs); } if (roll_model[itype][jtype] != ROLL_NONE || twist_model[itype][jtype] != TWIST_NONE) { - relrot1 = omega[i][0] - omega[j][0]; - relrot2 = omega[i][1] - omega[j][1]; - relrot3 = omega[i][2] - omega[j][2]; + MathExtra::sub3(omega[i], omega[j], relrot); } //**************************************** // rolling resistance @@ -560,64 +478,63 @@ void PairGranular::compute(int eflag, int vflag) // this is different from the Marshall papers, // which use the Bagi/Kuhn formulation // for rolling velocity (see Wang et al for why the latter is wrong) - vrl1 = Reff*(relrot2*nz - relrot3*ny); - vrl2 = Reff*(relrot3*nx - relrot1*nz); - vrl3 = Reff*(relrot1*ny - relrot2*nx); + vrl[0] = Reff * (relrot[1] * n[2] - relrot[2] * nx[1]); + vrl[1] = Reff * (relrot[2] * n[0] - relrot[0] * nx[2]); + vrl[2] = Reff * (relrot[0] * n[1] - relrot[1] * nx[0]); - int rhist0 = roll_history_index; - int rhist1 = rhist0 + 1; - int rhist2 = rhist1 + 1; + rhist0 = roll_history_index; + rhist1 = rhist0 + 1; + rhist2 = rhist1 + 1; k_roll = roll_coeffs[itype][jtype][0]; damp_roll = roll_coeffs[itype][jtype][1]; Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; if (historyupdate) { - rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; + temp[0] = history[rhist0]; + temp[1] = history[rhist1]; + temp[2] = history[rhist2]; + rolldotn = MathExtra::dot3(temp, nx); frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; if (frameupdate) { // rotate into tangential plane - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); + rollmag = MathExtra::len3(temp); // projection - history[rhist0] -= rolldotn*nx; - history[rhist1] -= rolldotn*ny; - history[rhist2] -= rolldotn*nz; + temp[0] -= rolldotn*nx[0]; + temp[1] -= rolldotn*nx[1]; + temp[2] -= rolldotn*nx[2]; // also rescale to preserve magnitude - prjmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); + prjmag = MathExtra::len3(temp); if (prjmag > 0) scalefac = rollmag/prjmag; else scalefac = 0; - history[rhist0] *= scalefac; - history[rhist1] *= scalefac; - history[rhist2] *= scalefac; + MathExtra::scale3(scalefac, temp); } - history[rhist0] += vrl1*dt; - history[rhist1] += vrl2*dt; - history[rhist2] += vrl3*dt; + temp[0] += vrl[0]*dt; + temp[1] += vrl[1]*dt; + temp[2] += vrl[2]*dt; } - fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; - fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; - fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; + fr[0] = -k_roll*temp[0] - damp_roll*vrl[0]; + fr[1] = -k_roll*temp[1] - damp_roll*vrl[1]; + fr[2] = -k_roll*temp[2] - damp_roll*vrl[2]; // rescale frictional displacements and forces if needed - fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); - if (fr > Frcrit) { - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); + magfr = MathExtra::len3(fr); + if (magfr > Frcrit) { + rollmag = MathExtra::len3(temp); if (rollmag != 0.0) { - history[rhist0] = -1.0/k_roll*(Frcrit*fr1/fr + damp_roll*vrl1); - history[rhist1] = -1.0/k_roll*(Frcrit*fr2/fr + damp_roll*vrl2); - history[rhist2] = -1.0/k_roll*(Frcrit*fr3/fr + damp_roll*vrl3); - fr1 *= Frcrit/fr; - fr2 *= Frcrit/fr; - fr3 *= Frcrit/fr; - } else fr1 = fr2 = fr3 = 0.0; + temp[0] = -1.0/k_roll*(Frcrit*fr[0]/magfr + damp_roll*vrl[0]); + temp[1] = -1.0/k_roll*(Frcrit*fr[1]/magfr + damp_roll*vrl[1]); + temp[2] = -1.0/k_roll*(Frcrit*fr[2]/magfr + damp_roll*vrl[2]); + fr[0] *= Frcrit/magfr; + fr[1] *= Frcrit/magfr; + fr[2] *= Frcrit/magfr; + } else MathExtra::zero3(fr); } + + history[rhist0] = temp[0]; + history[rhist1] = temp[1]; + history[rhist2] = temp[2]; } //**************************************** @@ -626,7 +543,7 @@ void PairGranular::compute(int eflag, int vflag) if (twist_model[itype][jtype] != TWIST_NONE) { // omega_T (eq 29 of Marshall) - magtwist = relrot1*nx + relrot2*ny + relrot3*nz; + magtwist = MathExtra::dot3(relrot, nx); if (twist_model[itype][jtype] == TWIST_MARSHALL) { k_twist = 0.5*k_tangential*a*a;; // eq 32 of Marshall paper damp_twist = 0.5*damp_tangential*a*a; @@ -652,72 +569,45 @@ void PairGranular::compute(int eflag, int vflag) // apply forces & torques - fx = nx*Fntot + fs1; - fy = ny*Fntot + fs2; - fz = nz*Fntot + fs3; - fx *= factor_lj; - fy *= factor_lj; - fz *= factor_lj; + MathExtra::scale3(Fntot, nx, fx); + MathExtra::add3(fx, fs, fx); + MathExtra::scale3(factor_lj, fx); + MathExtra::add3(f[i], fx, f[i]); - f[i][0] += fx; - f[i][1] += fy; - f[i][2] += fz; - - tor1 = ny*fs3 - nz*fs2; - tor2 = nz*fs1 - nx*fs3; - tor3 = nx*fs2 - ny*fs1; - tor1 *= factor_lj; - tor2 *= factor_lj; - tor3 *= factor_lj; + MathExtra::cross3(nx, fs, tor); + MathExtra::scale3(factor_lj, tor); dist_to_contact = radi-0.5*delta; - torque[i][0] -= dist_to_contact*tor1; - torque[i][1] -= dist_to_contact*tor2; - torque[i][2] -= dist_to_contact*tor3; + MathExtra::scale3(dist_to_contact, tor, temp); + MathExtra::sub3(torque[i], temp, torque[i]); if (twist_model[itype][jtype] != TWIST_NONE) { - tortwist1 = magtortwist * nx * factor_lj; - tortwist2 = magtortwist * ny * factor_lj; - tortwist3 = magtortwist * nz * factor_lj; - - torque[i][0] += tortwist1; - torque[i][1] += tortwist2; - torque[i][2] += tortwist3; + MathExtra::scale3(magtortwist, nx, tortwist); + MathExtra::scale3(factor_lj, tortwist); + MathExtra::add3(torque[i], tortwist, torque[i]); } if (roll_model[itype][jtype] != ROLL_NONE) { - torroll1 = Reff*(ny*fr3 - nz*fr2) * factor_lj; // n cross fr - torroll2 = Reff*(nz*fr1 - nx*fr3) * factor_lj; - torroll3 = Reff*(nx*fr2 - ny*fr1) * factor_lj; - - torque[i][0] += torroll1; - torque[i][1] += torroll2; - torque[i][2] += torroll3; + MathExtra::cross3(nx, fr, torroll); + MathExtra::scale3(Reff, torroll); + MathExtra::scale3(factor_lj, torroll); + MathExtra::add3(torque[i], torroll, torque[i]); } if (force->newton_pair || j < nlocal) { - f[j][0] -= fx; - f[j][1] -= fy; - f[j][2] -= fz; + MathExtra::sub3(f[j], fx, f[j]); dist_to_contact = radj-0.5*delta; - torque[j][0] -= dist_to_contact*tor1; - torque[j][1] -= dist_to_contact*tor2; - torque[j][2] -= dist_to_contact*tor3; + MathExtra::scale3(dist_to_contact, tor, temp); + MathExtra::sub3(torque[j], tor, torque[j]); - if (twist_model[itype][jtype] != TWIST_NONE) { - torque[j][0] -= tortwist1; - torque[j][1] -= tortwist2; - torque[j][2] -= tortwist3; - } - if (roll_model[itype][jtype] != ROLL_NONE) { - torque[j][0] -= torroll1; - torque[j][1] -= torroll2; - torque[j][2] -= torroll3; - } + if (twist_model[itype][jtype] != TWIST_NONE) + MathExtra::sub3(torque[j], tortwist, torque[j]); + if (roll_model[itype][jtype] != ROLL_NONE) + MathExtra::sub3(torque[j], torroll, torque[j]); } if (evflag) ev_tally_xyz(i,j,nlocal,force->newton_pair, - 0.0,0.0,fx,fy,fz,delx,dely,delz); + 0.0,0.0,fx[0],fx[1],fx[2],dx[0],dy[1],dx[2]); } } } @@ -1389,346 +1279,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, double rsq, double /* factor_coul */, double /* factor_lj */, double &fforce) { - double radi,radj,radsum; - double r,rinv,delx,dely,delz, nx, ny, nz, Reff; - double dR, dR2; - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3,wr1,wr2,wr3; - double vtr1,vtr2,vtr3,vrel; - double mi,mj,meff; - double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; - double knfac, damp_normal, damp_normal_prefactor; - double k_tangential, damp_tangential; - double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; - double fs, fs1, fs2, fs3; - - // for JKR - double R2, coh, F_pulloff, delta_pulloff, dist_pulloff, a, a2, E; - double delta, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3; - - // rolling - double k_roll, damp_roll; - double rollmag; - double fr, fr1, fr2, fr3; - - // twisting - double k_twist, damp_twist, mu_twist; - double signtwist, magtwist, magtortwist, Mtcrit; - - double shrmag; - int jnum; - int *jlist; - double *history,*allhistory; - - int nall = atom->nlocal + atom->nghost; - if ((i >= nall) || (j >= nall)) - error->all(FLERR,"Not enough atoms for pair granular single function"); - - double *radius = atom->radius; - radi = radius[i]; - radj = radius[j]; - radsum = radi + radj; - Reff = (radsum > 0.0) ? radi*radj/radsum : 0.0; - - bool touchflag; - E = normal_coeffs[itype][jtype][0]; - if (normal_model[itype][jtype] == JKR) { - E *= THREEQUARTERS; - R2 = Reff*Reff; - coh = normal_coeffs[itype][jtype][3]; - a = cbrt(9.0*MY_PI*coh*R2/(4*E)); - delta_pulloff = a*a/Reff - 2*sqrt(MY_PI*coh*a/E); - dist_pulloff = radsum+delta_pulloff; - touchflag = (rsq <= dist_pulloff*dist_pulloff); - } else touchflag = (rsq <= radsum*radsum); - - if (!touchflag) { - fforce = 0.0; - for (int m = 0; m < single_extra; m++) svector[m] = 0.0; - return 0.0; - } - - double **x = atom->x; - delx = x[i][0] - x[j][0]; - dely = x[i][1] - x[j][1]; - delz = x[i][2] - x[j][2]; - r = sqrt(rsq); - rinv = 1.0/r; - - nx = delx*rinv; - ny = dely*rinv; - nz = delz*rinv; - - // relative translational velocity - - double **v = atom->v; - vr1 = v[i][0] - v[j][0]; - vr2 = v[i][1] - v[j][1]; - vr3 = v[i][2] - v[j][2]; - - // normal component - - vnnr = vr1*nx + vr2*ny + vr3*nz; - vn1 = nx*vnnr; - vn2 = ny*vnnr; - vn3 = nz*vnnr; - - // tangential component - - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - - double **omega = atom->omega; - wr1 = (radi*omega[i][0] + radj*omega[j][0]); - wr2 = (radi*omega[i][1] + radj*omega[j][1]); - wr3 = (radi*omega[i][2] + radj*omega[j][2]); - - // meff = effective mass of pair of particles - // if I or J part of rigid body, use body mass - // if I or J is frozen, meff is other particle - - double *rmass = atom->rmass; - int *mask = atom->mask; - - mi = rmass[i]; - mj = rmass[j]; - if (fix_rigid) { - // NOTE: ensure mass_rigid is current for owned+ghost atoms? - if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; - if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; - } - - meff = mi*mj / (mi+mj); - if (mask[i] & freeze_group_bit) meff = mj; - if (mask[j] & freeze_group_bit) meff = mi; - - delta = radsum - r; - dR = delta*Reff; - if (normal_model[itype][jtype] == JKR) { - dR2 = dR*dR; - t0 = coh*coh*R2*R2*E; - t1 = PI27SQ*t0; - t2 = 8*dR*dR2*E*E*E; - t3 = 4*dR2*E; - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0*(t1+2*t2)); - t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); - t5 = t3/t4 + t4/E; - sqrt2 = MAX(0, 2*dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); - a = INVROOT6*(t6 + sqrt(sqrt3)); - a2 = a*a; - knfac = normal_coeffs[itype][jtype][0]*a; - Fne = knfac*a2/Reff - MY_2PI*a2*sqrt(4*coh*E/(MY_PI*a)); - } else { - knfac = E; - Fne = knfac*delta; - a = sqrt(dR); - if (normal_model[itype][jtype] != HOOKE) { - Fne *= a; - knfac *= a; - } - if (normal_model[itype][jtype] == DMT) - Fne -= 4*MY_PI*normal_coeffs[itype][jtype][3]*Reff; - } - - if (damping_model[itype][jtype] == VELOCITY) { - damp_normal = 1; - } else if (damping_model[itype][jtype] == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model[itype][jtype] == VISCOELASTIC) { - damp_normal = a*meff; - } else if (damping_model[itype][jtype] == TSUJI) { - damp_normal = sqrt(meff*knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; - Fdamp = -damp_normal_prefactor*vnnr; - - Fntot = Fne + Fdamp; - if (limit_damping[itype][jtype] && (Fntot < 0.0)) Fntot = 0.0; - - jnum = list->numneigh[i]; - jlist = list->firstneigh[i]; - - if (use_history) { - if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) - error->one(FLERR,"Pair granular single computation needs history"); - allhistory = fix_history->firstvalue[i]; - for (int jj = 0; jj < jnum; jj++) { - neighprev++; - if (neighprev >= jnum) neighprev = 0; - if (jlist[neighprev] == j) break; - } - history = &allhistory[size_history*neighprev]; - } - - //**************************************** - // tangential force, including history effects - //**************************************** - - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - // tangential component - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - wr1 = (radi*omega[i][0] + radj*omega[j][0]); - wr2 = (radi*omega[i][1] + radj*omega[j][1]); - wr3 = (radi*omega[i][2] + radj*omega[j][2]); - - // relative tangential velocities - vtr1 = vt1 - (nz*wr2-ny*wr3); - vtr2 = vt2 - (nx*wr3-nz*wr1); - vtr3 = vt3 - (ny*wr1-nx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - if (normal_model[itype][jtype] == JKR) { - F_pulloff = 3*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else if (normal_model[itype][jtype] == DMT) { - F_pulloff = 4*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else { - Fncrit = fabs(Fntot); - } - Fscrit = tangential_coeffs[itype][jtype][2] * Fncrit; - - //------------------------------ - // tangential forces - //------------------------------ - k_tangential = tangential_coeffs[itype][jtype][0]; - damp_tangential = tangential_coeffs[itype][jtype][1]*damp_normal_prefactor; - - if (tangential_history) { - if (tangential_model[itype][jtype] != TANGENTIAL_HISTORY) { - k_tangential *= a; - } - - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - - // tangential forces = history + tangential velocity damping - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - fs1 = -k_tangential*history[0] - damp_tangential*vtr1; - fs2 = -k_tangential*history[1] - damp_tangential*vtr2; - fs3 = -k_tangential*history[2] - damp_tangential*vtr3; - } else { - fs1 = history[0] - damp_tangential*vtr1; - fs2 = history[1] - damp_tangential*vtr2; - fs3 = history[2] - damp_tangential*vtr3; - } - - // rescale frictional forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - if (fs > Fscrit) { - if (shrmag != 0.0) { - fs1 *= Fscrit/fs; - fs2 *= Fscrit/fs; - fs3 *= Fscrit/fs; - fs *= Fscrit/fs; - } else fs1 = fs2 = fs3 = fs = 0.0; - } - - // classic pair gran/hooke (no history) - } else { - fs = damp_tangential*vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; - else Ft = 0.0; - fs1 = -Ft*vtr1; - fs2 = -Ft*vtr2; - fs3 = -Ft*vtr3; - fs = Ft*vrel; - } - - //**************************************** - // rolling resistance - //**************************************** - - if ((roll_model[itype][jtype] != ROLL_NONE) - || (twist_model[itype][jtype] != TWIST_NONE)) { - relrot1 = omega[i][0] - omega[j][0]; - relrot2 = omega[i][1] - omega[j][1]; - relrot3 = omega[i][2] - omega[j][2]; - - // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, - // which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - - vrl1 = Reff*(relrot2*nz - relrot3*ny); //- 0.5*((radj-radi)/radsum)*vtr1; - vrl2 = Reff*(relrot3*nx - relrot1*nz); //- 0.5*((radj-radi)/radsum)*vtr2; - vrl3 = Reff*(relrot1*ny - relrot2*nx); //- 0.5*((radj-radi)/radsum)*vtr3; - - int rhist0 = roll_history_index; - int rhist1 = rhist0 + 1; - int rhist2 = rhist1 + 1; - - // rolling displacement - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - - k_roll = roll_coeffs[itype][jtype][0]; - damp_roll = roll_coeffs[itype][jtype][1]; - fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; - fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; - fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; - - // rescale frictional displacements and forces if needed - Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; - - fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); - if (fr > Frcrit) { - if (rollmag != 0.0) { - fr1 *= Frcrit/fr; - fr2 *= Frcrit/fr; - fr3 *= Frcrit/fr; - fr *= Frcrit/fr; - } else fr1 = fr2 = fr3 = fr = 0.0; - } - } else fr1 = fr2 = fr3 = fr = 0.0; - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model[itype][jtype] != TWIST_NONE) { - // omega_T (eq 29 of Marshall) - magtwist = relrot1*nx + relrot2*ny + relrot3*nz; - if (twist_model[itype][jtype] == TWIST_MARSHALL) { - k_twist = 0.5*k_tangential*a*a;; //eq 32 - damp_twist = 0.5*damp_tangential*a*a; - mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2];; - } else { - k_twist = twist_coeffs[itype][jtype][0]; - damp_twist = twist_coeffs[itype][jtype][1]; - mu_twist = twist_coeffs[itype][jtype][2]; - } - // M_t torque (eq 30) - magtortwist = -k_twist*history[twist_history_index] - damp_twist*magtwist; - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - magtortwist = -Mtcrit * signtwist; // eq 34 - } else magtortwist = 0.0; - } else magtortwist = 0.0; - - // set force and return no energy fforce = Fntot*rinv; @@ -1889,3 +1440,99 @@ double PairGranular::radii2cut(double r1, double r2) return cut; } + +double PairGranular::touch_JKR(int touch, ContactGeom geom, ContactModel model) +{ + double E, R2, a, delta_pulloff, dist_pulloff; + bool touchflag; + E = model.E; + E *= THREEQUARTERS; + if (touch) { + R2 = geom.Reff * geom.Reff; + a = cbrt(9.0 * MY_PI * model.coh * R2 / (4 * E)); + delta_pulloff = a * a / Reff - 2 * sqrt(MY_PI * coh * a / E); + dist_pulloff = geom.radsum - delta_pulloff; + touchflag = (geom.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (geom.rsq < geom.radsum * geom.radsum); + } + return touchflag; +} + +void PairGranular::normal_JKR(double &Fne, ContactGeom geom, ContactModel model) +{ + double R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff; + + R2 = geom.Reff * geom.Reff; + dR2 = geom.dR * geom.dR; + t0 = model.coh * model.coh * R2 * R2 * model.E; + t1 = PI27SQ*t0; + t2 = 8 * geom.dR * dR2 * model.E * model.E * model.E; + t3 = 4 * dR2 * E; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / E; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * model.coh * MY_PI * R2 / (model.E * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + + Fne = model.E * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * model.coh * model.E / (MY_PI * a)); + model.a = a; + model.knfac = model.E*a; +} + +void PairGraunular::normal_DMT(double &Fne, ContactGeom geom, ContactModel model) +{ + double a = sqrt(geom.dR); + Fne = a * model.E * geom.delta; + Fne -= 4 * MY_PI * model.coh * geom.Reff; + F_pulloff = 4 * MY_PI * model.coh * geom.Reff; + model.a = a; + model.knfact = model.E * a; +} + +void PairGraunular::normal_Hooke(double &Fne, ContactGeom geom, ContactModel model) +{ + double a = sqrt(geom.dR); + Fne = model.E * geom.delta; + if (model.normal != HOOKE) Fne *= a; + model.a = a; + model.knfac = model.E; + if (model.normal != HOOKE) model.knfac *= a; +} + +double PairGranular::normal_damping(double vnnr, double meff, ContactGeom geom, ContactModel model) +{ + double damp_normal, a; + if (model.damping == VELOCITY) { + damp_normal = 1; + } else if (model.damping == MASS_VELOCITY) { + damp_normal = meff; + } else if (model.damping == VISCOELASTIC) { + damp_normal = model.a * meff; + } else if (model.damping == TSUJI) { + damp_normal = sqrt(meff * model.knfac); + } else damp_normal = 0.0; + + damp_normal_prefactor = model.damp * damp_normal; + return -damp_normal_prefactor * vnnr; +} + +double PairGranular::critical_normal(double Fne, double Fntot, ContactGeom geom, Contactmodel model) +{ + if (model.normal == JKR) { + F_pulloff = 3*MY_PI*model.coh*geom.Reff; + Fncrit = fabs(Fne + 2*F_pulloff); + } else if (model.normal == DMT) { + F_pulloff = 4*MY_PI*model.coh*geom.Reff; + Fncrit = fabs(Fne + 2*F_pulloff); + } else { + Fncrit = fabs(Fntot); + } + return Fncrit; +} \ No newline at end of file diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 5c3edf30a2..896db15231 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -100,6 +100,18 @@ class PairGranular : public Pair { double mix_stiffnessG(double, double, double, double); double mix_geom(double, double); double pulloff_distance(double, double, int, int); + + // Structure to store details of model + struct ContactModel { + int normal, damping, tangential, roll, twist; + double E, damp, poisson, coh; + double a, knfac; + }; + + struct ContactGeom { + double r, rinv, rsq, Reff, radsum; + double delta, dR; + } }; } // namespace LAMMPS_NS From 68e00a60bd8be2c55cb97a3e95156313ff766705 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 15 Jun 2022 12:37:02 -0600 Subject: [PATCH 05/57] Fixing rare bug in writing restart files with history --- src/fix_neigh_history.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 7413b590a7..613716c9a4 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -351,7 +351,9 @@ void FixNeighHistory::pre_exchange_newton() // 1st loop over neighbor list // calculate npartner for owned+ghost atoms - for (i = 0; i < nall_neigh; i++) npartner[i] = 0; + // Ensure npartner is zeroed across all atoms, nall_neigh can be less than nall + // when writing restarts when comm calls are made but modify->post_neighbor() isn't + for (i = 0; i < MAX(nall_neigh, atom->nall); i++) npartner[i] = 0; tagint *tag = atom->tag; NeighList *list = pair->list; @@ -406,7 +408,7 @@ void FixNeighHistory::pre_exchange_newton() // store partner IDs and values for owned+ghost atoms // re-zero npartner to use as counter - for (i = 0; i < nall_neigh; i++) npartner[i] = 0; + for (i = 0; i < MAX(nall_neigh, atom->nall); i++) npartner[i] = 0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; From 468a6d9f29d46c6a149777fe2cafed9d0f9d276b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 16 Jun 2022 14:27:57 -0600 Subject: [PATCH 06/57] creating ContactModel class --- src/GRANULAR/contact.cpp | 624 +++++++++++++++++++++++++ src/GRANULAR/contact.h | 73 +++ src/GRANULAR/pair_granular.cpp | 810 ++++++++------------------------- src/GRANULAR/pair_granular.h | 28 +- src/contact.cpp | 58 +++ src/contact.h | 50 ++ src/contact_model.cpp | 58 +++ src/contact_model.h | 35 ++ 8 files changed, 1101 insertions(+), 635 deletions(-) create mode 100644 src/GRANULAR/contact.cpp create mode 100644 src/GRANULAR/contact.h create mode 100644 src/contact.cpp create mode 100644 src/contact.h create mode 100644 src/contact_model.cpp create mode 100644 src/contact_model.h diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp new file mode 100644 index 0000000000..3cea933370 --- /dev/null +++ b/src/GRANULAR/contact.cpp @@ -0,0 +1,624 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- + + This class contains a series of tools for DEM contacts + Multiple models can be defined and used to calculate forces + and torques based on contact geometry +*/ + +#include +#include "contact.h" + +namespace LAMMPS_NS { + namespace Contact{ + +enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; +enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; +enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; +enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; +enum {ROLL_NONE, ROLL_SDS}; + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define THREEQUARTERS 0.75 // 3/4 + +#define EPSILON 1e-10 + +ContactModel::ContactModel() +{ + k_norm = cohesion = gamma_norm = 0.0; + k_tang = gamma_tang = mu_tang = 0.0; + k_roll = gamma_roll = mu_roll = 0.0; + k_twist = gamma_twist = mu_twist = 0.0; + + limit_damping = 0; + cutoff_type = 0.0; + reset_contact(); +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::reset_contact() +{ + radi = radj = 0.0; + xi = xj = vi = vj = omegai = omegaj = nullptr; + + prep_flag = check_flag = 0; + touch = false; +} + +/* ---------------------------------------------------------------------- */ + +bool ContactModel::check_contact() +{ + check_flag = 1; + + MathExtra::sub3(xi, xj, dx); + rsq = MathExtra::lensq3(dx); + radsum = radi + radj; + Reff = radi*radj/radsum; + + touch = false; + if (normal_model == JKR) touch = touch_JKR(touch); + else touch = (rsq < radsum*radsum); + + return touch +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::prep_contact() +{ + prep_flag = 1; + + // If it hasn't already been done, test if the contact exists + if (check_flag != 1) touch = check_contact(); + if (!touch) return; + + // Set flags + mindlin_rescale = mindlin_force = 0; + if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) + mindlin_rescale = 1 + if (tangential_model == TANGENTIAL_MINDLIN_FORCE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) + mindlin_force = 1 + + double temp[3]; + + // Standard geometric quantities + r = sqrt(rsq); + rinv = 1.0/r; + delta = radsum - r; + dR = delta*Reff + MathExtra::scale3(rinv, dx, nx); + + // relative translational velocity + MathExtra::sub3(v[i], v[j], vr); + + // normal component + vnnr = MathExtra::dot3(vr, nx); //v_R . n + MathExtra::scale3(vnnr, nx, vn); + + // tangential component + MathExtra::sub3(vr, vn, vt); + + // relative rotational velocity + MathExtra::scaleadd3(radi, omegai, radj, omegaj, wr); + + // relative tangential velocities + MathExtra::cross3(wr, nx, temp); + MathExtra::sub3(vt, temp, vtr); + vrel = MathExtra::len(vtr); + + if (roll_model != NONE || twist_model != NONE) + MathExtra::sub3(omega[i], omega[j], relrot); + + if (roll_model != NONE) { + // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) + vrl[0] = Reff * (relrot[1] * n[2] - relrot[2] * nx[1]); + vrl[1] = Reff * (relrot[2] * n[0] - relrot[0] * nx[2]); + vrl[2] = Reff * (relrot[0] * n[1] - relrot[1] * nx[0]); + } + + if (twist_model != NONE) { + // omega_T (eq 29 of Marshall) + magtwist = MathExtra::dot3(relrot, nx); + } +} + + +/* ---------------------------------------------------------------------- */ + +void ContactModel::calculate_forces(double *forces, double *torquesi, double *torquesj, double *history) +{ + // If it hasn't already been done, run prep calculations + if (prep_flag != 1) prep_contact(); + if (!touch) { + forces[0] = forces[1] = forces[2] = 0.0; + return + } + + //********************************************** + // normal forces + //********************************************** + + // Also calculates: a, knfac, Fncrit + double Fne; + if (normal_model == JKR) { + Fne = normal_JKR(); + } else if (normal_model == DMT) { + Fne = normal_DMT(); + } else if (normal_model == HERTZ || normal_model == HERTZ_MATERIAL) { + Fne = normal_hertz(); + } else { + Fne = normal_hooke(); + } + + // NOTE: consider restricting Hooke to only have + // 'velocity' as an option for damping? + // Also calculates: damp_normal_prefactor + double Fdamp = normal_damping(); + + double Fntot = Fne + Fdamp; + if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; + + //********************************************** + // tangential force, including history effects + //********************************************** + // For linear, mindlin, mindlin_rescale: + // history = cumulative tangential displacement + // + // For mindlin/force, mindlin_rescale/force: + // history = cumulative tangential elastic force + + Fncrit = critical_normal(Fne, Fntot, geom, model); + Fscrit = mu_tang * Fncrit; + + if (tangential_model == TANGENTIAL_NOHISTORY) { + tangential_no_history(); + } else if (tangential_model == TANGENTIAL_HISTORY) { + tangential_history(history); + } + tangential_forces(history); + + //********************************************** + // rolling force + //********************************************** + + if (roll_model != ROLL_NONE) + rolling(history); + + //**************************************** + // twisting torque, including history effects + //**************************************** + + if (twist_model == TWIST_MARSHALL) { + twist_marshall(history); + } else if (twist_model == TWIST_SDS) { + twist_SDS(history); + } + + //********************************************** + // sum contributions + //********************************************** + + MathExtra::scale3(Fntot, nx, forces); + MathExtra::add3(forces, fs, forces); + + MathExtra::cross3(nx, fs, torquesi); + MathExtra::copy3(torquesi, torquesj); + + double dist_to_contact = radi-0.5*delta; + MathExtra::scale3(dist_to_contact, torquesi); + dist_to_contact = radj-0.5*delta; + MathExtra::scale3(dist_to_contact, torquesj); + + double torroll[3]; + if (roll_model != ROLL_NONE) { + MathExtra::cross3(nx, fr, torroll); + MathExtra::scale3(Reff, torroll); + MathExtra::add3(torquesi, torroll, torquesi); + MathExtra::sub3(torquesj, torroll, torquesj); + } + + double tortwist[3]; + if (twist_model != NONE_TWIST) { + MathExtra::scale3(magtortwist, nx, tortwist); + MathExtra::add3(torquesi, tortwist, torquesi) + MathExtra::sub3(torquesj, tortwist, torquesj) + } +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::touch_JKR(int touch) +{ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = E*THREEQUARTERS; + if (touch) { + R2 = Reff * Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = radsum - delta_pulloff; + touchflag = (rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rsq < radsum * radsum); + } + return touchflag; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_JKR() +{ + double R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * E; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * E * E * E; + t3 = 4 * dR2 * E; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / E; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (E * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + double Fne = E * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * E / (MY_PI * a)); + double F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = E * a; + Fncrit = fabs(Fne + 2*F_pulloff); + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_DMT(double &Fne) +{ + a = sqrt(dR); + double Fne = a * E * delta; + Fne -= 4 * MY_PI * cohesion * Reff; + F_pulloff = 4 * MY_PI * cohesion * Reff; + + knfac = E * a; + Fncrit = fabs(Fne + 2*F_pulloff); + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_Hertz(double &Fne) +{ + a = sqrt(dR); + double Fne = E * delta * a; + + knfac = E * a; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_Hooke(double &Fne) +{ + a = sqrt(dR); + double Fne = E * delta; + + knfac = E; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_damping() +{ + double damp_normal; + if (damping_model == VELOCITY) { + damp_normal = 1; + } else if (damping_model == MASS_VELOCITY) { + damp_normal = meff; + } else if (damping_model == VISCOELASTIC) { + damp_normal = a * meff; + } else if (damping_model == TSUJI) { + damp_normal = sqrt(meff * knfac); + } else damp_normal = 0.0; + + damp_normal_prefactor = gamma_norm * damp_normal; + return -damp_normal_prefactor * vnnr; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::tangential_no_history() +{ + double gamma_scaled = gamma_tang * damp_normal_prefactor; + double fsmag, Ft; + + // classic pair gran/hooke (no history) + fsmag = gamma_scaled * vrel; + if (vrel != 0.0) Ft = MIN(Fscrit,fsmag) / vrel; + else Ft = 0.0; + + Ft = -Ft; + MathExtra::scale3(Ft, vtr, fs); +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::tangential_forces(double *history) +{ + double gamma_scaled = gamma_tang * damp_normal_prefactor; + double k = k_tang; + int frame_update = 0; + double fsmag, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (history_update) { + rsht = MathExtra::dot(history, nx); + frameupdate = fabs(rsht) * k > EPSILON * Fscrit; + + if (frameupdate) { + shrmag = MathExtra::len3(history); + // projection + MathExtra::scale3(rsht, nx, history); + // also rescale to preserve magnitude + prjmag = MathExtra::len3(history); + if (prjmag > 0) temp_double = shrmag / prjmag; + else temp_double = 0; + MathExtra::scale3(temp_double, history); + } + + // update history + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + temp_dbl = k * dt; + MathExtra::scale3(temp_dbl, vtr, temp_array); + MathExtra::sub3(history, temp_array, history); + } + + // tangential forces = history + tangential velocity damping + temp_double = -gamma; + MathExtra::scale3(temp_double, vtr, fs); + + // rescale frictional displacements and forces if needed + fsmag = MathExtra::len3(fs); + if (fsmag > Fscrit) { + shrmag = MathExtra::len3(history); + if (shrmag != 0.0) { + temp_double = Fscrit / magfs; + MathExtra::scale3(temp_double, fs, history); + MathExtra::scale3(gamma, vtr, temp_array); + MathExtra::add3(history, temp_array, history); + temp_double = Fscrit / magfs; + MathExtra::scale3(temp_double, fs); + } else { + MathExtra::zero3(fs); + } + } +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::tangential_mindlin(double *history) +{ + double k_scaled, gamma_scaled, fsmag, rsht, shrmag, prjmag, temp_dbl; + double temp_array[3]; + int frame_update = 0; + + gamma_scaled = gamma_tang * damp_normal_prefactor; + k_scaled = k_tange * a; + if (mindlin_rescale) { + // on unloading, rescale the shear displacements/force + if (a < history[3]) { + temp_double = a / history[3]; + MathExtra::scale3(temp_double, history); + } + } + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (history_update) { + rsht = MathExtra::dot(history, nx); + if (mindlin_force) + frameupdate = fabs(rsht) > EPSILON * Fscrit; + else + frameupdate = fabs(rsht) * k_scaled > EPSILON * Fscrit; + + if (frameupdate) { + shrmag = MathExtra::len3(history); + // projection + MathExtra::scale3(rsht, nx, history); + // also rescale to preserve magnitude + prjmag = MathExtra::len3(history); + if (prjmag > 0) temp_double = shrmag / prjmag; + else temp_double = 0; + MathExtra::scale3(temp_double, history); + } + + // update history + if (mindlin_force) { + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + temp_dbl = -k_scaled * dt; + MathExtra::scale3(temp_dbl, vtr, temp_array); + } else { + MathExtra::scale3(dt, vtr, temp_array); + } + MathExtra::add3(history, temp_array, history); + + if (mindlin_rescale) history[3] = a; + } + + // tangential forces = history + tangential velocity damping + temp_double = -gamma_scaled; + MathExtra::scale3(temp_double, vtr, fs); + + if (! mindlin_force) { + MathExtra::scale3(k_scaled, history, temp_array); + MathExtra::add3(fs, temp_array, fs); + } + + // rescale frictional displacements and forces if needed + fsmag = MathExtra::len3(fs); + if (fsmag > Fscrit) { + shrmag = MathExtra::len3(history); + if (shrmag != 0.0) { + temp_double = Fscrit / magfs; + MathExtra::scale3(temp_double, fs, history); + MathExtra::scale3(gamma, vtr, temp_array); + MathExtra::add3(history, temp_array, history); + if (! mindlin_force) { + temp_double = -1.0 / k; + MathExtra::scale3(temp_double, history); + } + temp_double = Fscrit / magfs; + MathExtra::scale3(temp_double, fs); + } else { + MathExtra::zero3(fs); + } + } +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::rolling(double *history) +{ + int rhist0, rhist1, rhist2, frameupdate; + double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_array[3]; + + rhist0 = roll_history_index; + rhist1 = rhist0 + 1; + rhist2 = rhist1 + 1; + + Frcrit = mu_roll * Fncrit; + + if (history_update) { + hist_temp[0] = history[rhist0]; + hist_temp[1] = history[rhist1]; + hist_temp[2] = history[rhist2]; + rolldotn = MathExtra::dot3(hist_temp, nx); + + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; + if (frameupdate) { // rotate into tangential plane + rollmag = MathExtra::len3(temp); + // projection + temp_double = -rolldotn; + MathExtra::scale3(temp_double, nx, temp); + + // also rescale to preserve magnitude + prjmag = MathExtra::len3(hist_temp); + if (prjmag > 0) temp_double = rollmag / prjmag; + else temp_double = 0; + MathExtra::scale3(temp_double, hist_temp); + } + MathExtra::scale3(dt, vrl, temp_array); + MathExtra::add3(hist_temp, temp_array, hist_temp) + } + + MathExtra::scaleadd3(k_roll, hist_tepm, gamma_roll, vrl, fr); + MathExtra::negate3(fr); + + // rescale frictional displacements and forces if needed + + magfr = MathExtra::len3(fr); + if (magfr > Frcrit) { + rollmag = MathExtra::len3(temp); + if (rollmag != 0.0) { + temp_double = -Frcrit / (magfr * k_roll); + MathExtra::scale3(temp_double, fr, temp_array); + MathExtra::add3(hist_temp, temp_array, hist_temp); + + temp_double = -gamma_roll/k_roll; + MathExtra::scale3(temp_double, vrl, temp_array); + MathExtra::add3(hist_temp, temp_array, hist_temp) + + temp_double = Frcrit / magfr; + MathExtra::scale3(temp_double, fr); + } else { + MathExtra::zero3(fr); + } + } + + history[rhist0] = hist_temp[0]; + history[rhist1] = hist_temp[1]; + history[rhist2] = hist_temp[2]; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::twisting_marshall(double *history) +{ + // Overwrite twist coefficients with derived values + k_twist = 0.5 * k_tangential * a * a; // eq 32 of Marshall paper + gamma_twist = 0.5 * gamma_tangential * a * a; + mu_twist = TWOTHIRDS * a * mu_tangential; + + twisting_SDS(history); +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::twisting_SDS(double *history) +{ + double signtwist, Mtcrit; + + if (historyupdate) { + history[twist_history_index] += magtwist * dt; + } + + magtortwist = -k_twist * history[twist_history_index] - damp_twist*magtwist; // M_t torque (eq 30) + signtwist = (magtwist > 0) - (magtwist < 0); + Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) + if (fabs(magtortwist) > Mtcrit) { + history[twist_history_index] = (Mtcrit * signtwist - gamma_twist * magtwist) / k_twist; + magtortwist = -Mtcrit * signtwist; // eq 34 + } +} + +/* ---------------------------------------------------------------------- + compute pull-off distance (beyond contact) for a given radius and atom type + use temporary variables since this does not use a specific contact geometry +------------------------------------------------------------------------- */ + +double ContactModel::pulloff_distance(double radi, double radj) +{ + double Ecaled, a_tmp, Reff_tmp; + + if (normal_model != JKR) return radi+radj; + + Reff_tmp = radi * radj / (radi + radj); + if (Reff_tmp <= 0) return 0; + Ecaled = E * THREEQUARTERS; + a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); + return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); +} + +}} diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h new file mode 100644 index 0000000000..a5b5d23463 --- /dev/null +++ b/src/GRANULAR/contact.h @@ -0,0 +1,73 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_CONTACT +_H +#define LMP_CONTACT +_H + +namespace LAMMPS_NS { +namespace Contact { + + class ContactModel { + public: + ContactModel(); + void reset_contact(); + bool check_contact(); + void prep_contact(); + void calculate_forces(double *, double *, double *, double *); + double pulloff_distance(double, double); + + int normal_model, damping_model, tangential_model; + int roll_model, twist_model; + int limit_damping; + double cutoff_type; + double Emod, poisson; // variables used in defining mixed interactions + double k_norm, gamma_norm, cohesion; // normal_coeffs + double k_tang, gamma_tang, mu_tang; // tangential_coeffs - wutang? + double k_roll, gamma_roll, mu_roll; // roll_coeffs + double k_twist, gamma_twist, mu_twist; // twist_coeffs + + double radi, radj, meff, dt; + double xi[3], xj[3], vi[3], vj[3], omegai[3], omegaj[3]; + int history_update, roll_history_index, twist_history_index; + + private: + double a, knfac, Fncrit, Fscrit, Frcrit, damp_normal_prefactor; + double fs[3], fr[3], ft[3]; + double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta; + double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrel; + double magtwist, magtortwist; + bool touch; + + int prep_flag, check_flag; + int mindlin_rescale, mindlin_force; + + void touch_JKR(int); + double normal_JKR(); + double normal_DMT(); + double normal_Hertz(); + double normal_Hooke(); + double normal_damping(); + void tangential_no_history(); + void tangential_history(double *); + void tangential_mindlin(double *); + void rolling(double *); + void twisting_marshall(double *); + void twisting_SDS(double *); + + }; + +} // namespace Contact +} // namespace LAMMPS_NS +#endif diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 34edbc0ae3..61644df9c2 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -22,6 +22,7 @@ #include "atom.h" #include "comm.h" +#include "contact.h" #include "error.h" #include "fix.h" #include "fix_dummy.h" @@ -43,23 +44,9 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; +using namespace Contact; -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define THREEQUARTERS 0.75 // 3/4 -#define EPSILON 1e-10 - -enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; -enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; /* ---------------------------------------------------------------------- */ @@ -83,6 +70,8 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) maxrad_dynamic = nullptr; maxrad_frozen = nullptr; + models = nullptr; + limit_damping = nullptr; history_transfer_factors = nullptr; @@ -121,6 +110,8 @@ PairGranular::~PairGranular() memory->destroy(cutsq); memory->destroy(cutoff_type); + memory->destroy(models); + memory->destroy(normal_coeffs); memory->destroy(tangential_coeffs); memory->destroy(roll_coeffs); @@ -150,38 +141,9 @@ PairGranular::~PairGranular() void PairGranular::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; - double dx[3],fx[3],nx[3]; - double radi,radj,radsum,rsq,r,rinv,factor_lj; - double Reff, delta, dR, dR2, dist_to_contact; + double factor_lj,mi,mj,meff; + double forces[3], torquesi[3], torquesj[3]; - double vr[3],vnnr,vn[3],vt[3],wr[3],vtr[3],vrel[3]; - double temp[3], temp_dbl; - - double damp_normal=0.0, damp_normal_prefactor; - double k_tangential, damp_tangential; - double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; - double magfs, fs[3], tor[3]; - - double mi,mj,meff; - double relrot[3],vrl[3]; - - ContactModel model; - ContactGeom geom; - - // rolling - double k_roll, damp_roll; - int rhist0, rhist1, rhist2; - double torroll[3]; - double rollmag, rolldotn, scalefac; - double magfr, fr[3]; - - // twisting - double k_twist, damp_twist, mu_twist; - double signtwist, magtwist, magtortwist, Mtcrit; - double tortwist[3]; - - double shrmag,rsht,prjmag; - bool frameupdate; int *ilist,*jlist,*numneigh,**firstneigh; int *touch,**firsttouch; double *history,*allhistory,**firsthistory; @@ -235,8 +197,6 @@ void PairGranular::compute(int eflag, int vflag) for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = type[i]; - itype = type[i]; - radi = radius[i]; if (use_history) { touch = firsttouch[i]; allhistory = firsthistory[i]; @@ -251,24 +211,17 @@ void PairGranular::compute(int eflag, int vflag) if (factor_lj == 0) continue; - MathExtra::sub3(x[i], x[j], dx); jtype = type[j]; - rsq = MathExtra::lensq3(dx); - radj = radius[j]; - radsum = radi + radj; - Reff = radi*radj/radsum; - // Copy data into structures to easily pass to functions - geom.rsq = rsq; - geom.Reff = Reff; - geom.radsum = radsum; + // Reset model and copy initial geometric data + models[itype][jtype]->reset_contact(); + models[itype][jtype].xi = x[i]; + models[itype][jtype].xj = x[j]; + models[itype][jtype].radi = radius[i]; + models[itype][jtype].radj = radius[j]; - touchflag = false; - if (normal_model[itype][jtype] == JKR) { - touchflag = touch_JKR(touch[jj], geom, model) - } else { - touchflag = (rsq < radsum*radsum); - } + + touchflag = models[itype][jtype]->check_contact(); if (!touchflag) { // unset non-touching neighbors @@ -278,336 +231,57 @@ void PairGranular::compute(int eflag, int vflag) for (int k = 0; k < size_history; k++) history[k] = 0.0; } } else { - r = sqrt(rsq); - rinv = 1.0/r; - - // Copy data into structures to easily pass to functions - geom.r = r; - geom.rinv = rinv - geom.delta = radsum - r; - geom.dR = geom.delta*Reff; - - model.normal = normal_model[itype][jtype]; - model.damping = damping_model[itype][jtype]; - model.tangential = tangential_model[itype][jtype]; - model.roll = roll_model[itype][jtype]; - model.twist = twist_model[itype][jtype]; - model.E = normal_coeffs[itype][jtype][0]; - model.damp = normal_coeffs[itype][jtype][1]; - model.poisson = normal_coeffs[itype][jtype][2]; - model.coh = normal_coeffs[itype][jtype][3]; - - MathExtra::scale3(rinv, dx, nx); - - // relative translational velocity - MathExtra::sub3(v[i], v[j], vr); - - // normal component - vnnr = MathExtra::dot3(vr, nx); //v_R . n - MathExtra::scale3(vnnr, nx, vn); // meff = effective mass of pair of particles // if I or J part of rigid body, use body mass // if I or J is frozen, meff is other particle - mi = rmass[i]; mj = rmass[j]; if (fix_rigid) { if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; } - meff = mi * mj / (mi + mj); if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; - if (model.normal == JKR) { - touch[jj] = 1; - normal_JKR(Fne, Fncrit, geom, model); - } else if (model.normal == DMT) { - normal_DMT(Fne, Fncrit, geom, model); - } else { - normal_hooke(Fne, Fncrit, geom, model); - } + // Copy additional information and prepare force calculations + models[itype][jtype].meff = meff; + models[itype][jtype].dt = dt; + models[itype][jtype].history_update = historyupdate; + models[itype][jtype].roll_history_index = roll_history_index; + models[itype][jtype].twist_history_index = twist_history_index; + models[itype][jtype].vi = v[i]; + models[itype][jtype].vj = v[j]; + models[itype][jtype].omegai = omega[i]; + models[itype][jtype].omegaj = omega[j]; + models[itype][jtype] -> prep_contact(); - // NOTE: consider restricting Hooke to only have - // 'velocity' as an option for damping? - Fdamp = normal_damping(vnnr, meff, geom, model); - - Fntot = Fne + Fdamp; - if (limit_damping[itype][jtype] && (Fntot < 0.0)) Fntot = 0.0; - - //**************************************** - // tangential force, including history effects - //**************************************** - - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - // tangential component - MathExtra::sub3(vr, vn, vt); - - // relative rotational velocity - MathExtra::scaleadd3(radi, omega[i], radj, omega[j], wr); - - // relative tangential velocities - MathExtra::cross3(wr, nx, temp); - MathExtra::sub3(vt, temp, vtr); - vrel = MathExtra::len(vtr); + if (models[itype][jtype].normal_model == JKR) touch[jj] = 1; // if any history is needed if (use_history) { touch[jj] = 1; history = &allhistory[size_history*jj]; } - Fncrit = critical_normal(Fne, Fntot, geom, model); - Fscrit = model.poisson * Fncrit; - - //------------------------------ - // tangential forces - //------------------------------ - - k_tangential = tangential_coeffs[itype][jtype][0]; - damp_tangential = tangential_coeffs[itype][jtype][1] * - damp_normal_prefactor; - - if (tangential_history) { - if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE) { - k_tangential *= a; - } else if (tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE_FORCE) { - k_tangential *= a; - // on unloading, rescale the shear displacements/force - if (a < history[3]) { - double factor = a/history[3]; - MathExtra::scale3(history, factor); - } - } - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (historyupdate) { - rsht = history[0]*nx + history[1]*ny + history[2]*nz; - if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE_FORCE) - frameupdate = fabs(rsht) > EPSILON * Fscrit; - else - frameupdate = fabs(rsht) * k_tangential > EPSILON * Fscrit; - if (frameupdate) { - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - // projection - MathExtra::scale3(rsht, nx, history); - - // also rescale to preserve magnitude - prjmag = MathExtra::len3(history); - if (prjmag > 0) scalefac = shrmag/prjmag; - else scalefac = 0; - MathExtra::scale3(scalefac, history); - } - // update history - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - // tangential displacement - MathExtra::scale3(dt, vtr, temp); - MathExtra::add3(temp, history, history); - } else { - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - MathExtra::scale3(k_tangential*dt, vtr, temp); - MathExtra::sub3(history, temp, history); - } - if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE_FORCE) - history[3] = a; - } - - // tangential forces = history + tangential velocity damping - MathExtra::scale3(-damp_tangential, vtr, fs); - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - MathExtra::scale3(-k_tangential, history, temp); - MathExtra::add3(fs, temp, fs); - } - - // rescale frictional displacements and forces if needed - magfs = MathExtra::len3(fs); - if (fs > Fscrit) { - shrmag = MathExtra::len3(history); - if (shrmag != 0.0) { - history[0] = Fscrit*fs[0]/magfs + damp_tangential*vtr[0]; - history[1] = Fscrit*fs[1]/magfs + damp_tangential*vtr[1]; - history[2] = Fscrit*fs[2]/magfs + damp_tangential*vtr[2]; - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE) { - MathExtra::scale3(-1.0/k_tangential, history); - } - MathExtra::scale3(Fscrit/magfs, fs); - } else MathExtra::zero3(fs); - } - } else { // classic pair gran/hooke (no history) - fs = damp_tangential*vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; - else Ft = 0.0; - MathExtra::scale3(-Ft, vtr, fs); - } - - if (roll_model[itype][jtype] != ROLL_NONE || - twist_model[itype][jtype] != TWIST_NONE) { - MathExtra::sub3(omega[i], omega[j], relrot); - } - //**************************************** - // rolling resistance - //**************************************** - - if (roll_model[itype][jtype] != ROLL_NONE) { - // rolling velocity, - // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, - // which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - vrl[0] = Reff * (relrot[1] * n[2] - relrot[2] * nx[1]); - vrl[1] = Reff * (relrot[2] * n[0] - relrot[0] * nx[2]); - vrl[2] = Reff * (relrot[0] * n[1] - relrot[1] * nx[0]); - - rhist0 = roll_history_index; - rhist1 = rhist0 + 1; - rhist2 = rhist1 + 1; - - k_roll = roll_coeffs[itype][jtype][0]; - damp_roll = roll_coeffs[itype][jtype][1]; - Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; - - if (historyupdate) { - temp[0] = history[rhist0]; - temp[1] = history[rhist1]; - temp[2] = history[rhist2]; - rolldotn = MathExtra::dot3(temp, nx); - frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; - if (frameupdate) { // rotate into tangential plane - rollmag = MathExtra::len3(temp); - // projection - temp[0] -= rolldotn*nx[0]; - temp[1] -= rolldotn*nx[1]; - temp[2] -= rolldotn*nx[2]; - // also rescale to preserve magnitude - prjmag = MathExtra::len3(temp); - if (prjmag > 0) scalefac = rollmag/prjmag; - else scalefac = 0; - MathExtra::scale3(scalefac, temp); - } - temp[0] += vrl[0]*dt; - temp[1] += vrl[1]*dt; - temp[2] += vrl[2]*dt; - } - - fr[0] = -k_roll*temp[0] - damp_roll*vrl[0]; - fr[1] = -k_roll*temp[1] - damp_roll*vrl[1]; - fr[2] = -k_roll*temp[2] - damp_roll*vrl[2]; - - // rescale frictional displacements and forces if needed - - magfr = MathExtra::len3(fr); - if (magfr > Frcrit) { - rollmag = MathExtra::len3(temp); - if (rollmag != 0.0) { - temp[0] = -1.0/k_roll*(Frcrit*fr[0]/magfr + damp_roll*vrl[0]); - temp[1] = -1.0/k_roll*(Frcrit*fr[1]/magfr + damp_roll*vrl[1]); - temp[2] = -1.0/k_roll*(Frcrit*fr[2]/magfr + damp_roll*vrl[2]); - fr[0] *= Frcrit/magfr; - fr[1] *= Frcrit/magfr; - fr[2] *= Frcrit/magfr; - } else MathExtra::zero3(fr); - } - - history[rhist0] = temp[0]; - history[rhist1] = temp[1]; - history[rhist2] = temp[2]; - } - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model[itype][jtype] != TWIST_NONE) { - // omega_T (eq 29 of Marshall) - magtwist = MathExtra::dot3(relrot, nx); - if (twist_model[itype][jtype] == TWIST_MARSHALL) { - k_twist = 0.5*k_tangential*a*a;; // eq 32 of Marshall paper - damp_twist = 0.5*damp_tangential*a*a; - mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2]; - } else { - k_twist = twist_coeffs[itype][jtype][0]; - damp_twist = twist_coeffs[itype][jtype][1]; - mu_twist = twist_coeffs[itype][jtype][2]; - } - if (historyupdate) { - history[twist_history_index] += magtwist*dt; - } - magtortwist = -k_twist*history[twist_history_index] - - damp_twist*magtwist; // M_t torque (eq 30) - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - history[twist_history_index] = 1.0/k_twist*(Mtcrit*signtwist - - damp_twist*magtwist); - magtortwist = -Mtcrit * signtwist; // eq 34 - } - } + models[itype][jtype].calculate_forces(forces, torquesi, torquesj, history); // apply forces & torques + MathExtra::scale3(factor_lj, forces); + MathExtra::add3(f[i], forces, f[i]); - MathExtra::scale3(Fntot, nx, fx); - MathExtra::add3(fx, fs, fx); - MathExtra::scale3(factor_lj, fx); - MathExtra::add3(f[i], fx, f[i]); - - MathExtra::cross3(nx, fs, tor); - MathExtra::scale3(factor_lj, tor); - - dist_to_contact = radi-0.5*delta; - MathExtra::scale3(dist_to_contact, tor, temp); - MathExtra::sub3(torque[i], temp, torque[i]); - - if (twist_model[itype][jtype] != TWIST_NONE) { - MathExtra::scale3(magtortwist, nx, tortwist); - MathExtra::scale3(factor_lj, tortwist); - MathExtra::add3(torque[i], tortwist, torque[i]); - } - - if (roll_model[itype][jtype] != ROLL_NONE) { - MathExtra::cross3(nx, fr, torroll); - MathExtra::scale3(Reff, torroll); - MathExtra::scale3(factor_lj, torroll); - MathExtra::add3(torque[i], torroll, torque[i]); - } + MathExtra::scale3(factor_lj, torquesi); + MathExtra::add3(torques[i], torquesi, torques[i]); if (force->newton_pair || j < nlocal) { - MathExtra::sub3(f[j], fx, f[j]); - - dist_to_contact = radj-0.5*delta; - MathExtra::scale3(dist_to_contact, tor, temp); - MathExtra::sub3(torque[j], tor, torque[j]); - - if (twist_model[itype][jtype] != TWIST_NONE) - MathExtra::sub3(torque[j], tortwist, torque[j]); - if (roll_model[itype][jtype] != ROLL_NONE) - MathExtra::sub3(torque[j], torroll, torque[j]); + MathExtra::sub3(f[j], forces, f[j]); + MathExtra::scale3(factor_lj, torquesj); + MathExtra::add3(torques[j], torquesj, torques[j]); } + if (evflag) ev_tally_xyz(i,j,nlocal,force->newton_pair, - 0.0,0.0,fx[0],fx[1],fx[2],dx[0],dy[1],dx[2]); + 0.0,0.0,forces[0],forces[1],forces[2],dx[0],dy[1],dx[2]); } } } @@ -629,20 +303,7 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - memory->create(normal_coeffs,n+1,n+1,4,"pair:normal_coeffs"); - memory->create(tangential_coeffs,n+1,n+1,3,"pair:tangential_coeffs"); - memory->create(roll_coeffs,n+1,n+1,3,"pair:roll_coeffs"); - memory->create(twist_coeffs,n+1,n+1,3,"pair:twist_coeffs"); - - memory->create(Emod,n+1,n+1,"pair:Emod"); - memory->create(poiss,n+1,n+1,"pair:poiss"); - - memory->create(normal_model,n+1,n+1,"pair:normal_model"); - memory->create(damping_model,n+1,n+1,"pair:damping_model"); - memory->create(tangential_model,n+1,n+1,"pair:tangential_model"); - memory->create(roll_model,n+1,n+1,"pair:roll_model"); - memory->create(twist_model,n+1,n+1,"pair:twist_model"); - memory->create(limit_damping,n+1,n+1,"pair:limit_damping"); + memory->create(models,n+1,n+1,"pair:models"); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -899,56 +560,64 @@ void PairGranular::coeff(int narg, char **arg) error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with DMT model"); + double Emod, poisson; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { - normal_model[i][j] = normal_model[j][i] = normal_model_one; - normal_coeffs[i][j][1] = normal_coeffs[j][i][1] = damp; + + // Define normal model + models[i][j].normal_model = models[j][i].normal_model = normal_model_one; + models[i][j].damping_model = models[j][i].damping_model = damping_model_one; + models[i][j].gamma_norm = models[j][i].gamma_norm = damp; + Emod = normal_coeffs_one[0]; + poisson = normal_coeffs_one[2]; + models[i][j].Emod = models[j][i].Emod = Emod; + models[i][j].poisson = models[j][i].poisson = poisson; + if (normal_model_one != HERTZ && normal_model_one != HOOKE) { - Emod[i][j] = Emod[j][i] = normal_coeffs_one[0]; - poiss[i][j] = poiss[j][i] = normal_coeffs_one[2]; - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = - FOURTHIRDS*mix_stiffnessE(Emod[i][j],Emod[i][j], - poiss[i][j],poiss[i][j]); + models[i][j].k_norm = models[j][i].k_norm = + FOURTHIRDS*mix_stiffnessE(Emod,Emod,poisson,poisson); } else { - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = normal_coeffs_one[0]; + models[i][j].k_norm = models[j][i].k_norm = normal_coeffs_one[0]; } if ((normal_model_one == JKR) || (normal_model_one == DMT)) - normal_coeffs[i][j][3] = normal_coeffs[j][i][3] = normal_coeffs_one[3]; + models[i][j].cohesion = models[j][i].cohesion = normal_coeffs_one[3]; - damping_model[i][j] = damping_model[j][i] = damping_model_one; - - tangential_model[i][j] = tangential_model[j][i] = tangential_model_one; + // Define tangential model + models[i][j].tangential_model = models[j][i].tangential_model = tangential_model_one; if (tangential_coeffs_one[0] == -1) { - tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = - 8*mix_stiffnessG(Emod[i][j],Emod[i][j],poiss[i][j],poiss[i][j]); + models[i][j].k_tang = models[j][i].k_tang = + 8*mix_stiffnessG(Emod, Emod, poisson, poisson); } else { - tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = - tangential_coeffs_one[0]; + models[i][j].k_tang = models[j][i].k_tang = tangential_coeffs_one[0]; } - for (int k = 1; k < 3; k++) - tangential_coeffs[i][j][k] = tangential_coeffs[j][i][k] = - tangential_coeffs_one[k]; + models[i][j].gamma_tang = models[j][i]].gamma_tang = tangential_coeffs_one[1]; + models[i][j].mu_tang = models[j][i]].mu_tang = tangential_coeffs_one[2]; - roll_model[i][j] = roll_model[j][i] = roll_model_one; - if (roll_model_one != ROLL_NONE) - for (int k = 0; k < 3; k++) - roll_coeffs[i][j][k] = roll_coeffs[j][i][k] = roll_coeffs_one[k]; + // Define rolling model + model[i][j].roll_model = model[j][i].roll_model = roll_model_one; + if (roll_model_one != ROLL_NONE) { + model[i][j].k_roll = model[j][i].k_roll = roll_coeffs_one[0]; + model[i][j].gamma_roll = model[j][i].gamma_roll = roll_coeffs_one[1]; + model[i][j].mu_roll = model[j][i].mu_roll = roll_coeffs_one[2]; + } - twist_model[i][j] = twist_model[j][i] = twist_model_one; - if (twist_model_one != TWIST_NONE && twist_model_one != TWIST_MARSHALL) - for (int k = 0; k < 3; k++) - twist_coeffs[i][j][k] = twist_coeffs[j][i][k] = twist_coeffs_one[k]; + // Define twisting model + models[i][j].twist_model = models[j][i].twist_model = twist_model_one; + if (twist_model_one != TWIST_NONE && twist_model_one != TWIST_MARSHALL) { + model[i][j].k_twist = model[j][i].k_twist = twist_coeffs_one[0]; + model[i][j].gamma_twist = model[j][i].gamma_twist = twist_coeffs_one[1]; + model[i][j].mu_twist = model[j][i].mu_twist = twist_coeffs_one[2]; + } - cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; - - limit_damping[i][j] = limit_damping[j][i] = ld_flag; + // Define extra options + model[i][j].cutoff_type = model[j][i].cutoff_type = cutoff_one; + model[i][j].limit_damping = model[j][i].limit_damping = ld_flag; setflag[i][j] = 1; count++; } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -976,7 +645,7 @@ void PairGranular::init_style() for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) - if (normal_model[i][j] == JKR) use_history = 1; + if (models[i][j].normal_model == JKR) use_history = 1; size_history = 3*tangential_history + 3*roll_history + twist_history; @@ -997,8 +666,8 @@ void PairGranular::init_style() } for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) - if (tangential_model[i][j] == TANGENTIAL_MINDLIN_RESCALE || - tangential_model[i][j] == TANGENTIAL_MINDLIN_RESCALE_FORCE) { + if (model[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE || + model[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { size_history += 1; roll_history_index += 1; twist_history_index += 1; @@ -1100,47 +769,61 @@ void PairGranular::init_style() double PairGranular::init_one(int i, int j) { - double cutoff=0.0; + double cutoff = 0.0; if (setflag[i][j] == 0) { - if ((normal_model[i][i] != normal_model[j][j]) || - (damping_model[i][i] != damping_model[j][j]) || - (tangential_model[i][i] != tangential_model[j][j]) || - (roll_model[i][i] != roll_model[j][j]) || - (twist_model[i][i] != twist_model[j][j])) { + if ((models[i][i].normal_model != models[j][j].normal_model) || + (models[i][i].damping_model != models[j][j].damping_model) || + (models[i][i].tangential_model != models[j][j].tangential_model) || + (models[i][i].roll_model != models[j][j].roll_model) || + (models[i][i].twist_model != models[j][j].twist_model)) { error->all(FLERR,"Granular pair style functional forms are different, " "cannot mix coefficients for types {} and {}. \n" "This combination must be set explicitly via a " "pair_coeff command",i,j); } - if (normal_model[i][j] == HERTZ || normal_model[i][j] == HOOKE) - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = - mix_geom(normal_coeffs[i][i][0], normal_coeffs[j][j][0]); + // Mix normal coefficients + if (models[i][j].normal_model == HERTZ || models[i][j].normal_model == HOOKE) + models[i][j].k_norm = models[j][i][0].k_norm = + mix_geom(models[i][i].k_norm, models[j][j].k_norm); else - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = - mix_stiffnessE(Emod[i][i], Emod[j][j], poiss[i][i], poiss[j][j]); + models[i][j].k_norm = models[j][i].k_norm = + mix_stiffnessE(models[i][i].Emod, models[j][j].Emod, + models[i][i].poisson, models[j][j].poisson); - normal_coeffs[i][j][1] = normal_coeffs[j][i][1] = - mix_geom(normal_coeffs[i][i][1], normal_coeffs[j][j][1]); + models[i][j].gamma_norm = models[j][i].gamma_norm = + mix_geom(models[i][i].gamma_norm, models[j][j].gamma_norm); if ((normal_model[i][j] == JKR) || (normal_model[i][j] == DMT)) - normal_coeffs[i][j][3] = normal_coeffs[j][i][3] = - mix_geom(normal_coeffs[i][i][3], normal_coeffs[j][j][3]); + models[i][j].cohesion = models[j][i].cohesion = + mix_geom(models[i][i].cohesion, models[j][j].cohesion); - for (int k = 0; k < 3; k++) - tangential_coeffs[i][j][k] = tangential_coeffs[j][i][k] = - mix_geom(tangential_coeffs[i][i][k], tangential_coeffs[j][j][k]); + // Mix tangential coefficients + models[i][j].k_tang = models[j][i].k_tang = + mix_geom(models[i][i].k_tang, models[j][j].k_tang); + models[i][j].gamma_tang = models[j][i].gamma_tang = + mix_geom(models[i][i].gamma_tang, models[j][j].gamma_tang); + models[i][j].mu_tang = models[j][i].mu_tang = + mix_geom(models[i][i].mu_tang, models[j][j].mu_tang); - if (roll_model[i][j] != ROLL_NONE) { - for (int k = 0; k < 3; k++) - roll_coeffs[i][j][k] = roll_coeffs[j][i][k] = - mix_geom(roll_coeffs[i][i][k], roll_coeffs[j][j][k]); + // Mix rolling coefficients + if (models.roll_model[i][j] != ROLL_NONE) { + models[i][j].k_roll = models[j][i].k_roll = + mix_geom(models[i][i].k_roll, models[j][j].k_roll); + models[i][j].gamma_roll = models[j][i].gamma_roll = + mix_geom(models[i][i].gamma_roll, models[j][j].gamma_roll); + models[i][j].mu_roll = models[j][i].mu_roll = + mix_geom(models[i][i].mu_roll, models[j][j].mu_roll); } - if (twist_model[i][j] != TWIST_NONE && twist_model[i][j] != TWIST_MARSHALL) { - for (int k = 0; k < 3; k++) - twist_coeffs[i][j][k] = twist_coeffs[j][i][k] = - mix_geom(twist_coeffs[i][i][k], twist_coeffs[j][j][k]); + // Mix twisting coefficients + if (models[i][j].twist_model != TWIST_NONE && models[i][j].twist_model != TWIST_MARSHALL) { + models[i][j].k_twist = models[j][i].k_twist = + mix_geom(models[i][i].k_twist, models[j][j].k_twist); + models[i][j].gamma_twist = models[j][i].gamma_twist = + mix_geom(models[i][i].gamma_twist, models[j][j].gamma_twist); + models[i][j].mu_twist = models[j][i].mu_twist = + mix_geom(models[i][i].mu_twist, models[j][j].mu_twist); } } @@ -1153,27 +836,23 @@ double PairGranular::init_one(int i, int j) // we assign cutoff = max(cut[i][j]) for i,j such that cut[i][j] > 0.0. double pulloff; - - if (cutoff_type[i][j] < 0 && cutoff_global < 0) { + if (models[i][j].cutoff_type < 0 && cutoff_global < 0) { if (((maxrad_dynamic[i] > 0.0) && (maxrad_dynamic[j] > 0.0)) || ((maxrad_dynamic[i] > 0.0) && (maxrad_frozen[j] > 0.0)) || // radius info about both i and j exist ((maxrad_frozen[i] > 0.0) && (maxrad_dynamic[j] > 0.0))) { - cutoff = maxrad_dynamic[i]+maxrad_dynamic[j]; + cutoff = maxrad_dynamic[i] + maxrad_dynamic[j]; pulloff = 0.0; if (normal_model[i][j] == JKR) { - pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j], i, j); + pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); cutoff += pulloff; + + pulloff = models[i][j]->pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); + cutoff = MAX(cutoff, maxrad_frozen[i] + maxrad_dynamic[j] + pulloff); + + pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); + cutoff = MAX(cutoff,maxrad_dynamic[i] + maxrad_frozen[j] + pulloff); } - - if (normal_model[i][j] == JKR) - pulloff = pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j], i, j); - cutoff = MAX(cutoff, maxrad_frozen[i]+maxrad_dynamic[j]+pulloff); - - if (normal_model[i][j] == JKR) - pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j], i, j); - cutoff = MAX(cutoff,maxrad_dynamic[i]+maxrad_frozen[j]+pulloff); - } else { // radius info about either i or j does not exist @@ -1187,8 +866,8 @@ double PairGranular::init_one(int i, int j) } cutoff = cutmax; } - } else if (cutoff_type[i][j] > 0) { - cutoff = cutoff_type[i][j]; + } else if (models[i][j].cutoff_type > 0) { + cutoff = models[i][j].cutoff_type; } else if (cutoff_global > 0) { cutoff = cutoff_global; } @@ -1207,17 +886,27 @@ void PairGranular::write_restart(FILE *fp) for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { - fwrite(&normal_model[i][j],sizeof(int),1,fp); - fwrite(&damping_model[i][j],sizeof(int),1,fp); - fwrite(&tangential_model[i][j],sizeof(int),1,fp); - fwrite(&roll_model[i][j],sizeof(int),1,fp); - fwrite(&twist_model[i][j],sizeof(int),1,fp); - fwrite(&limit_damping[i][j],sizeof(int),1,fp); - fwrite(normal_coeffs[i][j],sizeof(double),4,fp); - fwrite(tangential_coeffs[i][j],sizeof(double),3,fp); - fwrite(roll_coeffs[i][j],sizeof(double),3,fp); - fwrite(twist_coeffs[i][j],sizeof(double),3,fp); - fwrite(&cutoff_type[i][j],sizeof(double),1,fp); + fwrite(&models[i][j].normal_model,sizeof(int),1,fp); + fwrite(&models[i][j].damping_model,sizeof(int),1,fp); + fwrite(&models[i][j].tangential_model,sizeof(int),1,fp); + fwrite(&models[i][j].roll_model,sizeof(int),1,fp); + fwrite(&models[i][j].twist_model,sizeof(int),1,fp); + fwrite(&models[i][j].limit_damping,sizeof(int),1,fp); + fwrite(&models[i][j].Emod,sizeof(double),1,fp); + fwrite(&models[i][j].poisson,sizeof(double),1,fp); + fwrite(&models[i][j].k_norm,sizeof(double),1,fp); + fwrite(&models[i][j].gamma_norm,sizeof(double),1,fp); + fwrite(&models[i][j].cohesion,sizeof(double),1,fp); + fwrite(&models[i][j].k_tang,sizeof(double),1,fp); + fwrite(&models[i][j].gamma_tang,sizeof(double),1,fp); + fwrite(&models[i][j].mu_tang,sizeof(double),1,fp); + fwrite(&models[i][j].k_roll,sizeof(double),1,fp); + fwrite(&models[i][j].gamma_roll,sizeof(double),1,fp); + fwrite(&models[i][j].mu_roll,sizeof(double),1,fp); + fwrite(&models[i][j].k_twist,sizeof(double),1,fp); + fwrite(&models[i][j].gamma_twist,sizeof(double),1,fp); + fwrite(&models[i][j].mu_twist,sizeof(double),1,fp); + fwrite(&models[i][j].cutoff_type,sizeof(double),1,fp); } } } @@ -1238,29 +927,45 @@ void PairGranular::read_restart(FILE *fp) MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&limit_damping[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); - utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); - utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); - utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,nullptr,error); - utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].normal_model,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].damping_model,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].tangential_model,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].roll_model,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].twist_model,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].limit_damping,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].k_norm,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].gamma_norm,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].cohesion,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].k_tang,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].gamma_tang,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].mu_tang,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].k_roll,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].gamma_roll,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].mu_roll,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].k_twist,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].gamma_twist,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].mu_twist,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].cutoff_type,sizeof(double),1,fp,nullptr,error); } - MPI_Bcast(&normal_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&damping_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&tangential_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&roll_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&twist_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&limit_damping[i][j],1,MPI_INT,0,world); - MPI_Bcast(normal_coeffs[i][j],4,MPI_DOUBLE,0,world); - MPI_Bcast(tangential_coeffs[i][j],3,MPI_DOUBLE,0,world); - MPI_Bcast(roll_coeffs[i][j],3,MPI_DOUBLE,0,world); - MPI_Bcast(twist_coeffs[i][j],3,MPI_DOUBLE,0,world); - MPI_Bcast(&cutoff_type[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&models[i][j].normal_model,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].damping_model,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].tangential_model,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].roll_model,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].twist_model,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].limit_damping,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].k_norm,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].gamma_norm,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].cohesion,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].k_tang,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].gamma_tang,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].mu_tang,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].k_roll,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].gamma_roll,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].mu_roll,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].k_twist,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].gamma_twist,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].mu_twist,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].cutoff_type,1,MPI_DOUBLE,0,world); } } } @@ -1366,23 +1071,6 @@ double PairGranular::mix_geom(double valii, double valjj) return sqrt(valii*valjj); } - -/* ---------------------------------------------------------------------- - compute pull-off distance (beyond contact) for a given radius and atom type -------------------------------------------------------------------------- */ - -double PairGranular::pulloff_distance(double radi, double radj, - int itype, int jtype) -{ - double E, coh, a, Reff; - Reff = radi*radj/(radi+radj); - if (Reff <= 0) return 0; - coh = normal_coeffs[itype][jtype][3]; - E = normal_coeffs[itype][jtype][0]*THREEQUARTERS; - a = cbrt(9*MY_PI*coh*Reff*Reff/(4*E)); - return a*a/Reff - 2*sqrt(MY_PI*coh*a/E); -} - /* ---------------------------------------------------------------------- transfer history during fix/neigh/history exchange only needed if any history entries i-j are not just negative of j-i entries @@ -1402,11 +1090,11 @@ double PairGranular::atom2cut(int i) { double cut; - cut = atom->radius[i]*2; - if(beyond_contact) { + cut = atom->radius[i] * 2; + if (beyond_contact) { int itype = atom->type[i]; - if(normal_model[itype][itype] == JKR) { - cut += pulloff_distance(cut, cut, itype, itype); + if (models[itype][itype].normal_model == JKR) { + cut += models[itype][itype].pulloff_distance(cut, cut); } } @@ -1421,16 +1109,16 @@ double PairGranular::radii2cut(double r1, double r2) { double cut = 0.0; - if(beyond_contact) { + if (beyond_contact) { int n = atom->ntypes; double temp; // Check all combinations of i and j to find theoretical maximum pull off distance - for(int i = 0; i < n; i++){ - for(int j = 0; j < n; j++){ - if(normal_model[i][j] == JKR) { - temp = pulloff_distance(r1, r2, i, j); - if(temp > cut) cut = temp; + for (int i = 0; i < n; i++){ + for (int j = 0; j < n; j++){ + if (models[i][j].normal_model == JKR) { + temp = pulloff_distance(r1, r2); + if (temp > cut) cut = temp; } } } @@ -1440,99 +1128,3 @@ double PairGranular::radii2cut(double r1, double r2) return cut; } - -double PairGranular::touch_JKR(int touch, ContactGeom geom, ContactModel model) -{ - double E, R2, a, delta_pulloff, dist_pulloff; - bool touchflag; - E = model.E; - E *= THREEQUARTERS; - if (touch) { - R2 = geom.Reff * geom.Reff; - a = cbrt(9.0 * MY_PI * model.coh * R2 / (4 * E)); - delta_pulloff = a * a / Reff - 2 * sqrt(MY_PI * coh * a / E); - dist_pulloff = geom.radsum - delta_pulloff; - touchflag = (geom.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (geom.rsq < geom.radsum * geom.radsum); - } - return touchflag; -} - -void PairGranular::normal_JKR(double &Fne, ContactGeom geom, ContactModel model) -{ - double R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff; - - R2 = geom.Reff * geom.Reff; - dR2 = geom.dR * geom.dR; - t0 = model.coh * model.coh * R2 * R2 * model.E; - t1 = PI27SQ*t0; - t2 = 8 * geom.dR * dR2 * model.E * model.E * model.E; - t3 = 4 * dR2 * E; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / E; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * model.coh * MY_PI * R2 / (model.E * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - - Fne = model.E * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * model.coh * model.E / (MY_PI * a)); - model.a = a; - model.knfac = model.E*a; -} - -void PairGraunular::normal_DMT(double &Fne, ContactGeom geom, ContactModel model) -{ - double a = sqrt(geom.dR); - Fne = a * model.E * geom.delta; - Fne -= 4 * MY_PI * model.coh * geom.Reff; - F_pulloff = 4 * MY_PI * model.coh * geom.Reff; - model.a = a; - model.knfact = model.E * a; -} - -void PairGraunular::normal_Hooke(double &Fne, ContactGeom geom, ContactModel model) -{ - double a = sqrt(geom.dR); - Fne = model.E * geom.delta; - if (model.normal != HOOKE) Fne *= a; - model.a = a; - model.knfac = model.E; - if (model.normal != HOOKE) model.knfac *= a; -} - -double PairGranular::normal_damping(double vnnr, double meff, ContactGeom geom, ContactModel model) -{ - double damp_normal, a; - if (model.damping == VELOCITY) { - damp_normal = 1; - } else if (model.damping == MASS_VELOCITY) { - damp_normal = meff; - } else if (model.damping == VISCOELASTIC) { - damp_normal = model.a * meff; - } else if (model.damping == TSUJI) { - damp_normal = sqrt(meff * model.knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = model.damp * damp_normal; - return -damp_normal_prefactor * vnnr; -} - -double PairGranular::critical_normal(double Fne, double Fntot, ContactGeom geom, Contactmodel model) -{ - if (model.normal == JKR) { - F_pulloff = 3*MY_PI*model.coh*geom.Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else if (model.normal == DMT) { - F_pulloff = 4*MY_PI*model.coh*geom.Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else { - Fncrit = fabs(Fntot); - } - return Fncrit; -} \ No newline at end of file diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 896db15231..509981d5f9 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -69,10 +69,8 @@ class PairGranular : public Pair { int size_history; int *history_transfer_factors; - // model choices - int **normal_model, **damping_model; - int **tangential_model, **roll_model, **twist_model; - int **limit_damping; + // contact models + ContactModel **models; // history flags int normal_history, tangential_history, roll_history, twist_history; @@ -83,15 +81,6 @@ class PairGranular : public Pair { int roll_history_index; int twist_history_index; - // per-type material coefficients - double **Emod, **poiss, **Gmod; - - // per-type coefficients, set in pair coeff command - double ***normal_coeffs; - double ***tangential_coeffs; - double ***roll_coeffs; - double ***twist_coeffs; - // optional user-specified global cutoff, per-type user-specified cutoffs double **cutoff_type; double cutoff_global; @@ -99,19 +88,6 @@ class PairGranular : public Pair { double mix_stiffnessE(double, double, double, double); double mix_stiffnessG(double, double, double, double); double mix_geom(double, double); - double pulloff_distance(double, double, int, int); - - // Structure to store details of model - struct ContactModel { - int normal, damping, tangential, roll, twist; - double E, damp, poisson, coh; - double a, knfac; - }; - - struct ContactGeom { - double r, rinv, rsq, Reff, radsum; - double delta, dR; - } }; } // namespace LAMMPS_NS diff --git a/src/contact.cpp b/src/contact.cpp new file mode 100644 index 0000000000..b7d5d4d85d --- /dev/null +++ b/src/contact.cpp @@ -0,0 +1,58 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- + + This class contains a series of DEM contact models + that can be defined and used to calculate forces + and torques based on contact geometry +*/ + +#include +#include "contact.h" + +namespace LAMMPS_NS { + namespace Contact{ + +enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; +enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; +enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; +enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; +enum {ROLL_NONE, ROLL_SDS}; + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define THREEQUARTERS 0.75 // 3/4 + +#define EPSILON 1e-10 + +ContactModel::ContactModel() +{ + +} + +/* ---------------------------------------------------------------------- + get volume-correct r basis in: basis*cbrt(vol) = q*r +------------------------------------------------------------------------- */ + +void ContactModel::() +{ + +} + + +}} diff --git a/src/contact.h b/src/contact.h new file mode 100644 index 0000000000..38cb6f0be6 --- /dev/null +++ b/src/contact.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_CONTACT +_H +#define LMP_CONTACT +_H + +namespace LAMMPS_NS { +namespace Contact { + + class ContactModel { + public: + ContactModel(); + void touch_JKR(int); + void normal_JKR(double&); + void normal_DMT(double&); + void normal_Hooke(double&); + double normal_damping(double, double); + double critical_normal(double, double); + + int normal_model, damping_model, tangential_model; + int roll_model, twist_model; + double E, G, poisson, damp, coh; + + private: + double a, knfac; + ContactGeometry geom; + }; + + + class ContactGeometry { + public: + ContactGeometry(); + void add_data(); + double r, rinv, rsq, Reff, radsum, delta, dR; + }; +} // namespace Contact +} // namespace LAMMPS_NS +#endif diff --git a/src/contact_model.cpp b/src/contact_model.cpp new file mode 100644 index 0000000000..779631836b --- /dev/null +++ b/src/contact_model.cpp @@ -0,0 +1,58 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- + + This class contains a series of DEM contact models + that can be defined and used to calculate forces + and torques based on contact geometry +*/ + +#include +#include "contact_model.h" + +namespace LAMMPS_NS { + namespace Contact_Model{ + +enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; +enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; +enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; +enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; +enum {ROLL_NONE, ROLL_SDS}; + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define THREEQUARTERS 0.75 // 3/4 + +#define EPSILON 1e-10 + +ContactModel::ContactModel() +{ + +} + +/* ---------------------------------------------------------------------- + get volume-correct r basis in: basis*cbrt(vol) = q*r +------------------------------------------------------------------------- */ + +void ContactModel::() +{ + +} + + +}} diff --git a/src/contact_model.h b/src/contact_model.h new file mode 100644 index 0000000000..678a7111a8 --- /dev/null +++ b/src/contact_model.h @@ -0,0 +1,35 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_CONTACT_MODEL_H +#define LMP_CONTACT_MODEL_H + +namespace LAMMPS_NS { +namespace Contact_Model { + + class ContactModel { + public: + ContactModel(); + void set_strain(const double, const double); + void step_deform(const double, const double); + bool reduce(); + void get_box(double[3][3], double); + void get_rot(double[3][3]); + void get_inverse_cob(int[3][3]); + + private: + double a, knfac; + }; +} // namespace Contact_Model +} // namespace LAMMPS_NS +#endif From 1faa7397d3f6effe234c07d04e150a54757ca07a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sat, 18 Jun 2022 10:11:57 -0600 Subject: [PATCH 07/57] Fixing complier issues, adding dump options, initail conduction --- doc/src/dump.rst | 5 +- doc/src/pair_granular.rst | 10 + src/GRANULAR/atom_vec_sphere_temp.cpp | 11 + src/GRANULAR/atom_vec_sphere_temp.h | 1 + src/GRANULAR/contact.cpp | 385 ++++++++-------- src/GRANULAR/contact.h | 46 +- src/GRANULAR/fix_temp_integrate.cpp | 34 +- src/GRANULAR/pair_granular.cpp | 249 +++++++--- src/GRANULAR/pair_granular.h | 5 +- src/contact.cpp | 625 +++++++++++++++++++++++++- src/contact.h | 85 +++- src/contact_model.cpp | 58 --- src/contact_model.h | 35 -- src/dump_custom.cpp | 50 ++- src/dump_custom.h | 2 + src/fix_neigh_history.cpp | 5 +- 16 files changed, 1171 insertions(+), 435 deletions(-) delete mode 100644 src/contact_model.cpp delete mode 100644 src/contact_model.h diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 4d272c940b..4406c827bf 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -81,6 +81,7 @@ Syntax q, mux, muy, muz, mu, radius, diameter, omegax, omegay, omegaz, angmomx, angmomy, angmomz, tqx, tqy, tqz, + heatflux, temperature, c_ID, c_ID[I], f_ID, f_ID[I], v_name, i_name, d_name, i2_name[I], d2_name[I] @@ -103,10 +104,12 @@ Syntax q = atom charge mux,muy,muz = orientation of dipole moment of atom mu = magnitude of dipole moment of atom - radius,diameter = radius,diameter of spherical particle + radius,diameter = radius, diameter of spherical particle omegax,omegay,omegaz = angular velocity of spherical particle angmomx,angmomy,angmomz = angular momentum of aspherical particle tqx,tqy,tqz = torque on finite-size particles + heatflux = flux of heat into particle + temperature = temperature of particle c_ID = per-atom vector calculated by a compute with ID c_ID[I] = Ith column of per-atom array calculated by a compute with ID, I can include wildcard (see below) f_ID = per-atom vector calculated by a fix with ID diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 6f84b0d9c7..9a99558653 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -37,6 +37,9 @@ Examples pair_coeff 1 1 dmt 1000.0 50.0 0.3 0.0 tangential mindlin NULL 0.5 0.5 rolling sds 500.0 200.0 0.5 twisting marshall pair_coeff 2 2 dmt 1000.0 50.0 0.3 10.0 tangential mindlin NULL 0.5 0.1 rolling sds 500.0 200.0 0.1 twisting marshall + pair_style granular + pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4 heat 0.1 + Description """"""""""" @@ -631,6 +634,13 @@ attractive force. This keyword cannot be used with the JKR or DMT models. ---------- +The optional *heat* keyword enables heat conduction and it must be followed by +a non-negative numeric value for the conductivity. Note that the *heat* keyword +must be included in either all or none of of the *pair_coeff* calls. See +:doc:`fix temp/integrate ` for more information on this option. + +---------- + The *granular* pair style can reproduce the behavior of the *pair gran/\** styles with the appropriate settings (some very minor differences can be expected due to corrections in diff --git a/src/GRANULAR/atom_vec_sphere_temp.cpp b/src/GRANULAR/atom_vec_sphere_temp.cpp index d4e30e3154..a455a9ddc8 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.cpp +++ b/src/GRANULAR/atom_vec_sphere_temp.cpp @@ -28,6 +28,7 @@ using namespace MathConst; AtomVecSphereTemp::AtomVecSphereTemp(LAMMPS *lmp) : AtomVec(lmp) { mass_type = PER_ATOM; + forceclearflag = 1; molecular = Atom::ATOMIC; atom->sphere_flag = 1; @@ -107,6 +108,16 @@ void AtomVecSphereTemp::grow_pointers() omega = atom->omega; } +/* ---------------------------------------------------------------------- + clear extra forces starting at atom N + nbytes = # of bytes to clear for a per-atom vector +------------------------------------------------------------------------- */ + +void AtomVecSphereTemp::force_clear(int n, size_t nbytes) +{ + memset(&heatflux[n], 0, nbytes); +} + /* ---------------------------------------------------------------------- initialize non-zero atom quantities ------------------------------------------------------------------------- */ diff --git a/src/GRANULAR/atom_vec_sphere_temp.h b/src/GRANULAR/atom_vec_sphere_temp.h index f42b844886..70e047a8cc 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.h +++ b/src/GRANULAR/atom_vec_sphere_temp.h @@ -31,6 +31,7 @@ class AtomVecSphereTemp : public AtomVec { void init() override; void grow_pointers() override; + void force_clear(int, size_t) override; void create_atom_post(int) override; void data_atom_post(int) override; void pack_data_pre(int) override; diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 3cea933370..b4b335a1aa 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -17,28 +17,18 @@ and torques based on contact geometry */ -#include #include "contact.h" +#include "math_const.h" +#include "math_extra.h" +#include "pointers.h" -namespace LAMMPS_NS { - namespace Contact{ +#include -enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; -enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; +using namespace LAMMPS_NS; +using namespace MathExtra; +using namespace MathConst; -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define THREEQUARTERS 0.75 // 3/4 - -#define EPSILON 1e-10 +namespace Contact { ContactModel::ContactModel() { @@ -69,8 +59,8 @@ bool ContactModel::check_contact() { check_flag = 1; - MathExtra::sub3(xi, xj, dx); - rsq = MathExtra::lensq3(dx); + sub3(xi, xj, dx); + rsq = lensq3(dx); radsum = radi + radj; Reff = radi*radj/radsum; @@ -78,7 +68,7 @@ bool ContactModel::check_contact() if (normal_model == JKR) touch = touch_JKR(touch); else touch = (rsq < radsum*radsum); - return touch + return touch; } /* ---------------------------------------------------------------------- */ @@ -91,57 +81,57 @@ void ContactModel::prep_contact() if (check_flag != 1) touch = check_contact(); if (!touch) return; + double temp[3]; + // Set flags mindlin_rescale = mindlin_force = 0; if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - mindlin_rescale = 1 + mindlin_rescale = 1; if (tangential_model == TANGENTIAL_MINDLIN_FORCE || tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - mindlin_force = 1 - - double temp[3]; + mindlin_force = 1; // Standard geometric quantities r = sqrt(rsq); rinv = 1.0/r; delta = radsum - r; - dR = delta*Reff - MathExtra::scale3(rinv, dx, nx); + dR = delta*Reff; + scale3(rinv, dx, nx); // relative translational velocity - MathExtra::sub3(v[i], v[j], vr); + sub3(vi, vj, vr); // normal component - vnnr = MathExtra::dot3(vr, nx); //v_R . n - MathExtra::scale3(vnnr, nx, vn); + vnnr = dot3(vr, nx); //v_R . n + scale3(vnnr, nx, vn); // tangential component - MathExtra::sub3(vr, vn, vt); + sub3(vr, vn, vt); // relative rotational velocity - MathExtra::scaleadd3(radi, omegai, radj, omegaj, wr); + scaleadd3(radi, omegai, radj, omegaj, wr); // relative tangential velocities - MathExtra::cross3(wr, nx, temp); - MathExtra::sub3(vt, temp, vtr); - vrel = MathExtra::len(vtr); + cross3(wr, nx, temp); + sub3(vt, temp, vtr); + vrel = len3(vtr); - if (roll_model != NONE || twist_model != NONE) - MathExtra::sub3(omega[i], omega[j], relrot); + if (roll_model != ROLL_NONE || twist_model != TWIST_NONE) + sub3(omegai, omegaj, relrot); - if (roll_model != NONE) { + if (roll_model != ROLL_NONE) { // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) // this is different from the Marshall papers, which use the Bagi/Kuhn formulation // for rolling velocity (see Wang et al for why the latter is wrong) - vrl[0] = Reff * (relrot[1] * n[2] - relrot[2] * nx[1]); - vrl[1] = Reff * (relrot[2] * n[0] - relrot[0] * nx[2]); - vrl[2] = Reff * (relrot[0] * n[1] - relrot[1] * nx[0]); + vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); + vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); + vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); } - if (twist_model != NONE) { + if (twist_model != TWIST_NONE) { // omega_T (eq 29 of Marshall) - magtwist = MathExtra::dot3(relrot, nx); + magtwist = dot3(relrot, nx); } } @@ -154,23 +144,23 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to if (prep_flag != 1) prep_contact(); if (!touch) { forces[0] = forces[1] = forces[2] = 0.0; - return + return; } //********************************************** // normal forces //********************************************** - // Also calculates: a, knfac, Fncrit + // Also calculates: a, knfac, Fncrit (for JKR or DMT) double Fne; if (normal_model == JKR) { Fne = normal_JKR(); } else if (normal_model == DMT) { Fne = normal_DMT(); } else if (normal_model == HERTZ || normal_model == HERTZ_MATERIAL) { - Fne = normal_hertz(); + Fne = normal_Hertz(); } else { - Fne = normal_hooke(); + Fne = normal_Hooke(); } // NOTE: consider restricting Hooke to only have @@ -178,9 +168,11 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to // Also calculates: damp_normal_prefactor double Fdamp = normal_damping(); - double Fntot = Fne + Fdamp; + Fntot = Fne + Fdamp; if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; + if (normal_model != JKR && normal_model != DMT) Fncrit = fabs(Fntot); + //********************************************** // tangential force, including history effects //********************************************** @@ -190,15 +182,18 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to // For mindlin/force, mindlin_rescale/force: // history = cumulative tangential elastic force - Fncrit = critical_normal(Fne, Fntot, geom, model); Fscrit = mu_tang * Fncrit; - if (tangential_model == TANGENTIAL_NOHISTORY) { - tangential_no_history(); + if (tangential_model == TANGENTIAL_MINDLIN || + tangential_model == TANGENTIAL_MINDLIN_FORCE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { + tangential_mindlin(history); } else if (tangential_model == TANGENTIAL_HISTORY) { tangential_history(history); + } else { + tangential_no_history(); } - tangential_forces(history); //********************************************** // rolling force @@ -212,50 +207,63 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to //**************************************** if (twist_model == TWIST_MARSHALL) { - twist_marshall(history); + twisting_marshall(history); } else if (twist_model == TWIST_SDS) { - twist_SDS(history); + twisting_SDS(history); } //********************************************** // sum contributions //********************************************** - MathExtra::scale3(Fntot, nx, forces); - MathExtra::add3(forces, fs, forces); + scale3(Fntot, nx, forces); + add3(forces, fs, forces); - MathExtra::cross3(nx, fs, torquesi); - MathExtra::copy3(torquesi, torquesj); + cross3(nx, fs, torquesi); + copy3(torquesi, torquesj); double dist_to_contact = radi-0.5*delta; - MathExtra::scale3(dist_to_contact, torquesi); + scale3(dist_to_contact, torquesi); dist_to_contact = radj-0.5*delta; - MathExtra::scale3(dist_to_contact, torquesj); + scale3(dist_to_contact, torquesj); double torroll[3]; if (roll_model != ROLL_NONE) { - MathExtra::cross3(nx, fr, torroll); - MathExtra::scale3(Reff, torroll); - MathExtra::add3(torquesi, torroll, torquesi); - MathExtra::sub3(torquesj, torroll, torquesj); + cross3(nx, fr, torroll); + scale3(Reff, torroll); + add3(torquesi, torroll, torquesi); + sub3(torquesj, torroll, torquesj); } double tortwist[3]; - if (twist_model != NONE_TWIST) { - MathExtra::scale3(magtortwist, nx, tortwist); - MathExtra::add3(torquesi, tortwist, torquesi) - MathExtra::sub3(torquesj, tortwist, torquesj) + if (twist_model != TWIST_NONE) { + scale3(magtortwist, nx, tortwist); + add3(torquesi, tortwist, torquesi); + sub3(torquesj, tortwist, torquesj); } } /* ---------------------------------------------------------------------- */ -double ContactModel::touch_JKR(int touch) +double ContactModel::calculate_heat() +{ + double dT = Ti - Tj; + double Hc; + + //Dan is Emod the youngs modulus for all models? or do I need to scale? + Hc = 2 * conductivity * pow(FOURTHIRDS * Fntot * Reff / Emod, ONETHIRD); + + return Hc * dT; +} + +/* ---------------------------------------------------------------------- */ + +bool ContactModel::touch_JKR(int touch) { double Escaled, R2, delta_pulloff, dist_pulloff; bool touchflag; - Escaled = E*THREEQUARTERS; + Escaled = k_norm * THREEQUARTERS; if (touch) { R2 = Reff * Reff; a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); @@ -272,66 +280,68 @@ double ContactModel::touch_JKR(int touch) double ContactModel::normal_JKR() { - double R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff; + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; R2 = Reff * Reff; dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * E; + t0 = cohesion * cohesion * R2 * R2 * Escaled; t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * E * E * E; - t3 = 4 * dR2 * E; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; // in case sqrt(0) < 0 due to precision issues sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / E; + t5 = t3 / t4 + t4 / Escaled; sqrt2 = MAX(0, 2 * dR + t5); t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (E * t6)); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); a = INVROOT6 * (t6 + sqrt(sqrt3)); a2 = a * a; - double Fne = E * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * E / (MY_PI * a)); - double F_pulloff = 3 * MY_PI * cohesion * Reff; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; - knfac = E * a; - Fncrit = fabs(Fne + 2*F_pulloff); + knfac = Escaled * a; + Fncrit = fabs(Fne + 2 * F_pulloff); return Fne; } /* ---------------------------------------------------------------------- */ -double ContactModel::normal_DMT(double &Fne) +double ContactModel::normal_DMT() { a = sqrt(dR); - double Fne = a * E * delta; + double Fne = a * k_norm * delta; Fne -= 4 * MY_PI * cohesion * Reff; - F_pulloff = 4 * MY_PI * cohesion * Reff; + double F_pulloff = 4 * MY_PI * cohesion * Reff; - knfac = E * a; - Fncrit = fabs(Fne + 2*F_pulloff); + knfac = k_norm * a; + Fncrit = fabs(Fne + 2 * F_pulloff); return Fne; } /* ---------------------------------------------------------------------- */ -double ContactModel::normal_Hertz(double &Fne) +double ContactModel::normal_Hertz() { a = sqrt(dR); - double Fne = E * delta * a; + double Fne = k_norm * delta * a; - knfac = E * a; + knfac = k_norm * a; return Fne; } /* ---------------------------------------------------------------------- */ -double ContactModel::normal_Hooke(double &Fne) +double ContactModel::normal_Hooke() { a = sqrt(dR); - double Fne = E * delta; + double Fne = k_norm * delta; - knfac = E; + knfac = k_norm; return Fne; } @@ -356,7 +366,7 @@ double ContactModel::normal_damping() /* ---------------------------------------------------------------------- */ -double ContactModel::tangential_no_history() +void ContactModel::tangential_no_history() { double gamma_scaled = gamma_tang * damp_normal_prefactor; double fsmag, Ft; @@ -367,100 +377,100 @@ double ContactModel::tangential_no_history() else Ft = 0.0; Ft = -Ft; - MathExtra::scale3(Ft, vtr, fs); + scale3(Ft, vtr, fs); } /* ---------------------------------------------------------------------- */ -double ContactModel::tangential_forces(double *history) +void ContactModel::tangential_history(double *history) { double gamma_scaled = gamma_tang * damp_normal_prefactor; double k = k_tang; int frame_update = 0; - double fsmag, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 if (history_update) { - rsht = MathExtra::dot(history, nx); - frameupdate = fabs(rsht) * k > EPSILON * Fscrit; + rsht = dot3(history, nx); + frame_update = fabs(rsht) * k > EPSILON * Fscrit; - if (frameupdate) { - shrmag = MathExtra::len3(history); + if (frame_update) { + shrmag = len3(history); // projection - MathExtra::scale3(rsht, nx, history); + scale3(rsht, nx, history); // also rescale to preserve magnitude - prjmag = MathExtra::len3(history); - if (prjmag > 0) temp_double = shrmag / prjmag; - else temp_double = 0; - MathExtra::scale3(temp_double, history); + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); } // update history // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 temp_dbl = k * dt; - MathExtra::scale3(temp_dbl, vtr, temp_array); - MathExtra::sub3(history, temp_array, history); + scale3(temp_dbl, vtr, temp_array); + sub3(history, temp_array, history); } // tangential forces = history + tangential velocity damping - temp_double = -gamma; - MathExtra::scale3(temp_double, vtr, fs); + temp_dbl = -gamma_norm; + scale3(temp_dbl, vtr, fs); // rescale frictional displacements and forces if needed - fsmag = MathExtra::len3(fs); - if (fsmag > Fscrit) { - shrmag = MathExtra::len3(history); + magfs = len3(fs); + if (magfs > Fscrit) { + shrmag = len3(history); if (shrmag != 0.0) { - temp_double = Fscrit / magfs; - MathExtra::scale3(temp_double, fs, history); - MathExtra::scale3(gamma, vtr, temp_array); - MathExtra::add3(history, temp_array, history); - temp_double = Fscrit / magfs; - MathExtra::scale3(temp_double, fs); + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs, history); + scale3(gamma_norm, vtr, temp_array); + add3(history, temp_array, history); + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs); } else { - MathExtra::zero3(fs); + zero3(fs); } } } /* ---------------------------------------------------------------------- */ -double ContactModel::tangential_mindlin(double *history) +void ContactModel::tangential_mindlin(double *history) { - double k_scaled, gamma_scaled, fsmag, rsht, shrmag, prjmag, temp_dbl; + double k_scaled, gamma_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; int frame_update = 0; gamma_scaled = gamma_tang * damp_normal_prefactor; - k_scaled = k_tange * a; + k_scaled = k_tang * a; if (mindlin_rescale) { // on unloading, rescale the shear displacements/force if (a < history[3]) { - temp_double = a / history[3]; - MathExtra::scale3(temp_double, history); + temp_dbl = a / history[3]; + scale3(temp_dbl, history); } } // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 if (history_update) { - rsht = MathExtra::dot(history, nx); + rsht = dot3(history, nx); if (mindlin_force) - frameupdate = fabs(rsht) > EPSILON * Fscrit; + frame_update = fabs(rsht) > EPSILON * Fscrit; else - frameupdate = fabs(rsht) * k_scaled > EPSILON * Fscrit; + frame_update = fabs(rsht) * k_scaled > EPSILON * Fscrit; - if (frameupdate) { - shrmag = MathExtra::len3(history); + if (frame_update) { + shrmag = len3(history); // projection - MathExtra::scale3(rsht, nx, history); + scale3(rsht, nx, history); // also rescale to preserve magnitude - prjmag = MathExtra::len3(history); - if (prjmag > 0) temp_double = shrmag / prjmag; - else temp_double = 0; - MathExtra::scale3(temp_double, history); + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); } // update history @@ -468,51 +478,51 @@ double ContactModel::tangential_mindlin(double *history) // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 temp_dbl = -k_scaled * dt; - MathExtra::scale3(temp_dbl, vtr, temp_array); + scale3(temp_dbl, vtr, temp_array); } else { - MathExtra::scale3(dt, vtr, temp_array); + scale3(dt, vtr, temp_array); } - MathExtra::add3(history, temp_array, history); + add3(history, temp_array, history); if (mindlin_rescale) history[3] = a; } // tangential forces = history + tangential velocity damping - temp_double = -gamma_scaled; - MathExtra::scale3(temp_double, vtr, fs); + temp_dbl = -gamma_scaled; + scale3(temp_dbl, vtr, fs); if (! mindlin_force) { - MathExtra::scale3(k_scaled, history, temp_array); - MathExtra::add3(fs, temp_array, fs); + scale3(k_scaled, history, temp_array); + add3(fs, temp_array, fs); } // rescale frictional displacements and forces if needed - fsmag = MathExtra::len3(fs); - if (fsmag > Fscrit) { - shrmag = MathExtra::len3(history); + magfs = len3(fs); + if (magfs > Fscrit) { + shrmag = len3(history); if (shrmag != 0.0) { - temp_double = Fscrit / magfs; - MathExtra::scale3(temp_double, fs, history); - MathExtra::scale3(gamma, vtr, temp_array); - MathExtra::add3(history, temp_array, history); + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs, history); + scale3(gamma_tang, vtr, temp_array); + add3(history, temp_array, history); if (! mindlin_force) { - temp_double = -1.0 / k; - MathExtra::scale3(temp_double, history); + temp_dbl = -1.0 / k_tang; + scale3(temp_dbl, history); } - temp_double = Fscrit / magfs; - MathExtra::scale3(temp_double, fs); + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs); } else { - MathExtra::zero3(fs); + zero3(fs); } } } /* ---------------------------------------------------------------------- */ -double ContactModel::rolling(double *history) +void ContactModel::rolling(double *history) { int rhist0, rhist1, rhist2, frameupdate; - double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_array[3]; + double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; rhist0 = roll_history_index; rhist1 = rhist0 + 1; @@ -524,46 +534,47 @@ double ContactModel::rolling(double *history) hist_temp[0] = history[rhist0]; hist_temp[1] = history[rhist1]; hist_temp[2] = history[rhist2]; - rolldotn = MathExtra::dot3(hist_temp, nx); + rolldotn = dot3(hist_temp, nx); frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; if (frameupdate) { // rotate into tangential plane - rollmag = MathExtra::len3(temp); + rollmag = len3(hist_temp); // projection - temp_double = -rolldotn; - MathExtra::scale3(temp_double, nx, temp); + temp_dbl = -rolldotn; + scale3(temp_dbl, nx, temp_array); + sub3(hist_temp, temp_array, hist_temp); // also rescale to preserve magnitude - prjmag = MathExtra::len3(hist_temp); - if (prjmag > 0) temp_double = rollmag / prjmag; - else temp_double = 0; - MathExtra::scale3(temp_double, hist_temp); + prjmag = len3(hist_temp); + if (prjmag > 0) temp_dbl = rollmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, hist_temp); } - MathExtra::scale3(dt, vrl, temp_array); - MathExtra::add3(hist_temp, temp_array, hist_temp) + scale3(dt, vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); } - MathExtra::scaleadd3(k_roll, hist_tepm, gamma_roll, vrl, fr); - MathExtra::negate3(fr); + scaleadd3(k_roll, hist_temp, gamma_roll, vrl, fr); + negate3(fr); // rescale frictional displacements and forces if needed - magfr = MathExtra::len3(fr); + magfr = len3(fr); if (magfr > Frcrit) { - rollmag = MathExtra::len3(temp); + rollmag = len3(hist_temp); if (rollmag != 0.0) { - temp_double = -Frcrit / (magfr * k_roll); - MathExtra::scale3(temp_double, fr, temp_array); - MathExtra::add3(hist_temp, temp_array, hist_temp); + temp_dbl = -Frcrit / (magfr * k_roll); + scale3(temp_dbl, fr, temp_array); + add3(hist_temp, temp_array, hist_temp); - temp_double = -gamma_roll/k_roll; - MathExtra::scale3(temp_double, vrl, temp_array); - MathExtra::add3(hist_temp, temp_array, hist_temp) + temp_dbl = -gamma_roll/k_roll; + scale3(temp_dbl, vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); - temp_double = Frcrit / magfr; - MathExtra::scale3(temp_double, fr); + temp_dbl = Frcrit / magfr; + scale3(temp_dbl, fr); } else { - MathExtra::zero3(fr); + zero3(fr); } } @@ -574,27 +585,27 @@ double ContactModel::rolling(double *history) /* ---------------------------------------------------------------------- */ -double ContactModel::twisting_marshall(double *history) +void ContactModel::twisting_marshall(double *history) { // Overwrite twist coefficients with derived values - k_twist = 0.5 * k_tangential * a * a; // eq 32 of Marshall paper - gamma_twist = 0.5 * gamma_tangential * a * a; - mu_twist = TWOTHIRDS * a * mu_tangential; + k_twist = 0.5 * k_tang * a * a; // eq 32 of Marshall paper + gamma_twist = 0.5 * gamma_tang * a * a; + mu_twist = TWOTHIRDS * a * mu_tang; twisting_SDS(history); } /* ---------------------------------------------------------------------- */ -double ContactModel::twisting_SDS(double *history) +void ContactModel::twisting_SDS(double *history) { double signtwist, Mtcrit; - if (historyupdate) { + if (history_update) { history[twist_history_index] += magtwist * dt; } - magtortwist = -k_twist * history[twist_history_index] - damp_twist*magtwist; // M_t torque (eq 30) + magtortwist = -k_twist * history[twist_history_index] - gamma_twist*magtwist; // M_t torque (eq 30) signtwist = (magtwist > 0) - (magtwist < 0); Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) if (fabs(magtortwist) > Mtcrit) { @@ -616,9 +627,9 @@ double ContactModel::pulloff_distance(double radi, double radj) Reff_tmp = radi * radj / (radi + radj); if (Reff_tmp <= 0) return 0; - Ecaled = E * THREEQUARTERS; + Ecaled = k_norm * THREEQUARTERS; a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); } -}} +} diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index a5b5d23463..167f88e9de 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -11,14 +11,29 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef LMP_CONTACT -_H -#define LMP_CONTACT -_H +#ifndef LMP_CONTACT_H +#define LMP_CONTACT_H -namespace LAMMPS_NS { namespace Contact { + enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; + enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; + enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; + enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; + enum {ROLL_NONE, ROLL_SDS}; + + #define PI27SQ 266.47931882941264802866 // 27*PI**2 + #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) + #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) + #define INVROOT6 0.40824829046386307274 // 1/sqrt(6) + #define FOURTHIRDS (4.0/3.0) // 4/3 + #define ONETHIRD (1.0/3.0) // 1/3 + #define THREEQUARTERS 0.75 // 3/4 + + #define EPSILON 1e-10 + class ContactModel { public: ContactModel(); @@ -26,6 +41,7 @@ namespace Contact { bool check_contact(); void prep_contact(); void calculate_forces(double *, double *, double *, double *); + double calculate_heat(); double pulloff_distance(double, double); int normal_model, damping_model, tangential_model; @@ -37,23 +53,25 @@ namespace Contact { double k_tang, gamma_tang, mu_tang; // tangential_coeffs - wutang? double k_roll, gamma_roll, mu_roll; // roll_coeffs double k_twist, gamma_twist, mu_twist; // twist_coeffs + double conductivity; - double radi, radj, meff, dt; - double xi[3], xj[3], vi[3], vj[3], omegai[3], omegaj[3]; + double radi, radj, meff, dt, Ti, Tj; + double *xi, *xj, *vi, *vj, *omegai, *omegaj; int history_update, roll_history_index, twist_history_index; + double fs[3], fr[3], ft[3], magtortwist; + private: - double a, knfac, Fncrit, Fscrit, Frcrit, damp_normal_prefactor; - double fs[3], fr[3], ft[3]; - double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta; - double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrel; - double magtwist, magtortwist; + double a, knfac, Fntot, Fncrit, Fscrit, Frcrit, damp_normal_prefactor; + double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; + double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; + double magtwist; bool touch; int prep_flag, check_flag; int mindlin_rescale, mindlin_force; - void touch_JKR(int); + bool touch_JKR(int); double normal_JKR(); double normal_DMT(); double normal_Hertz(); @@ -69,5 +87,5 @@ namespace Contact { }; } // namespace Contact -} // namespace LAMMPS_NS + #endif diff --git a/src/GRANULAR/fix_temp_integrate.cpp b/src/GRANULAR/fix_temp_integrate.cpp index bb351d7db4..f81442766b 100644 --- a/src/GRANULAR/fix_temp_integrate.cpp +++ b/src/GRANULAR/fix_temp_integrate.cpp @@ -36,27 +36,21 @@ FixTempIntegrate::FixTempIntegrate(LAMMPS *lmp, int narg, char **arg) : cp_style = NONE; int ntypes = atom->ntypes; - int iarg = 3; - while (iarg < narg) { - if (strcmp(arg[iarg+1],"constant") == 0) { - if (iarg+2 >= narg) error->all(FLERR,"Illegal fix command"); - cp_style = CONSTANT; - cp = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (cp < 0.0) error->all(FLERR,"Illegal fix command"); - iarg += 2; - } else if (strcmp(arg[iarg+1],"type") == 0) { - if (iarg+1+ntypes >= narg) error->all(FLERR,"Illegal fix command"); - cp_style = TYPE; - memory->create(cp_type,ntypes+1,"fix/temp/integrate:cp_type"); - for (int i = 1; i <= ntypes; i++) { - cp_type[i] = utils::numeric(FLERR,arg[iarg+1+i],false,lmp); - if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); - } - iarg += 1+ntypes; - } else { - error->all(FLERR,"Illegal fix command"); + if (strcmp(arg[3],"constant") == 0) { + if (narg != 5) error->all(FLERR,"Illegal fix command"); + cp_style = CONSTANT; + cp = utils::numeric(FLERR,arg[4],false,lmp); + if (cp < 0.0) error->all(FLERR,"Illegal fix command"); + } else if (strcmp(arg[3],"type") == 0) { + if (narg != 4 + ntypes) error->all(FLERR,"Illegal fix command"); + cp_style = TYPE; + memory->create(cp_type,ntypes+1,"fix/temp/integrate:cp_type"); + for (int i = 1; i <= ntypes; i++) { + cp_type[i] = utils::numeric(FLERR,arg[3+i],false,lmp); + if (cp_type[i] < 0.0) error->all(FLERR,"Illegal fix command"); } - iarg += 1; + } else { + error->all(FLERR,"Illegal fix command"); } if (cp_style == NONE) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 61644df9c2..0047e24359 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -40,14 +40,13 @@ #include #include +#include using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; using namespace Contact; - - /* ---------------------------------------------------------------------- */ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) @@ -70,10 +69,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) maxrad_dynamic = nullptr; maxrad_frozen = nullptr; - models = nullptr; - - limit_damping = nullptr; - history_transfer_factors = nullptr; dt = update->dt; @@ -87,6 +82,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) nondefault_history_transfer = 0; tangential_history_index = 0; roll_history_index = twist_history_index = 0; + heat_flag = 0; // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script @@ -108,24 +104,6 @@ PairGranular::~PairGranular() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - memory->destroy(cutoff_type); - - memory->destroy(models); - - memory->destroy(normal_coeffs); - memory->destroy(tangential_coeffs); - memory->destroy(roll_coeffs); - memory->destroy(twist_coeffs); - - memory->destroy(Emod); - memory->destroy(poiss); - - memory->destroy(normal_model); - memory->destroy(damping_model); - memory->destroy(tangential_model); - memory->destroy(roll_model); - memory->destroy(twist_model); - memory->destroy(limit_damping); delete [] onerad_dynamic; delete [] onerad_frozen; @@ -141,7 +119,7 @@ PairGranular::~PairGranular() void PairGranular::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; - double factor_lj,mi,mj,meff; + double factor_lj,mi,mj,meff,delx,dely,delz; double forces[3], torquesi[3], torquesj[3]; int *ilist,*jlist,*numneigh,**firstneigh; @@ -184,6 +162,11 @@ void PairGranular::compute(int eflag, int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; double *special_lj = force->special_lj; + double *heatflux, *temperature, dq; + if (heat_flag) { + heatflux = atom->heatflux; + temperature = atom->temperature; + } inum = list->inum; ilist = list->ilist; @@ -214,14 +197,13 @@ void PairGranular::compute(int eflag, int vflag) jtype = type[j]; // Reset model and copy initial geometric data - models[itype][jtype]->reset_contact(); + models[itype][jtype].reset_contact(); models[itype][jtype].xi = x[i]; models[itype][jtype].xj = x[j]; models[itype][jtype].radi = radius[i]; models[itype][jtype].radj = radius[j]; - - touchflag = models[itype][jtype]->check_contact(); + touchflag = models[itype][jtype].check_contact(); if (!touchflag) { // unset non-touching neighbors @@ -247,18 +229,21 @@ void PairGranular::compute(int eflag, int vflag) // Copy additional information and prepare force calculations models[itype][jtype].meff = meff; - models[itype][jtype].dt = dt; - models[itype][jtype].history_update = historyupdate; - models[itype][jtype].roll_history_index = roll_history_index; - models[itype][jtype].twist_history_index = twist_history_index; models[itype][jtype].vi = v[i]; models[itype][jtype].vj = v[j]; models[itype][jtype].omegai = omega[i]; models[itype][jtype].omegaj = omega[j]; - models[itype][jtype] -> prep_contact(); + models[itype][jtype].history_update = historyupdate; + models[itype][jtype].prep_contact(); + + if (heat_flag) { + models[itype][jtype].Ti = temperature[i]; + models[itype][jtype].Tj = temperature[j]; + } if (models[itype][jtype].normal_model == JKR) touch[jj] = 1; + // if any history is needed if (use_history) { touch[jj] = 1; @@ -266,22 +251,30 @@ void PairGranular::compute(int eflag, int vflag) } models[itype][jtype].calculate_forces(forces, torquesi, torquesj, history); + if (heat_flag) dq = models[itype][jtype].calculate_heat(); // apply forces & torques MathExtra::scale3(factor_lj, forces); MathExtra::add3(f[i], forces, f[i]); MathExtra::scale3(factor_lj, torquesi); - MathExtra::add3(torques[i], torquesi, torques[i]); + MathExtra::add3(torque[i], torquesi, torque[i]); + if (heat_flag) heatflux[i] += dq; if (force->newton_pair || j < nlocal) { MathExtra::sub3(f[j], forces, f[j]); MathExtra::scale3(factor_lj, torquesj); - MathExtra::add3(torques[j], torquesj, torques[j]); + MathExtra::add3(torque[j], torquesj, torque[j]); + if (heat_flag) heatflux[j] -= dq; } - if (evflag) ev_tally_xyz(i,j,nlocal,force->newton_pair, - 0.0,0.0,forces[0],forces[1],forces[2],dx[0],dy[1],dx[2]); + if (evflag) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + ev_tally_xyz(i,j,nlocal,force->newton_pair, + 0.0,0.0,forces[0],forces[1],forces[2],delx,dely,delz); + } } } } @@ -303,7 +296,9 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - memory->create(models,n+1,n+1,"pair:models"); + for (int i = 0; i < n+1; i++) { + models.push_back(std::vector (n+1)); + } onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -341,6 +336,7 @@ void PairGranular::coeff(int narg, char **arg) double roll_coeffs_one[4]; double twist_coeffs_one[4]; + double conductivity_one; double cutoff_one = -1; if (narg < 2) @@ -535,6 +531,14 @@ void PairGranular::coeff(int narg, char **arg) } else if (strcmp(arg[iarg], "limit_damping") == 0) { ld_flag = 1; iarg += 1; + } else if (strcmp(arg[iarg], "heat") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + conductivity_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (conductivity_one < 0.0) + error->all(FLERR, "Illegal pair_coeff command, conductivity must be positive"); + heat_flag = 1; + iarg += 2; } else error->all(FLERR, "Illegal pair_coeff command"); } @@ -590,28 +594,29 @@ void PairGranular::coeff(int narg, char **arg) } else { models[i][j].k_tang = models[j][i].k_tang = tangential_coeffs_one[0]; } - models[i][j].gamma_tang = models[j][i]].gamma_tang = tangential_coeffs_one[1]; - models[i][j].mu_tang = models[j][i]].mu_tang = tangential_coeffs_one[2]; + models[i][j].gamma_tang = models[j][i].gamma_tang = tangential_coeffs_one[1]; + models[i][j].mu_tang = models[j][i].mu_tang = tangential_coeffs_one[2]; // Define rolling model - model[i][j].roll_model = model[j][i].roll_model = roll_model_one; + models[i][j].roll_model = models[j][i].roll_model = roll_model_one; if (roll_model_one != ROLL_NONE) { - model[i][j].k_roll = model[j][i].k_roll = roll_coeffs_one[0]; - model[i][j].gamma_roll = model[j][i].gamma_roll = roll_coeffs_one[1]; - model[i][j].mu_roll = model[j][i].mu_roll = roll_coeffs_one[2]; + models[i][j].k_roll = models[j][i].k_roll = roll_coeffs_one[0]; + models[i][j].gamma_roll = models[j][i].gamma_roll = roll_coeffs_one[1]; + models[i][j].mu_roll = models[j][i].mu_roll = roll_coeffs_one[2]; } // Define twisting model models[i][j].twist_model = models[j][i].twist_model = twist_model_one; if (twist_model_one != TWIST_NONE && twist_model_one != TWIST_MARSHALL) { - model[i][j].k_twist = model[j][i].k_twist = twist_coeffs_one[0]; - model[i][j].gamma_twist = model[j][i].gamma_twist = twist_coeffs_one[1]; - model[i][j].mu_twist = model[j][i].mu_twist = twist_coeffs_one[2]; + models[i][j].k_twist = models[j][i].k_twist = twist_coeffs_one[0]; + models[i][j].gamma_twist = models[j][i].gamma_twist = twist_coeffs_one[1]; + models[i][j].mu_twist = models[j][i].mu_twist = twist_coeffs_one[2]; } // Define extra options - model[i][j].cutoff_type = model[j][i].cutoff_type = cutoff_one; - model[i][j].limit_damping = model[j][i].limit_damping = ld_flag; + models[i][j].cutoff_type = models[j][i].cutoff_type = cutoff_one; + models[i][j].limit_damping = models[j][i].limit_damping = ld_flag; + models[i][j].conductivity = models[j][i].conductivity = conductivity_one; setflag[i][j] = 1; count++; @@ -666,8 +671,8 @@ void PairGranular::init_style() } for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) - if (model[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE || - model[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { + if (models[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE || + models[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { size_history += 1; roll_history_index += 1; twist_history_index += 1; @@ -785,7 +790,7 @@ double PairGranular::init_one(int i, int j) // Mix normal coefficients if (models[i][j].normal_model == HERTZ || models[i][j].normal_model == HOOKE) - models[i][j].k_norm = models[j][i][0].k_norm = + models[i][j].k_norm = models[j][i].k_norm = mix_geom(models[i][i].k_norm, models[j][j].k_norm); else models[i][j].k_norm = models[j][i].k_norm = @@ -794,7 +799,7 @@ double PairGranular::init_one(int i, int j) models[i][j].gamma_norm = models[j][i].gamma_norm = mix_geom(models[i][i].gamma_norm, models[j][j].gamma_norm); - if ((normal_model[i][j] == JKR) || (normal_model[i][j] == DMT)) + if ((models[i][j].normal_model == JKR) || (models[i][j].normal_model == DMT)) models[i][j].cohesion = models[j][i].cohesion = mix_geom(models[i][i].cohesion, models[j][j].cohesion); @@ -807,7 +812,7 @@ double PairGranular::init_one(int i, int j) mix_geom(models[i][i].mu_tang, models[j][j].mu_tang); // Mix rolling coefficients - if (models.roll_model[i][j] != ROLL_NONE) { + if (models[i][j].roll_model != ROLL_NONE) { models[i][j].k_roll = models[j][i].k_roll = mix_geom(models[i][i].k_roll, models[j][j].k_roll); models[i][j].gamma_roll = models[j][i].gamma_roll = @@ -825,8 +830,19 @@ double PairGranular::init_one(int i, int j) models[i][j].mu_twist = models[j][i].mu_twist = mix_geom(models[i][i].mu_twist, models[j][j].mu_twist); } + + models[i][j].limit_damping = models[j][i].limit_damping = + MAX(models[i][i].limit_damping, models[j][j].limit_damping); + if (heat_flag) { + models[i][j].conductivity = models[j][i].conductivity = + mix_geom(models[i][i].conductivity, models[j][j].conductivity); + } } + // Check if conductivity is undefined (negative) for any type combination + if (heat_flag && models[i][j].conductivity < 0.0) + error->all(FLERR, "To calculate heat, conductivity must be defined for all pair coeff"); + // It is possible that cut[i][j] at this point is still 0.0. // This can happen when // there is a future fix_pour after the current run. A cut[i][j] = 0.0 creates @@ -843,14 +859,14 @@ double PairGranular::init_one(int i, int j) ((maxrad_frozen[i] > 0.0) && (maxrad_dynamic[j] > 0.0))) { cutoff = maxrad_dynamic[i] + maxrad_dynamic[j]; pulloff = 0.0; - if (normal_model[i][j] == JKR) { - pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); + if (models[i][j].normal_model == JKR) { + pulloff = models[i][j].pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); cutoff += pulloff; - pulloff = models[i][j]->pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); + pulloff = models[i][j].pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); cutoff = MAX(cutoff, maxrad_frozen[i] + maxrad_dynamic[j] + pulloff); - pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); + pulloff = models[i][j].pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); cutoff = MAX(cutoff,maxrad_dynamic[i] + maxrad_frozen[j] + pulloff); } } else { @@ -872,6 +888,11 @@ double PairGranular::init_one(int i, int j) cutoff = cutoff_global; } + // Copy global options + models[i][j].dt = dt; + models[i][j].roll_history_index = roll_history_index; + models[i][j].twist_history_index = twist_history_index; + return cutoff; } @@ -982,26 +1003,114 @@ void PairGranular::reset_dt() double PairGranular::single(int i, int j, int itype, int jtype, double rsq, double /* factor_coul */, - double /* factor_lj */, double &fforce) + double factor_lj, double &fforce) { + if (factor_lj == 0) { + fforce = 0.0; + for (int m = 0; m < single_extra; m++) svector[m] = 0.0; + return 0.0; + } - fforce = Fntot*rinv; + int jnum; + int *jlist; + double *history,*allhistory; + + int nall = atom->nlocal + atom->nghost; + if ((i >= nall) || (j >= nall)) + error->all(FLERR,"Not enough atoms for pair granular single function"); + + + int touchflag; + double **x = atom->x; + double *radius = atom->radius; + + // Reset model and copy initial geometric data + models[itype][jtype].reset_contact(); + models[itype][jtype].xi = x[i]; + models[itype][jtype].xj = x[j]; + models[itype][jtype].radi = radius[i]; + models[itype][jtype].radj = radius[j]; + models[i][j].history_update = 0; // Don't update history + + touchflag = models[itype][jtype].check_contact(); + + if (!touchflag) { + fforce = 0.0; + for (int m = 0; m < single_extra; m++) svector[m] = 0.0; + return 0.0; + } + + // meff = effective mass of pair of particles + // if I or J part of rigid body, use body mass + // if I or J is frozen, meff is other particle + double mi, mj, meff; + double *rmass = atom->rmass; + int *mask = atom->mask; + + mi = rmass[i]; + mj = rmass[j]; + if (fix_rigid) { + if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; + if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; + } + meff = mi * mj / (mi + mj); + if (mask[i] & freeze_group_bit) meff = mj; + if (mask[j] & freeze_group_bit) meff = mi; + + // Copy additional information and prepare force calculations + double **v = atom->v; + double **omega = atom->omega; + + models[itype][jtype].meff = meff; + models[itype][jtype].vi = v[i]; + models[itype][jtype].vj = v[j]; + models[itype][jtype].omegai = omega[i]; + models[itype][jtype].omegaj = omega[j]; + models[itype][jtype].prep_contact(); + + // if any history is needed + + jnum = list->numneigh[i]; + jlist = list->firstneigh[i]; + + if (use_history) { + if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) + error->one(FLERR,"Pair granular single computation needs history"); + allhistory = fix_history->firstvalue[i]; + for (int jj = 0; jj < jnum; jj++) { + neighprev++; + if (neighprev >= jnum) neighprev = 0; + if (jlist[neighprev] == j) break; + } + history = &allhistory[size_history*neighprev]; + } + + double forces[3], torquesi[3], torquesj[3]; + models[itype][jtype].calculate_forces(forces, torquesi, torquesj, history); + + // apply forces & torques + fforce = MathExtra::len3(forces); // set single_extra quantities - svector[0] = fs1; - svector[1] = fs2; - svector[2] = fs3; - svector[3] = fs; - svector[4] = fr1; - svector[5] = fr2; - svector[6] = fr3; - svector[7] = fr; - svector[8] = magtortwist; + double delx = x[i][0] - x[j][0]; + double dely = x[i][1] - x[j][1]; + double delz = x[i][2] - x[j][2]; + + svector[0] = models[itype][jtype].fs[0]; + svector[1] = models[itype][jtype].fs[1]; + svector[2] = models[itype][jtype].fs[2]; + svector[3] = MathExtra::len3(models[itype][jtype].fs); + svector[4] = models[itype][jtype].fr[0]; + svector[5] = models[itype][jtype].fr[1]; + svector[6] = models[itype][jtype].fr[2]; + svector[7] = MathExtra::len3(models[itype][jtype].fr); + svector[8] = models[itype][jtype].magtortwist; svector[9] = delx; svector[10] = dely; svector[11] = delz; + return 0.0; } @@ -1117,7 +1226,7 @@ double PairGranular::radii2cut(double r1, double r2) for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ if (models[i][j].normal_model == JKR) { - temp = pulloff_distance(r1, r2); + temp = models[i][j].pulloff_distance(r1, r2); if (temp > cut) cut = temp; } } diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 509981d5f9..3440d60e29 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -20,7 +20,9 @@ PairStyle(granular,PairGranular); #ifndef LMP_PAIR_GRANULAR_H #define LMP_PAIR_GRANULAR_H +#include "contact.h" #include "pair.h" +#include namespace LAMMPS_NS { @@ -68,9 +70,10 @@ class PairGranular : public Pair { private: int size_history; int *history_transfer_factors; + int heat_flag; // contact models - ContactModel **models; + std::vector > models; // history flags int normal_history, tangential_history, roll_history, twist_history; diff --git a/src/contact.cpp b/src/contact.cpp index b7d5d4d85d..b4b335a1aa 100644 --- a/src/contact.cpp +++ b/src/contact.cpp @@ -12,47 +12,624 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- - This class contains a series of DEM contact models - that can be defined and used to calculate forces + This class contains a series of tools for DEM contacts + Multiple models can be defined and used to calculate forces and torques based on contact geometry */ -#include #include "contact.h" +#include "math_const.h" +#include "math_extra.h" +#include "pointers.h" -namespace LAMMPS_NS { - namespace Contact{ +#include -enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; -enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; +using namespace LAMMPS_NS; +using namespace MathExtra; +using namespace MathConst; -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define THREEQUARTERS 0.75 // 3/4 - -#define EPSILON 1e-10 +namespace Contact { ContactModel::ContactModel() { + k_norm = cohesion = gamma_norm = 0.0; + k_tang = gamma_tang = mu_tang = 0.0; + k_roll = gamma_roll = mu_roll = 0.0; + k_twist = gamma_twist = mu_twist = 0.0; + limit_damping = 0; + cutoff_type = 0.0; + reset_contact(); +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::reset_contact() +{ + radi = radj = 0.0; + xi = xj = vi = vj = omegai = omegaj = nullptr; + + prep_flag = check_flag = 0; + touch = false; +} + +/* ---------------------------------------------------------------------- */ + +bool ContactModel::check_contact() +{ + check_flag = 1; + + sub3(xi, xj, dx); + rsq = lensq3(dx); + radsum = radi + radj; + Reff = radi*radj/radsum; + + touch = false; + if (normal_model == JKR) touch = touch_JKR(touch); + else touch = (rsq < radsum*radsum); + + return touch; +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::prep_contact() +{ + prep_flag = 1; + + // If it hasn't already been done, test if the contact exists + if (check_flag != 1) touch = check_contact(); + if (!touch) return; + + double temp[3]; + + // Set flags + mindlin_rescale = mindlin_force = 0; + if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) + mindlin_rescale = 1; + if (tangential_model == TANGENTIAL_MINDLIN_FORCE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) + mindlin_force = 1; + + // Standard geometric quantities + r = sqrt(rsq); + rinv = 1.0/r; + delta = radsum - r; + dR = delta*Reff; + scale3(rinv, dx, nx); + + // relative translational velocity + sub3(vi, vj, vr); + + // normal component + vnnr = dot3(vr, nx); //v_R . n + scale3(vnnr, nx, vn); + + // tangential component + sub3(vr, vn, vt); + + // relative rotational velocity + scaleadd3(radi, omegai, radj, omegaj, wr); + + // relative tangential velocities + cross3(wr, nx, temp); + sub3(vt, temp, vtr); + vrel = len3(vtr); + + if (roll_model != ROLL_NONE || twist_model != TWIST_NONE) + sub3(omegai, omegaj, relrot); + + if (roll_model != ROLL_NONE) { + // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) + vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); + vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); + vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); + } + + if (twist_model != TWIST_NONE) { + // omega_T (eq 29 of Marshall) + magtwist = dot3(relrot, nx); + } +} + + +/* ---------------------------------------------------------------------- */ + +void ContactModel::calculate_forces(double *forces, double *torquesi, double *torquesj, double *history) +{ + // If it hasn't already been done, run prep calculations + if (prep_flag != 1) prep_contact(); + if (!touch) { + forces[0] = forces[1] = forces[2] = 0.0; + return; + } + + //********************************************** + // normal forces + //********************************************** + + // Also calculates: a, knfac, Fncrit (for JKR or DMT) + double Fne; + if (normal_model == JKR) { + Fne = normal_JKR(); + } else if (normal_model == DMT) { + Fne = normal_DMT(); + } else if (normal_model == HERTZ || normal_model == HERTZ_MATERIAL) { + Fne = normal_Hertz(); + } else { + Fne = normal_Hooke(); + } + + // NOTE: consider restricting Hooke to only have + // 'velocity' as an option for damping? + // Also calculates: damp_normal_prefactor + double Fdamp = normal_damping(); + + Fntot = Fne + Fdamp; + if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; + + if (normal_model != JKR && normal_model != DMT) Fncrit = fabs(Fntot); + + //********************************************** + // tangential force, including history effects + //********************************************** + // For linear, mindlin, mindlin_rescale: + // history = cumulative tangential displacement + // + // For mindlin/force, mindlin_rescale/force: + // history = cumulative tangential elastic force + + Fscrit = mu_tang * Fncrit; + + if (tangential_model == TANGENTIAL_MINDLIN || + tangential_model == TANGENTIAL_MINDLIN_FORCE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { + tangential_mindlin(history); + } else if (tangential_model == TANGENTIAL_HISTORY) { + tangential_history(history); + } else { + tangential_no_history(); + } + + //********************************************** + // rolling force + //********************************************** + + if (roll_model != ROLL_NONE) + rolling(history); + + //**************************************** + // twisting torque, including history effects + //**************************************** + + if (twist_model == TWIST_MARSHALL) { + twisting_marshall(history); + } else if (twist_model == TWIST_SDS) { + twisting_SDS(history); + } + + //********************************************** + // sum contributions + //********************************************** + + scale3(Fntot, nx, forces); + add3(forces, fs, forces); + + cross3(nx, fs, torquesi); + copy3(torquesi, torquesj); + + double dist_to_contact = radi-0.5*delta; + scale3(dist_to_contact, torquesi); + dist_to_contact = radj-0.5*delta; + scale3(dist_to_contact, torquesj); + + double torroll[3]; + if (roll_model != ROLL_NONE) { + cross3(nx, fr, torroll); + scale3(Reff, torroll); + add3(torquesi, torroll, torquesi); + sub3(torquesj, torroll, torquesj); + } + + double tortwist[3]; + if (twist_model != TWIST_NONE) { + scale3(magtortwist, nx, tortwist); + add3(torquesi, tortwist, torquesi); + sub3(torquesj, tortwist, torquesj); + } +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::calculate_heat() +{ + double dT = Ti - Tj; + double Hc; + + //Dan is Emod the youngs modulus for all models? or do I need to scale? + Hc = 2 * conductivity * pow(FOURTHIRDS * Fntot * Reff / Emod, ONETHIRD); + + return Hc * dT; +} + +/* ---------------------------------------------------------------------- */ + +bool ContactModel::touch_JKR(int touch) +{ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = Reff * Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = radsum - delta_pulloff; + touchflag = (rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rsq < radsum * radsum); + } + return touchflag; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_JKR() +{ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + Fncrit = fabs(Fne + 2 * F_pulloff); + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_DMT() +{ + a = sqrt(dR); + double Fne = a * k_norm * delta; + Fne -= 4 * MY_PI * cohesion * Reff; + double F_pulloff = 4 * MY_PI * cohesion * Reff; + + knfac = k_norm * a; + Fncrit = fabs(Fne + 2 * F_pulloff); + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_Hertz() +{ + a = sqrt(dR); + double Fne = k_norm * delta * a; + + knfac = k_norm * a; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_Hooke() +{ + a = sqrt(dR); + double Fne = k_norm * delta; + + knfac = k_norm; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +double ContactModel::normal_damping() +{ + double damp_normal; + if (damping_model == VELOCITY) { + damp_normal = 1; + } else if (damping_model == MASS_VELOCITY) { + damp_normal = meff; + } else if (damping_model == VISCOELASTIC) { + damp_normal = a * meff; + } else if (damping_model == TSUJI) { + damp_normal = sqrt(meff * knfac); + } else damp_normal = 0.0; + + damp_normal_prefactor = gamma_norm * damp_normal; + return -damp_normal_prefactor * vnnr; +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::tangential_no_history() +{ + double gamma_scaled = gamma_tang * damp_normal_prefactor; + double fsmag, Ft; + + // classic pair gran/hooke (no history) + fsmag = gamma_scaled * vrel; + if (vrel != 0.0) Ft = MIN(Fscrit,fsmag) / vrel; + else Ft = 0.0; + + Ft = -Ft; + scale3(Ft, vtr, fs); +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::tangential_history(double *history) +{ + double gamma_scaled = gamma_tang * damp_normal_prefactor; + double k = k_tang; + int frame_update = 0; + double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (history_update) { + rsht = dot3(history, nx); + frame_update = fabs(rsht) * k > EPSILON * Fscrit; + + if (frame_update) { + shrmag = len3(history); + // projection + scale3(rsht, nx, history); + // also rescale to preserve magnitude + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); + } + + // update history + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + temp_dbl = k * dt; + scale3(temp_dbl, vtr, temp_array); + sub3(history, temp_array, history); + } + + // tangential forces = history + tangential velocity damping + temp_dbl = -gamma_norm; + scale3(temp_dbl, vtr, fs); + + // rescale frictional displacements and forces if needed + magfs = len3(fs); + if (magfs > Fscrit) { + shrmag = len3(history); + if (shrmag != 0.0) { + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs, history); + scale3(gamma_norm, vtr, temp_array); + add3(history, temp_array, history); + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs); + } else { + zero3(fs); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::tangential_mindlin(double *history) +{ + double k_scaled, gamma_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; + double temp_array[3]; + int frame_update = 0; + + gamma_scaled = gamma_tang * damp_normal_prefactor; + k_scaled = k_tang * a; + if (mindlin_rescale) { + // on unloading, rescale the shear displacements/force + if (a < history[3]) { + temp_dbl = a / history[3]; + scale3(temp_dbl, history); + } + } + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (history_update) { + rsht = dot3(history, nx); + if (mindlin_force) + frame_update = fabs(rsht) > EPSILON * Fscrit; + else + frame_update = fabs(rsht) * k_scaled > EPSILON * Fscrit; + + if (frame_update) { + shrmag = len3(history); + // projection + scale3(rsht, nx, history); + // also rescale to preserve magnitude + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); + } + + // update history + if (mindlin_force) { + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + temp_dbl = -k_scaled * dt; + scale3(temp_dbl, vtr, temp_array); + } else { + scale3(dt, vtr, temp_array); + } + add3(history, temp_array, history); + + if (mindlin_rescale) history[3] = a; + } + + // tangential forces = history + tangential velocity damping + temp_dbl = -gamma_scaled; + scale3(temp_dbl, vtr, fs); + + if (! mindlin_force) { + scale3(k_scaled, history, temp_array); + add3(fs, temp_array, fs); + } + + // rescale frictional displacements and forces if needed + magfs = len3(fs); + if (magfs > Fscrit) { + shrmag = len3(history); + if (shrmag != 0.0) { + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs, history); + scale3(gamma_tang, vtr, temp_array); + add3(history, temp_array, history); + if (! mindlin_force) { + temp_dbl = -1.0 / k_tang; + scale3(temp_dbl, history); + } + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs); + } else { + zero3(fs); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::rolling(double *history) +{ + int rhist0, rhist1, rhist2, frameupdate; + double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; + + rhist0 = roll_history_index; + rhist1 = rhist0 + 1; + rhist2 = rhist1 + 1; + + Frcrit = mu_roll * Fncrit; + + if (history_update) { + hist_temp[0] = history[rhist0]; + hist_temp[1] = history[rhist1]; + hist_temp[2] = history[rhist2]; + rolldotn = dot3(hist_temp, nx); + + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; + if (frameupdate) { // rotate into tangential plane + rollmag = len3(hist_temp); + // projection + temp_dbl = -rolldotn; + scale3(temp_dbl, nx, temp_array); + sub3(hist_temp, temp_array, hist_temp); + + // also rescale to preserve magnitude + prjmag = len3(hist_temp); + if (prjmag > 0) temp_dbl = rollmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, hist_temp); + } + scale3(dt, vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); + } + + scaleadd3(k_roll, hist_temp, gamma_roll, vrl, fr); + negate3(fr); + + // rescale frictional displacements and forces if needed + + magfr = len3(fr); + if (magfr > Frcrit) { + rollmag = len3(hist_temp); + if (rollmag != 0.0) { + temp_dbl = -Frcrit / (magfr * k_roll); + scale3(temp_dbl, fr, temp_array); + add3(hist_temp, temp_array, hist_temp); + + temp_dbl = -gamma_roll/k_roll; + scale3(temp_dbl, vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); + + temp_dbl = Frcrit / magfr; + scale3(temp_dbl, fr); + } else { + zero3(fr); + } + } + + history[rhist0] = hist_temp[0]; + history[rhist1] = hist_temp[1]; + history[rhist2] = hist_temp[2]; +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::twisting_marshall(double *history) +{ + // Overwrite twist coefficients with derived values + k_twist = 0.5 * k_tang * a * a; // eq 32 of Marshall paper + gamma_twist = 0.5 * gamma_tang * a * a; + mu_twist = TWOTHIRDS * a * mu_tang; + + twisting_SDS(history); +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::twisting_SDS(double *history) +{ + double signtwist, Mtcrit; + + if (history_update) { + history[twist_history_index] += magtwist * dt; + } + + magtortwist = -k_twist * history[twist_history_index] - gamma_twist*magtwist; // M_t torque (eq 30) + signtwist = (magtwist > 0) - (magtwist < 0); + Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) + if (fabs(magtortwist) > Mtcrit) { + history[twist_history_index] = (Mtcrit * signtwist - gamma_twist * magtwist) / k_twist; + magtortwist = -Mtcrit * signtwist; // eq 34 + } } /* ---------------------------------------------------------------------- - get volume-correct r basis in: basis*cbrt(vol) = q*r + compute pull-off distance (beyond contact) for a given radius and atom type + use temporary variables since this does not use a specific contact geometry ------------------------------------------------------------------------- */ -void ContactModel::() +double ContactModel::pulloff_distance(double radi, double radj) { + double Ecaled, a_tmp, Reff_tmp; + if (normal_model != JKR) return radi+radj; + + Reff_tmp = radi * radj / (radi + radj); + if (Reff_tmp <= 0) return 0; + Ecaled = k_norm * THREEQUARTERS; + a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); + return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); } - -}} +} diff --git a/src/contact.h b/src/contact.h index 38cb6f0be6..167f88e9de 100644 --- a/src/contact.h +++ b/src/contact.h @@ -11,40 +11,81 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef LMP_CONTACT -_H -#define LMP_CONTACT -_H +#ifndef LMP_CONTACT_H +#define LMP_CONTACT_H -namespace LAMMPS_NS { namespace Contact { + enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; + enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; + enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; + enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; + enum {ROLL_NONE, ROLL_SDS}; + + #define PI27SQ 266.47931882941264802866 // 27*PI**2 + #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) + #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) + #define INVROOT6 0.40824829046386307274 // 1/sqrt(6) + #define FOURTHIRDS (4.0/3.0) // 4/3 + #define ONETHIRD (1.0/3.0) // 1/3 + #define THREEQUARTERS 0.75 // 3/4 + + #define EPSILON 1e-10 + class ContactModel { public: ContactModel(); - void touch_JKR(int); - void normal_JKR(double&); - void normal_DMT(double&); - void normal_Hooke(double&); - double normal_damping(double, double); - double critical_normal(double, double); + void reset_contact(); + bool check_contact(); + void prep_contact(); + void calculate_forces(double *, double *, double *, double *); + double calculate_heat(); + double pulloff_distance(double, double); int normal_model, damping_model, tangential_model; int roll_model, twist_model; - double E, G, poisson, damp, coh; + int limit_damping; + double cutoff_type; + double Emod, poisson; // variables used in defining mixed interactions + double k_norm, gamma_norm, cohesion; // normal_coeffs + double k_tang, gamma_tang, mu_tang; // tangential_coeffs - wutang? + double k_roll, gamma_roll, mu_roll; // roll_coeffs + double k_twist, gamma_twist, mu_twist; // twist_coeffs + double conductivity; + + double radi, radj, meff, dt, Ti, Tj; + double *xi, *xj, *vi, *vj, *omegai, *omegaj; + int history_update, roll_history_index, twist_history_index; + + double fs[3], fr[3], ft[3], magtortwist; private: - double a, knfac; - ContactGeometry geom; + double a, knfac, Fntot, Fncrit, Fscrit, Frcrit, damp_normal_prefactor; + double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; + double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; + double magtwist; + bool touch; + + int prep_flag, check_flag; + int mindlin_rescale, mindlin_force; + + bool touch_JKR(int); + double normal_JKR(); + double normal_DMT(); + double normal_Hertz(); + double normal_Hooke(); + double normal_damping(); + void tangential_no_history(); + void tangential_history(double *); + void tangential_mindlin(double *); + void rolling(double *); + void twisting_marshall(double *); + void twisting_SDS(double *); + }; - - class ContactGeometry { - public: - ContactGeometry(); - void add_data(); - double r, rinv, rsq, Reff, radsum, delta, dR; - }; } // namespace Contact -} // namespace LAMMPS_NS + #endif diff --git a/src/contact_model.cpp b/src/contact_model.cpp deleted file mode 100644 index 779631836b..0000000000 --- a/src/contact_model.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// clang-format off -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- - - This class contains a series of DEM contact models - that can be defined and used to calculate forces - and torques based on contact geometry -*/ - -#include -#include "contact_model.h" - -namespace LAMMPS_NS { - namespace Contact_Model{ - -enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; -enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; - -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define THREEQUARTERS 0.75 // 3/4 - -#define EPSILON 1e-10 - -ContactModel::ContactModel() -{ - -} - -/* ---------------------------------------------------------------------- - get volume-correct r basis in: basis*cbrt(vol) = q*r -------------------------------------------------------------------------- */ - -void ContactModel::() -{ - -} - - -}} diff --git a/src/contact_model.h b/src/contact_model.h deleted file mode 100644 index 678a7111a8..0000000000 --- a/src/contact_model.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef LMP_CONTACT_MODEL_H -#define LMP_CONTACT_MODEL_H - -namespace LAMMPS_NS { -namespace Contact_Model { - - class ContactModel { - public: - ContactModel(); - void set_strain(const double, const double); - void step_deform(const double, const double); - bool reduce(); - void get_box(double[3][3], double); - void get_rot(double[3][3]); - void get_inverse_cob(int[3][3]); - - private: - double a, knfac; - }; -} // namespace Contact_Model -} // namespace LAMMPS_NS -#endif diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 87bd04b2a9..a74e91c889 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -41,7 +41,7 @@ enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS, XSU,YSU,ZSU,XSUTRI,YSUTRI,ZSUTRI, IX,IY,IZ, VX,VY,VZ,FX,FY,FZ, - Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER, + Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,HEATFLUX,TEMPERATURE, OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ, TQX,TQY,TQZ, COMPUTE,FIX,VARIABLE,IVEC,DVEC,IARRAY,DARRAY}; @@ -930,6 +930,18 @@ int DumpCustom::count() for (i = 0; i < nlocal; i++) dchoose[i] = 2.0*radius[i]; ptr = dchoose; nstride = 1; + } else if (thresh_array[ithresh] == HEATFLUX) { + if (!atom->heatflux_flag) + error->all(FLERR, + "Threshold for an atom property that isn't allocated"); + ptr = atom->heatflux; + nstride = 1; + } else if (thresh_array[ithresh] == TEMPERATURE) { + if (!atom->temperature_flag) + error->all(FLERR, + "Threshold for an atom property that isn't allocated"); + ptr = atom->temperature; + nstride = 1; } else if (thresh_array[ithresh] == OMEGAX) { if (!atom->omega_flag) error->all(FLERR, @@ -1380,6 +1392,16 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Dumping an atom property that isn't allocated"); pack_choice[iarg] = &DumpCustom::pack_diameter; vtype[iarg] = Dump::DOUBLE; + } else if (strcmp(arg[iarg],"heatflux") == 0) { + if (!atom->heatflux_flag) + error->all(FLERR,"Dumping an atom property that isn't allocated"); + pack_choice[iarg] = &DumpCustom::pack_heatflux; + vtype[iarg] = Dump::DOUBLE; + } else if (strcmp(arg[iarg],"temperature") == 0) { + if (!atom->temperature_flag) + error->all(FLERR,"Dumping an atom property that isn't allocated"); + pack_choice[iarg] = &DumpCustom::pack_temperature; + vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"omegax") == 0) { if (!atom->omega_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); @@ -1845,6 +1867,8 @@ int DumpCustom::modify_param(int narg, char **arg) else if (strcmp(arg[1],"radius") == 0) thresh_array[nthresh] = RADIUS; else if (strcmp(arg[1],"diameter") == 0) thresh_array[nthresh] = DIAMETER; + else if (strcmp(arg[1],"heatflux") == 0) thresh_array[nthresh] = HEATFLUX; + else if (strcmp(arg[1],"temperature") == 0) thresh_array[nthresh] = TEMPERATURE; else if (strcmp(arg[1],"omegax") == 0) thresh_array[nthresh] = OMEGAX; else if (strcmp(arg[1],"omegay") == 0) thresh_array[nthresh] = OMEGAY; else if (strcmp(arg[1],"omegaz") == 0) thresh_array[nthresh] = OMEGAZ; @@ -2759,6 +2783,30 @@ void DumpCustom::pack_diameter(int n) /* ---------------------------------------------------------------------- */ +void DumpCustom::pack_heatflux(int n) +{ + double *heatflux = atom->heatflux; + + for (int i = 0; i < nchoose; i++) { + buf[n] = heatflux[clist[i]]; + n += size_one; + } +} + +/* ---------------------------------------------------------------------- */ + +void DumpCustom::pack_temperature(int n) +{ + double *temperature = atom->temperature; + + for (int i = 0; i < nchoose; i++) { + buf[n] = temperature[clist[i]]; + n += size_one; + } +} + +/* ---------------------------------------------------------------------- */ + void DumpCustom::pack_omegax(int n) { double **omega = atom->omega; diff --git a/src/dump_custom.h b/src/dump_custom.h index b27a9950cd..fd4fd413c3 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -193,6 +193,8 @@ class DumpCustom : public Dump { void pack_mu(int); void pack_radius(int); void pack_diameter(int); + void pack_heatflux(int); + void pack_temperature(int); void pack_omegax(int); void pack_omegay(int); diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 613716c9a4..37d1b37946 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -353,7 +353,8 @@ void FixNeighHistory::pre_exchange_newton() // Ensure npartner is zeroed across all atoms, nall_neigh can be less than nall // when writing restarts when comm calls are made but modify->post_neighbor() isn't - for (i = 0; i < MAX(nall_neigh, atom->nall); i++) npartner[i] = 0; + int nall = atom->nlocal + atom->nghost; + for (i = 0; i < MAX(nall_neigh, nall); i++) npartner[i] = 0; tagint *tag = atom->tag; NeighList *list = pair->list; @@ -408,7 +409,7 @@ void FixNeighHistory::pre_exchange_newton() // store partner IDs and values for owned+ghost atoms // re-zero npartner to use as counter - for (i = 0; i < MAX(nall_neigh, atom->nall); i++) npartner[i] = 0; + for (i = 0; i < MAX(nall_neigh, nall); i++) npartner[i] = 0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; From 222c40ebcf29bae96e76bf8f078beb6e375fadab Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 29 Jun 2022 15:02:05 -0600 Subject: [PATCH 08/57] Fixing memory errors --- src/.gitignore | 2 ++ src/GRANULAR/atom_vec_sphere_temp.cpp | 2 ++ src/GRANULAR/contact.cpp | 6 +++--- src/GRANULAR/pair_granular.cpp | 6 +++--- src/contact.cpp | 6 +++--- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index acb509551c..a1aee630b5 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1472,6 +1472,8 @@ /compute_xrd.cpp /compute_xrd.h /compute_xrd_consts.h +/contact.cpp +/contact.h /fix_atom_swap.cpp /fix_atom_swap.h /fix_ave_spatial_sphere.cpp diff --git a/src/GRANULAR/atom_vec_sphere_temp.cpp b/src/GRANULAR/atom_vec_sphere_temp.cpp index a455a9ddc8..a92486a1b5 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.cpp +++ b/src/GRANULAR/atom_vec_sphere_temp.cpp @@ -106,6 +106,8 @@ void AtomVecSphereTemp::grow_pointers() radius = atom->radius; rmass = atom->rmass; omega = atom->omega; + temperature = atom->temperature; + heatflux = atom->heatflux; } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index b4b335a1aa..a8405d095b 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -94,9 +94,9 @@ void ContactModel::prep_contact() // Standard geometric quantities r = sqrt(rsq); - rinv = 1.0/r; + rinv = 1.0 / r; delta = radsum - r; - dR = delta*Reff; + dR = delta * Reff; scale3(rinv, dx, nx); // relative translational velocity @@ -281,7 +281,7 @@ bool ContactModel::touch_JKR(int touch) double ContactModel::normal_JKR() { double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff, Fne; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; Escaled = k_norm * THREEQUARTERS; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 0047e24359..506cc2e175 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -889,9 +889,9 @@ double PairGranular::init_one(int i, int j) } // Copy global options - models[i][j].dt = dt; - models[i][j].roll_history_index = roll_history_index; - models[i][j].twist_history_index = twist_history_index; + models[i][j].dt = models[j][i].dt = dt; + models[i][j].roll_history_index = models[j][i].roll_history_index = roll_history_index; + models[i][j].twist_history_index = models[j][i].twist_history_index = twist_history_index; return cutoff; } diff --git a/src/contact.cpp b/src/contact.cpp index b4b335a1aa..a8405d095b 100644 --- a/src/contact.cpp +++ b/src/contact.cpp @@ -94,9 +94,9 @@ void ContactModel::prep_contact() // Standard geometric quantities r = sqrt(rsq); - rinv = 1.0/r; + rinv = 1.0 / r; delta = radsum - r; - dR = delta*Reff; + dR = delta * Reff; scale3(rinv, dx, nx); // relative translational velocity @@ -281,7 +281,7 @@ bool ContactModel::touch_JKR(int touch) double ContactModel::normal_JKR() { double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a, a2, F_pulloff, Fne; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; Escaled = k_norm * THREEQUARTERS; From ba1c4e8e814575c1ef3797982eb2655c41d2c4f2 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 29 Jun 2022 15:34:39 -0600 Subject: [PATCH 09/57] Defining conduction from area, a --- doc/src/pair_granular.rst | 10 +++++++++- src/GRANULAR/contact.cpp | 6 +----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 9a99558653..c14d94a77a 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -635,7 +635,15 @@ attractive force. This keyword cannot be used with the JKR or DMT models. ---------- The optional *heat* keyword enables heat conduction and it must be followed by -a non-negative numeric value for the conductivity. Note that the *heat* keyword +a non-negative numeric value for the conductivity :math:`k_{s}.`` The heat :math:`Q` +conducted across an interface is given by + +.. math:: + + Q = k_{s} a \Delta T + +where :math:`\Delta T` is the difference in the two particles' temperature and :math:`a` +is the area of the contact and depends on the normal force model. Note that the *heat* keyword must be included in either all or none of of the *pair_coeff* calls. See :doc:`fix temp/integrate ` for more information on this option. diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index a8405d095b..a7b59f7172 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -249,11 +249,7 @@ double ContactModel::calculate_heat() { double dT = Ti - Tj; double Hc; - - //Dan is Emod the youngs modulus for all models? or do I need to scale? - Hc = 2 * conductivity * pow(FOURTHIRDS * Fntot * Reff / Emod, ONETHIRD); - - return Hc * dT; + return conductivity * a * dT; } /* ---------------------------------------------------------------------- */ From bb92dae6d355187628bcd17041d375f070d95854 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 5 Jul 2022 10:12:12 -0600 Subject: [PATCH 10/57] Simplying conduction --- src/GRANULAR/contact.cpp | 1 - src/contact.cpp | 635 --------------------------------------- 2 files changed, 636 deletions(-) delete mode 100644 src/contact.cpp diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index a7b59f7172..40105be815 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -248,7 +248,6 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to double ContactModel::calculate_heat() { double dT = Ti - Tj; - double Hc; return conductivity * a * dT; } diff --git a/src/contact.cpp b/src/contact.cpp deleted file mode 100644 index a8405d095b..0000000000 --- a/src/contact.cpp +++ /dev/null @@ -1,635 +0,0 @@ -// clang-format off -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- - - This class contains a series of tools for DEM contacts - Multiple models can be defined and used to calculate forces - and torques based on contact geometry -*/ - -#include "contact.h" -#include "math_const.h" -#include "math_extra.h" -#include "pointers.h" - -#include - -using namespace LAMMPS_NS; -using namespace MathExtra; -using namespace MathConst; - -namespace Contact { - -ContactModel::ContactModel() -{ - k_norm = cohesion = gamma_norm = 0.0; - k_tang = gamma_tang = mu_tang = 0.0; - k_roll = gamma_roll = mu_roll = 0.0; - k_twist = gamma_twist = mu_twist = 0.0; - - limit_damping = 0; - cutoff_type = 0.0; - reset_contact(); -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::reset_contact() -{ - radi = radj = 0.0; - xi = xj = vi = vj = omegai = omegaj = nullptr; - - prep_flag = check_flag = 0; - touch = false; -} - -/* ---------------------------------------------------------------------- */ - -bool ContactModel::check_contact() -{ - check_flag = 1; - - sub3(xi, xj, dx); - rsq = lensq3(dx); - radsum = radi + radj; - Reff = radi*radj/radsum; - - touch = false; - if (normal_model == JKR) touch = touch_JKR(touch); - else touch = (rsq < radsum*radsum); - - return touch; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::prep_contact() -{ - prep_flag = 1; - - // If it hasn't already been done, test if the contact exists - if (check_flag != 1) touch = check_contact(); - if (!touch) return; - - double temp[3]; - - // Set flags - mindlin_rescale = mindlin_force = 0; - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - mindlin_rescale = 1; - if (tangential_model == TANGENTIAL_MINDLIN_FORCE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - mindlin_force = 1; - - // Standard geometric quantities - r = sqrt(rsq); - rinv = 1.0 / r; - delta = radsum - r; - dR = delta * Reff; - scale3(rinv, dx, nx); - - // relative translational velocity - sub3(vi, vj, vr); - - // normal component - vnnr = dot3(vr, nx); //v_R . n - scale3(vnnr, nx, vn); - - // tangential component - sub3(vr, vn, vt); - - // relative rotational velocity - scaleadd3(radi, omegai, radj, omegaj, wr); - - // relative tangential velocities - cross3(wr, nx, temp); - sub3(vt, temp, vtr); - vrel = len3(vtr); - - if (roll_model != ROLL_NONE || twist_model != TWIST_NONE) - sub3(omegai, omegaj, relrot); - - if (roll_model != ROLL_NONE) { - // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); - vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); - vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); - } - - if (twist_model != TWIST_NONE) { - // omega_T (eq 29 of Marshall) - magtwist = dot3(relrot, nx); - } -} - - -/* ---------------------------------------------------------------------- */ - -void ContactModel::calculate_forces(double *forces, double *torquesi, double *torquesj, double *history) -{ - // If it hasn't already been done, run prep calculations - if (prep_flag != 1) prep_contact(); - if (!touch) { - forces[0] = forces[1] = forces[2] = 0.0; - return; - } - - //********************************************** - // normal forces - //********************************************** - - // Also calculates: a, knfac, Fncrit (for JKR or DMT) - double Fne; - if (normal_model == JKR) { - Fne = normal_JKR(); - } else if (normal_model == DMT) { - Fne = normal_DMT(); - } else if (normal_model == HERTZ || normal_model == HERTZ_MATERIAL) { - Fne = normal_Hertz(); - } else { - Fne = normal_Hooke(); - } - - // NOTE: consider restricting Hooke to only have - // 'velocity' as an option for damping? - // Also calculates: damp_normal_prefactor - double Fdamp = normal_damping(); - - Fntot = Fne + Fdamp; - if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; - - if (normal_model != JKR && normal_model != DMT) Fncrit = fabs(Fntot); - - //********************************************** - // tangential force, including history effects - //********************************************** - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - Fscrit = mu_tang * Fncrit; - - if (tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_FORCE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { - tangential_mindlin(history); - } else if (tangential_model == TANGENTIAL_HISTORY) { - tangential_history(history); - } else { - tangential_no_history(); - } - - //********************************************** - // rolling force - //********************************************** - - if (roll_model != ROLL_NONE) - rolling(history); - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model == TWIST_MARSHALL) { - twisting_marshall(history); - } else if (twist_model == TWIST_SDS) { - twisting_SDS(history); - } - - //********************************************** - // sum contributions - //********************************************** - - scale3(Fntot, nx, forces); - add3(forces, fs, forces); - - cross3(nx, fs, torquesi); - copy3(torquesi, torquesj); - - double dist_to_contact = radi-0.5*delta; - scale3(dist_to_contact, torquesi); - dist_to_contact = radj-0.5*delta; - scale3(dist_to_contact, torquesj); - - double torroll[3]; - if (roll_model != ROLL_NONE) { - cross3(nx, fr, torroll); - scale3(Reff, torroll); - add3(torquesi, torroll, torquesi); - sub3(torquesj, torroll, torquesj); - } - - double tortwist[3]; - if (twist_model != TWIST_NONE) { - scale3(magtortwist, nx, tortwist); - add3(torquesi, tortwist, torquesi); - sub3(torquesj, tortwist, torquesj); - } -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::calculate_heat() -{ - double dT = Ti - Tj; - double Hc; - - //Dan is Emod the youngs modulus for all models? or do I need to scale? - Hc = 2 * conductivity * pow(FOURTHIRDS * Fntot * Reff / Emod, ONETHIRD); - - return Hc * dT; -} - -/* ---------------------------------------------------------------------- */ - -bool ContactModel::touch_JKR(int touch) -{ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = Reff * Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = radsum - delta_pulloff; - touchflag = (rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rsq < radsum * radsum); - } - return touchflag; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_JKR() -{ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - Fncrit = fabs(Fne + 2 * F_pulloff); - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_DMT() -{ - a = sqrt(dR); - double Fne = a * k_norm * delta; - Fne -= 4 * MY_PI * cohesion * Reff; - double F_pulloff = 4 * MY_PI * cohesion * Reff; - - knfac = k_norm * a; - Fncrit = fabs(Fne + 2 * F_pulloff); - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_Hertz() -{ - a = sqrt(dR); - double Fne = k_norm * delta * a; - - knfac = k_norm * a; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_Hooke() -{ - a = sqrt(dR); - double Fne = k_norm * delta; - - knfac = k_norm; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_damping() -{ - double damp_normal; - if (damping_model == VELOCITY) { - damp_normal = 1; - } else if (damping_model == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model == VISCOELASTIC) { - damp_normal = a * meff; - } else if (damping_model == TSUJI) { - damp_normal = sqrt(meff * knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = gamma_norm * damp_normal; - return -damp_normal_prefactor * vnnr; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::tangential_no_history() -{ - double gamma_scaled = gamma_tang * damp_normal_prefactor; - double fsmag, Ft; - - // classic pair gran/hooke (no history) - fsmag = gamma_scaled * vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fsmag) / vrel; - else Ft = 0.0; - - Ft = -Ft; - scale3(Ft, vtr, fs); -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::tangential_history(double *history) -{ - double gamma_scaled = gamma_tang * damp_normal_prefactor; - double k = k_tang; - int frame_update = 0; - double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; - - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = dot3(history, nx); - frame_update = fabs(rsht) * k > EPSILON * Fscrit; - - if (frame_update) { - shrmag = len3(history); - // projection - scale3(rsht, nx, history); - // also rescale to preserve magnitude - prjmag = len3(history); - if (prjmag > 0) temp_dbl = shrmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, history); - } - - // update history - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = k * dt; - scale3(temp_dbl, vtr, temp_array); - sub3(history, temp_array, history); - } - - // tangential forces = history + tangential velocity damping - temp_dbl = -gamma_norm; - scale3(temp_dbl, vtr, fs); - - // rescale frictional displacements and forces if needed - magfs = len3(fs); - if (magfs > Fscrit) { - shrmag = len3(history); - if (shrmag != 0.0) { - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs, history); - scale3(gamma_norm, vtr, temp_array); - add3(history, temp_array, history); - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs); - } else { - zero3(fs); - } - } -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::tangential_mindlin(double *history) -{ - double k_scaled, gamma_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; - double temp_array[3]; - int frame_update = 0; - - gamma_scaled = gamma_tang * damp_normal_prefactor; - k_scaled = k_tang * a; - if (mindlin_rescale) { - // on unloading, rescale the shear displacements/force - if (a < history[3]) { - temp_dbl = a / history[3]; - scale3(temp_dbl, history); - } - } - - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = dot3(history, nx); - if (mindlin_force) - frame_update = fabs(rsht) > EPSILON * Fscrit; - else - frame_update = fabs(rsht) * k_scaled > EPSILON * Fscrit; - - if (frame_update) { - shrmag = len3(history); - // projection - scale3(rsht, nx, history); - // also rescale to preserve magnitude - prjmag = len3(history); - if (prjmag > 0) temp_dbl = shrmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, history); - } - - // update history - if (mindlin_force) { - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = -k_scaled * dt; - scale3(temp_dbl, vtr, temp_array); - } else { - scale3(dt, vtr, temp_array); - } - add3(history, temp_array, history); - - if (mindlin_rescale) history[3] = a; - } - - // tangential forces = history + tangential velocity damping - temp_dbl = -gamma_scaled; - scale3(temp_dbl, vtr, fs); - - if (! mindlin_force) { - scale3(k_scaled, history, temp_array); - add3(fs, temp_array, fs); - } - - // rescale frictional displacements and forces if needed - magfs = len3(fs); - if (magfs > Fscrit) { - shrmag = len3(history); - if (shrmag != 0.0) { - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs, history); - scale3(gamma_tang, vtr, temp_array); - add3(history, temp_array, history); - if (! mindlin_force) { - temp_dbl = -1.0 / k_tang; - scale3(temp_dbl, history); - } - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs); - } else { - zero3(fs); - } - } -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::rolling(double *history) -{ - int rhist0, rhist1, rhist2, frameupdate; - double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; - - rhist0 = roll_history_index; - rhist1 = rhist0 + 1; - rhist2 = rhist1 + 1; - - Frcrit = mu_roll * Fncrit; - - if (history_update) { - hist_temp[0] = history[rhist0]; - hist_temp[1] = history[rhist1]; - hist_temp[2] = history[rhist2]; - rolldotn = dot3(hist_temp, nx); - - frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; - if (frameupdate) { // rotate into tangential plane - rollmag = len3(hist_temp); - // projection - temp_dbl = -rolldotn; - scale3(temp_dbl, nx, temp_array); - sub3(hist_temp, temp_array, hist_temp); - - // also rescale to preserve magnitude - prjmag = len3(hist_temp); - if (prjmag > 0) temp_dbl = rollmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, hist_temp); - } - scale3(dt, vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - } - - scaleadd3(k_roll, hist_temp, gamma_roll, vrl, fr); - negate3(fr); - - // rescale frictional displacements and forces if needed - - magfr = len3(fr); - if (magfr > Frcrit) { - rollmag = len3(hist_temp); - if (rollmag != 0.0) { - temp_dbl = -Frcrit / (magfr * k_roll); - scale3(temp_dbl, fr, temp_array); - add3(hist_temp, temp_array, hist_temp); - - temp_dbl = -gamma_roll/k_roll; - scale3(temp_dbl, vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - - temp_dbl = Frcrit / magfr; - scale3(temp_dbl, fr); - } else { - zero3(fr); - } - } - - history[rhist0] = hist_temp[0]; - history[rhist1] = hist_temp[1]; - history[rhist2] = hist_temp[2]; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::twisting_marshall(double *history) -{ - // Overwrite twist coefficients with derived values - k_twist = 0.5 * k_tang * a * a; // eq 32 of Marshall paper - gamma_twist = 0.5 * gamma_tang * a * a; - mu_twist = TWOTHIRDS * a * mu_tang; - - twisting_SDS(history); -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::twisting_SDS(double *history) -{ - double signtwist, Mtcrit; - - if (history_update) { - history[twist_history_index] += magtwist * dt; - } - - magtortwist = -k_twist * history[twist_history_index] - gamma_twist*magtwist; // M_t torque (eq 30) - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - history[twist_history_index] = (Mtcrit * signtwist - gamma_twist * magtwist) / k_twist; - magtortwist = -Mtcrit * signtwist; // eq 34 - } -} - -/* ---------------------------------------------------------------------- - compute pull-off distance (beyond contact) for a given radius and atom type - use temporary variables since this does not use a specific contact geometry -------------------------------------------------------------------------- */ - -double ContactModel::pulloff_distance(double radi, double radj) -{ - double Ecaled, a_tmp, Reff_tmp; - - if (normal_model != JKR) return radi+radj; - - Reff_tmp = radi * radj / (radi + radj); - if (Reff_tmp <= 0) return 0; - Ecaled = k_norm * THREEQUARTERS; - a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); - return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); -} - -} From 6b40ae29e45138afc67a9a85c64feb3ca541c2e3 Mon Sep 17 00:00:00 2001 From: "Dan S. Bolintineanu" Date: Thu, 14 Jul 2022 11:29:13 -0600 Subject: [PATCH 11/57] First stab --- src/GRANULAR/contact.cpp | 308 ++++++--------- src/GRANULAR/contact.h | 112 +++--- src/GRANULAR/damping_contact_models.cpp | 54 +++ src/GRANULAR/damping_contact_models.h | 56 +++ src/GRANULAR/heat_models.cpp | 185 +++++++++ src/GRANULAR/heat_models.h | 83 ++++ src/GRANULAR/normal_contact_models.cpp | 178 +++++++++ src/GRANULAR/normal_contact_models.h | 85 +++++ src/GRANULAR/pair_granular.cpp | 425 +++++---------------- src/GRANULAR/rolling_contact_models.cpp | 185 +++++++++ src/GRANULAR/rolling_contact_models.h | 83 ++++ src/GRANULAR/sub_model.cpp | 76 ++++ src/GRANULAR/sub_model.h | 48 +++ src/GRANULAR/tangential_contact_models.cpp | 168 ++++++++ src/GRANULAR/tangential_contact_models.h | 79 ++++ src/GRANULAR/twisting_contact_models.cpp | 185 +++++++++ src/GRANULAR/twisting_contact_models.h | 83 ++++ 17 files changed, 1825 insertions(+), 568 deletions(-) create mode 100644 src/GRANULAR/damping_contact_models.cpp create mode 100644 src/GRANULAR/damping_contact_models.h create mode 100644 src/GRANULAR/heat_models.cpp create mode 100644 src/GRANULAR/heat_models.h create mode 100644 src/GRANULAR/normal_contact_models.cpp create mode 100644 src/GRANULAR/normal_contact_models.h create mode 100644 src/GRANULAR/rolling_contact_models.cpp create mode 100644 src/GRANULAR/rolling_contact_models.h create mode 100644 src/GRANULAR/sub_model.cpp create mode 100644 src/GRANULAR/sub_model.h create mode 100644 src/GRANULAR/tangential_contact_models.cpp create mode 100644 src/GRANULAR/tangential_contact_models.h create mode 100644 src/GRANULAR/twisting_contact_models.cpp create mode 100644 src/GRANULAR/twisting_contact_models.h diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 40105be815..554a54eec9 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -21,6 +21,8 @@ #include "math_const.h" #include "math_extra.h" #include "pointers.h" +#include "comm.h" +#include "error.h" #include @@ -32,16 +34,117 @@ namespace Contact { ContactModel::ContactModel() { - k_norm = cohesion = gamma_norm = 0.0; - k_tang = gamma_tang = mu_tang = 0.0; - k_roll = gamma_roll = mu_roll = 0.0; - k_twist = gamma_twist = mu_twist = 0.0; - limit_damping = 0; cutoff_type = 0.0; + normal_model = nullptr; + tangential_model = nullptr; + damping_model = nullptr; + rolling_model = nullptr; + twisting_model = nullptr; reset_contact(); } +/* ---------------------------------------------------------------------- */ +void ContactModel::init_normal(char *model_name){ + if (strcmp(model_name, "hooke") == 0) normal_model = new Hooke(); + else if (strcmp(model_name, "hertz") == 0) normal_model = new Hertz(0); + else if (strcmp(model_name, "hertz/material") == 0) normal_model = new Hertz(1); + //... + else error->all(FLERR, "Normal model name not recognized"); + + normal_model->model_name.assign(model_name); + normal_model->contact = *this; + normal_model->allocate_coeffs(); +} + +/* ---------------------------------------------------------------------- */ +void ContactModel::init_damping(char *model_name){ + if (strcmp(model_name, "velocity") == 0) tangential_model = new Velocity(*this); + //... + else error->all(FLERR, "Damping model name not recognized"); + tangential_model->model_name.assign(model_name); + tangential_model->contact = *this; + tangential_model->allocate_coeffs(); +} + +/* ---------------------------------------------------------------------- */ +void ContactModel::init_tangential(char *model_name){ + if (strcmp(model_name, "linear") == 0) tangential_model = new LinearNohistory(*this); + //... + else error->all(FLERR, "Tangential model name not recognized"); + damping_model->model_name.assign(model_name); + damping_model->contact = *this; + damping_model->allocate_coeffs(); +} + + +/* ---------------------------------------------------------------------- */ +// .... same for rolling, twisting + + +void ContactModel::write_restart(FILE *fp){ + normal_model->write_restart(fp); + tangential_model->write_restart(fp); + damping_model->write_restart(fp); + if (rolling_model){ + rolling_model->write_restart(fp); + } + else{ + int num_char = -1; + fwrite(&num_char, sizeof(int), 1, fp); + } + if (twisting_model){ + twisting_model->write_restart(fp); + } + else{ + int num_char = -1; + fwrite(&num_char, sizeof(int), 1, fp); + } +} + +void ContactModel::read_restart(FILE *fp){ + int num_char; + //Normal model + if (comm->me == 0){ + utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); + } + MPI_BCast(&num_char, 1, MPI_INT, 0, world); + std::string model_name(num_char); + if (comm->me == 0){ + utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr,error); + } + MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); + init_normal(const_cast(model_name.data())); + normal_model->read_restart(); + + //Tangential model + if (comm->me == 0){ + utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); + } + MPI_BCast(&num_char, 1, MPI_INT, 0, world); + std::string model_name(num_char); + if (comm->me == 0){ + utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr,error); + } + init_tangential(const_cast(model_name.data())); + tangential_model->read_restart(); + + //Damping + if (comm->me == 0){ + utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); + } + MPI_BCast(&num_char, 1, MPI_INT, 0, world); + std::string model_name(num_char); + if (comm->me == 0){ + utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr,error); + } + init_tangential(const_cast(model_name.data())); + damping_model->read_restart(); + + //Optional (rolling, twisting) - only if num_char is > 0. + +} + /* ---------------------------------------------------------------------- */ void ContactModel::reset_contact() @@ -65,7 +168,7 @@ bool ContactModel::check_contact() Reff = radi*radj/radsum; touch = false; - if (normal_model == JKR) touch = touch_JKR(touch); + if (normal_model->beyond_contact) normal_model->touch(touch); else touch = (rsq < radsum*radsum); return touch; @@ -76,22 +179,12 @@ bool ContactModel::check_contact() void ContactModel::prep_contact() { prep_flag = 1; - // If it hasn't already been done, test if the contact exists if (check_flag != 1) touch = check_contact(); if (!touch) return; double temp[3]; - // Set flags - mindlin_rescale = mindlin_force = 0; - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - mindlin_rescale = 1; - if (tangential_model == TANGENTIAL_MINDLIN_FORCE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - mindlin_force = 1; - // Standard geometric quantities r = sqrt(rsq); rinv = 1.0 / r; @@ -117,10 +210,10 @@ void ContactModel::prep_contact() sub3(vt, temp, vtr); vrel = len3(vtr); - if (roll_model != ROLL_NONE || twist_model != TWIST_NONE) + if (roll_model || twist_model) sub3(omegai, omegaj, relrot); - if (roll_model != ROLL_NONE) { + if (roll_model) { // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) // this is different from the Marshall papers, which use the Bagi/Kuhn formulation // for rolling velocity (see Wang et al for why the latter is wrong) @@ -129,16 +222,15 @@ void ContactModel::prep_contact() vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); } - if (twist_model != TWIST_NONE) { + if (twist_model) { // omega_T (eq 29 of Marshall) magtwist = dot3(relrot, nx); } } - /* ---------------------------------------------------------------------- */ -void ContactModel::calculate_forces(double *forces, double *torquesi, double *torquesj, double *history) +void ContactModel::calculate_forces() { // If it hasn't already been done, run prep calculations if (prep_flag != 1) prep_contact(); @@ -151,66 +243,17 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to // normal forces //********************************************** - // Also calculates: a, knfac, Fncrit (for JKR or DMT) - double Fne; - if (normal_model == JKR) { - Fne = normal_JKR(); - } else if (normal_model == DMT) { - Fne = normal_DMT(); - } else if (normal_model == HERTZ || normal_model == HERTZ_MATERIAL) { - Fne = normal_Hertz(); - } else { - Fne = normal_Hooke(); - } - - // NOTE: consider restricting Hooke to only have - // 'velocity' as an option for damping? - // Also calculates: damp_normal_prefactor - double Fdamp = normal_damping(); + double Fne, Fdamp; + Fne = normal_model->calculate_forces(); + Fdamp = damping_model->calculate_forces(); Fntot = Fne + Fdamp; - if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; + if (limit_damping && Fntot < 0.0) Fntot = 0.0; + normal_model->set_fncrit(); - if (normal_model != JKR && normal_model != DMT) Fncrit = fabs(Fntot); - - //********************************************** - // tangential force, including history effects - //********************************************** - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - Fscrit = mu_tang * Fncrit; - - if (tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_FORCE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { - tangential_mindlin(history); - } else if (tangential_model == TANGENTIAL_HISTORY) { - tangential_history(history); - } else { - tangential_no_history(); - } - - //********************************************** - // rolling force - //********************************************** - - if (roll_model != ROLL_NONE) - rolling(history); - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model == TWIST_MARSHALL) { - twisting_marshall(history); - } else if (twist_model == TWIST_SDS) { - twisting_SDS(history); - } + tangential_model->calculate_forces(); + if (roll_model) roll_model->calculate_forces(); + if (twist_model) twist_model->calculate_forces(); //********************************************** // sum contributions @@ -219,6 +262,7 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to scale3(Fntot, nx, forces); add3(forces, fs, forces); + //May need to rethink this for use with walls (and eventually tris).. cross3(nx, fs, torquesi); copy3(torquesi, torquesj); @@ -228,7 +272,7 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to scale3(dist_to_contact, torquesj); double torroll[3]; - if (roll_model != ROLL_NONE) { + if (roll_model) { cross3(nx, fr, torroll); scale3(Reff, torroll); add3(torquesi, torroll, torquesi); @@ -236,7 +280,7 @@ void ContactModel::calculate_forces(double *forces, double *torquesi, double *to } double tortwist[3]; - if (twist_model != TWIST_NONE) { + if (twist_model) { scale3(magtortwist, nx, tortwist); add3(torquesi, tortwist, torquesi); sub3(torquesj, tortwist, torquesj); @@ -253,111 +297,7 @@ double ContactModel::calculate_heat() /* ---------------------------------------------------------------------- */ -bool ContactModel::touch_JKR(int touch) -{ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = Reff * Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = radsum - delta_pulloff; - touchflag = (rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rsq < radsum * radsum); - } - return touchflag; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_JKR() -{ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - Fncrit = fabs(Fne + 2 * F_pulloff); - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_DMT() -{ - a = sqrt(dR); - double Fne = a * k_norm * delta; - Fne -= 4 * MY_PI * cohesion * Reff; - double F_pulloff = 4 * MY_PI * cohesion * Reff; - - knfac = k_norm * a; - Fncrit = fabs(Fne + 2 * F_pulloff); - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_Hertz() -{ - a = sqrt(dR); - double Fne = k_norm * delta * a; - - knfac = k_norm * a; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_Hooke() -{ - a = sqrt(dR); - double Fne = k_norm * delta; - - knfac = k_norm; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -double ContactModel::normal_damping() -{ - double damp_normal; - if (damping_model == VELOCITY) { - damp_normal = 1; - } else if (damping_model == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model == VISCOELASTIC) { - damp_normal = a * meff; - } else if (damping_model == TSUJI) { - damp_normal = sqrt(meff * knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = gamma_norm * damp_normal; - return -damp_normal_prefactor * vnnr; -} /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 167f88e9de..cb6d1865af 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -14,77 +14,71 @@ #ifndef LMP_CONTACT_H #define LMP_CONTACT_H +#include "pointers.h" +#include "normal_contact_models.h" +#include "tangential_contact_models.h" +#include "damping_contact_models.h" +#include "rolling_contact_models.h" +#include "twisting_contact_models.h" +#include "heat_models.h" + +using namespace LAMMPS_NS; + namespace Contact { - enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; - enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; - enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; - enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; - enum {ROLL_NONE, ROLL_SDS}; +#define EPSILON 1e-10 - #define PI27SQ 266.47931882941264802866 // 27*PI**2 - #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) - #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) - #define INVROOT6 0.40824829046386307274 // 1/sqrt(6) - #define FOURTHIRDS (4.0/3.0) // 4/3 - #define ONETHIRD (1.0/3.0) // 1/3 - #define THREEQUARTERS 0.75 // 3/4 +class ContactModel : protected Pointers { +public: + ContactModel(); + ~ContactModel(); + int init(); + bool check_contact(); + void reset_contact(); + void calculate_forces(); + double calculate_heat(); + double pulloff_distance(double, double); - #define EPSILON 1e-10 + void init_normal(char*); + void init_tangential(char*); + void init_damping(char*); + void init_rolling(char*); + void init_twisting(char*); + void init_heat(char*); - class ContactModel { - public: - ContactModel(); - void reset_contact(); - bool check_contact(); - void prep_contact(); - void calculate_forces(double *, double *, double *, double *); - double calculate_heat(); - double pulloff_distance(double, double); + void write_restart(FILE *); + void read_restart(FILE *); - int normal_model, damping_model, tangential_model; - int roll_model, twist_model; - int limit_damping; - double cutoff_type; - double Emod, poisson; // variables used in defining mixed interactions - double k_norm, gamma_norm, cohesion; // normal_coeffs - double k_tang, gamma_tang, mu_tang; // tangential_coeffs - wutang? - double k_roll, gamma_roll, mu_roll; // roll_coeffs - double k_twist, gamma_twist, mu_twist; // twist_coeffs - double conductivity; + NormalModel *normal_model; + DampingModel *damping_model; //Classes below need .h and .cpp files analogous to normal_contact_models.h/.cpp + TangentialModel *tangential_model; + RollingModel *rolling_model; + TwistingModel *twisting_model; + HeatModel *heat_model; - double radi, radj, meff, dt, Ti, Tj; - double *xi, *xj, *vi, *vj, *omegai, *omegaj; - int history_update, roll_history_index, twist_history_index; + double *forces; + double *torquesi; + double *torquesj; + double *history; - double fs[3], fr[3], ft[3], magtortwist; + int limit_damping; - private: - double a, knfac, Fntot, Fncrit, Fscrit, Frcrit, damp_normal_prefactor; - double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; - double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; - double magtwist; - bool touch; + double radi, radj, meff, dt, Ti, Tj; + double area; - int prep_flag, check_flag; - int mindlin_rescale, mindlin_force; + double *xi, *xj, *vi, *vj, *omegai, *omegaj; + double Fntot, Fncrit; + double fs[3], fr[3], ft[3], magtortwist; - bool touch_JKR(int); - double normal_JKR(); - double normal_DMT(); - double normal_Hertz(); - double normal_Hooke(); - double normal_damping(); - void tangential_no_history(); - void tangential_history(double *); - void tangential_mindlin(double *); - void rolling(double *); - void twisting_marshall(double *); - void twisting_SDS(double *); +private: + double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; + double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; + double magtwist; + bool touch; - }; + int prep_flag, check_flag; + int mindlin_rescale, mindlin_force; +}; } // namespace Contact diff --git a/src/GRANULAR/damping_contact_models.cpp b/src/GRANULAR/damping_contact_models.cpp new file mode 100644 index 0000000000..11d2c19b57 --- /dev/null +++ b/src/GRANULAR/damping_contact_models.cpp @@ -0,0 +1,54 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "damping_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include +#include "math_special.h" + +using namespace MathConst; +using namespace MathSpecial; + +namespace Contact{ + +void DampingModel::allocate_coeffs(){ + damp = contact.normal_model->coeffs[1]; +} + +//----------------------------------------- +double Velocity::calculate_forces(){ + return -damp*contact.vnnr; +} + +double MassVelocity::calculate_forces(){ + return -damp*contact.meff*contact.vnnr; +} + + +double ViscoElastic::calculate_forces(){ + return -damp*contact.meff*contact.area*contact.vnnr; +} + + +void Tsuji::allocate_coeffs(){ + double cor = contact.normal_model->coeffs[1]; + damp = 1.2728-4.2783*cor+11.087*square(cor)-22.348*cube(cor)+ + 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); +} + +double Tsuji::calculate_forces(){ + return -damp*sqrt(contact.meff*contact.knfac)*contact.vnnr; +} + diff --git a/src/GRANULAR/damping_contact_models.h b/src/GRANULAR/damping_contact_models.h new file mode 100644 index 0000000000..036f6e3452 --- /dev/null +++ b/src/GRANULAR/damping_contact_models.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef DAMPING_CONTACT_MODELS_H_ +#define DAMPING_CONTACT_MODELS_H_ + +#include "contact.h"; +#include "sub_model.h" + +namespace Contact { + +class DampingModel:SubModel{ +public: + DampingModel(){}; + virtual ~DampingModel(){}; + virtual double calculate_forces() = 0; + virtual void allocate_coeffs(); + double damp; +}; + +class Velocity:DampingModel{ +public: + double calculate_forces(); +}; + +class MassVelocity:DampingModel{ +public: + double calculate_forces(); +}; + +class ViscoElastic:DampingModel{ +public: + double calculate_forces(); +}; + +class Tsuji:DampingModel{ +public: + double calculate_forces(); + void allocate_coeffs(); +}; + + +} + +#endif /*DAMPING_CONTACT_MODELS_H_ */ + diff --git a/src/GRANULAR/heat_models.cpp b/src/GRANULAR/heat_models.cpp new file mode 100644 index 0000000000..e6bafe4b3c --- /dev/null +++ b/src/GRANULAR/heat_models.cpp @@ -0,0 +1,185 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "normal_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include + +using namespace MathConst; + +namespace Contact{ + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define ONETHIRD (1.0/3.0) // 1/3 +#define THREEQUARTERS 0.75 // 3/4 + +// ************************ +// Default behaviors where needed +// ************************ +void NormalModel::set_fncrit(){ + contact->Fncrit = fabs(contact->Fntot); +} + +void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ + for (int i = 0; i < num_coeffs; i++){ + coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); + } +} + +//----------------------------------------- + +//****************** +// Hooke +//****************** +void Hooke::Hooke(ContactModel &c){ + contact = c; + num_coeffs = 2; + allocate_coeffs(); +} + +void Hooke::coeffs_to_local(){ + k_norm = coeffs[0]; + damp = coeffs[1]; +} + +double Hooke::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = k_norm * contact.area; + return contact.knfac * contact.delta; +} + + +//****************** +// Hertz +//****************** +void Hertz::Hertz(ContactModel &c, int mat_flag){ + contact = c; + material_prop_flag = mat_flag; + if (material_prop_flag){ + num_coeffs = 3; + } + else{ + num_coeffs = 2; + } + allocate_coeffs(); +} + +void Hertz::coeffs_to_local(){ + if (material_prop_flag){ + Emod = coeffs[0]; + poiss = coeffs[1]; + k_norm = 4/3*Emod; + } + else{ + k_norm = coeffs[0]; + } +} + +double Hertz::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + return contact.knfac * contact.delta; +} + +//****************** +// DMT +//****************** +void DMT::DMT(ContactModel &c){ + contact = c; + material_prop_flag = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +double DMT::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + double Fne = contact.knfac * contact.delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne -= F_pulloff; + return Fne; +} + +void DMT::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); +} + +//****************** +// JKR +//****************** +void JKR::JKR(ContactModel &c){ + contact = c; + material_prop_flag = 1; + beyond_contact = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +bool JKR::touch(int touch){ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = contact.Reff * contact.Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = contact.radsum - delta_pulloff; + touchflag = (contact.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rcontact.sq < contact.radsum * contact.radsum); + } + return touchflag; +} + +double JKR::calculate_forces(){ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + return Fne; +} + +void JKR::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); +} + + + diff --git a/src/GRANULAR/heat_models.h b/src/GRANULAR/heat_models.h new file mode 100644 index 0000000000..1a2f1ddb7d --- /dev/null +++ b/src/GRANULAR/heat_models.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef NORMAL_CONTACT_MODELS_H_ +#define NORMAL_CONTACT_MODELS_H_ + +#include "contact.h"; +#include "sub_model.h" + +namespace Contact { + +class NormalModel:SubModel{ +public: + NormalModel(){}; + virtual ~NormalModel(){}; + virtual bool check_contact(); + virtual void prep_contact(); + virtual void set_fncrit(); + virtual double calculate_forces() = 0; + virtual void coeffs_to_local(); + virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed + +private: + int beyond_contact = 0; + int allow_limit_damping = 1; + +}; + +class Hooke:NormalModel{ +public: + Hooke(ContactModel &c); + ~Hooke(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp; +}; + +class Hertz:NormalModel{ +public: + Hertz(ContactModel&, int); + ~Hertz(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss; +}; + +class DMT:NormalModel{ +public: + DMT(ContactModel &c); + ~DMT(){}; + void coeffs_to_local(); + void coeffs_to_local(NormalModel*, NormalModel*); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; +}; + +class JKR:NormalModel{ +public: + JKR(ContactModel &c); + ~JKR(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; + +}; +} + +#endif /*NORMAL_CONTACT_MODELS_H_ */ + diff --git a/src/GRANULAR/normal_contact_models.cpp b/src/GRANULAR/normal_contact_models.cpp new file mode 100644 index 0000000000..cc01a3ddb2 --- /dev/null +++ b/src/GRANULAR/normal_contact_models.cpp @@ -0,0 +1,178 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "normal_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include + +using namespace MathConst; + +namespace Contact{ + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define ONETHIRD (1.0/3.0) // 1/3 +#define THREEQUARTERS 0.75 // 3/4 + +// ************************ +// Default behaviors where needed +// ************************ +void NormalModel::set_fncrit(){ + contact->Fncrit = fabs(contact->Fntot); +} + +void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ + for (int i = 0; i < num_coeffs; i++){ + coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); + } +} + +//----------------------------------------- + +//****************** +// Hooke +//****************** +void Hooke::Hooke(ContactModel &c){ + num_coeffs = 2; + allocate_coeffs(); +} + +void Hooke::coeffs_to_local(){ + k_norm = coeffs[0]; + damp = coeffs[1]; +} + +double Hooke::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = k_norm * contact.area; + return contact.knfac * contact.delta; +} + + +//****************** +// Hertz +//****************** +void Hertz::Hertz(ContactModel &c, int mat_flag){ + material_prop_flag = mat_flag; + if (material_prop_flag){ + num_coeffs = 3; + } + else{ + num_coeffs = 2; + } +} + +void Hertz::coeffs_to_local(){ + if (material_prop_flag){ + Emod = coeffs[0]; + poiss = coeffs[1]; + k_norm = 4/3*Emod; + } + else{ + k_norm = coeffs[0]; + } +} + +double Hertz::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + return contact.knfac * contact.delta; +} + +//****************** +// DMT +//****************** +void DMT::DMT(ContactModel &c){ + material_prop_flag = 1; + num_coeffs = 4; +} + +double DMT::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + double Fne = contact.knfac * contact.delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne -= F_pulloff; + return Fne; +} + +void DMT::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); +} + +//****************** +// JKR +//****************** +void JKR::JKR(ContactModel &c){ + material_prop_flag = 1; + beyond_contact = 1; + num_coeffs = 4; +} + +bool JKR::touch(int touch){ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = contact.Reff * contact.Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = contact.radsum - delta_pulloff; + touchflag = (contact.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rcontact.sq < contact.radsum * contact.radsum); + } + return touchflag; +} + +double JKR::calculate_forces(){ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + return Fne; +} + +void JKR::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); +} + + + diff --git a/src/GRANULAR/normal_contact_models.h b/src/GRANULAR/normal_contact_models.h new file mode 100644 index 0000000000..198e4bcb59 --- /dev/null +++ b/src/GRANULAR/normal_contact_models.h @@ -0,0 +1,85 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef NORMAL_CONTACT_MODELS_H_ +#define NORMAL_CONTACT_MODELS_H_ + +#include "contact.h"; +#include "sub_model.h" + +namespace Contact { + +class NormalModel:SubModel{ +public: + NormalModel(){}; + virtual ~NormalModel(){}; + virtual bool check_contact(); + virtual void prep_contact(); + virtual void set_fncrit(); + virtual double calculate_forces() = 0; + virtual void coeffs_to_local(); + virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed + +private: + int size_history = 0; + int beyond_contact = 0; + int allow_limit_damping = 1; + +}; + +class Hooke:NormalModel{ +public: + Hooke(); + ~Hooke(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp; +}; + +class Hertz:NormalModel{ +public: + Hertz(int); + ~Hertz(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss; +}; + +class DMT:NormalModel{ +public: + DMT(); + ~DMT(){}; + void coeffs_to_local(); + void coeffs_to_local(NormalModel*, NormalModel*); + double calculate_forces(); +private: + double k_norm, damp, Emod, cohesion, poiss; + double F_pulloff; +}; + +class JKR:NormalModel{ +public: + JKR(); + ~JKR(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, cohesion, poiss; + double F_pulloff; +}; +} + +#endif /*NORMAL_CONTACT_MODELS_H_ */ + diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 506cc2e175..855ed36cf0 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -81,7 +81,8 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) beyond_contact = 0; nondefault_history_transfer = 0; tangential_history_index = 0; - roll_history_index = twist_history_index = 0; + roll_history_index = 0; + twist_history_index = 0; heat_flag = 0; // create dummy fix as placeholder for FixNeighHistory @@ -234,6 +235,7 @@ void PairGranular::compute(int eflag, int vflag) models[itype][jtype].omegai = omega[i]; models[itype][jtype].omegaj = omega[j]; models[itype][jtype].history_update = historyupdate; + models[itype][jtype].history = history; models[itype][jtype].prep_contact(); if (heat_flag) { @@ -250,7 +252,11 @@ void PairGranular::compute(int eflag, int vflag) history = &allhistory[size_history*jj]; } - models[itype][jtype].calculate_forces(forces, torquesi, torquesj, history); + double *forces = models[itype][jtype].forces; + double *torquesi = models[itype][jtype].torquesi; + double *torquesj = models[itype][jtype].torquesj; + + models[itype][jtype].calculate_forces(); if (heat_flag) dq = models[itype][jtype].calculate_heat(); // apply forces & torques @@ -339,7 +345,7 @@ void PairGranular::coeff(int narg, char **arg) double conductivity_one; double cutoff_one = -1; - if (narg < 2) + if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -348,276 +354,66 @@ void PairGranular::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - //Defaults - normal_model_one = tangential_model_one = -1; - roll_model_one = ROLL_NONE; - twist_model_one = TWIST_NONE; - damping_model_one = VISCOELASTIC; - int ld_flag = 0; + //Here's one option for handing off parsing to the SubModel objects: + ContactModel model_one; + //Parse mandatory normal and tangential specifications int iarg = 2; + model_one.init_normal(arg[iarg]); + iarg += 1; + if (iarg + model_one.normal_model->num_coeffs >= narg) + error->all(FLERR,"Illegal pair_coeff command" + "Insufficient arguments provided."); + model_one.normal_model->parse_coeffs(arg, iarg); + iarg += model_one.normal_model->num_coeffs; + + if (strcmp(arg[iarg], "tangential") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR,"Illegal pair_coeff command, must specify " + "tangential model after tangential keyword"); + model_one.init_tangential(arg[iarg]); + iarg += 1; + if (iarg + model_one.tangential_model->num_coeffs >= narg) + error->all(FLERR, "Illegal pair_coeff command" + "Insufficient arguments provided."); + model_one.tangential_model->parse_coeffs(arg, iarg); + iarg += model_one.tangential_model->num_coeffs; + } + else{ + error->all(FLERR, "Illegal pair_coeff command, 'tangential' keyword expected"); + } + //Parse optional arguments while (iarg < narg) { - if (strcmp(arg[iarg], "hooke") == 0) { - if (iarg + 2 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hooke option"); - normal_model_one = HOOKE; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - iarg += 3; - } else if (strcmp(arg[iarg], "hertz") == 0) { - if (iarg + 2 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hertz option"); - normal_model_one = HERTZ; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - iarg += 3; - } else if (strcmp(arg[iarg], "hertz/material") == 0) { - if (iarg + 3 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hertz/material option"); - normal_model_one = HERTZ_MATERIAL; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio - iarg += 4; - } else if (strcmp(arg[iarg], "dmt") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hertz option"); - normal_model_one = DMT; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio - normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion - iarg += 5; - } else if (strcmp(arg[iarg], "jkr") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for JKR option"); - beyond_contact = 1; - normal_model_one = JKR; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio - normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion - iarg += 5; - } else if (strcmp(arg[iarg], "damping") == 0) { - if (iarg+1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, " - "not enough parameters provided for damping model"); - if (strcmp(arg[iarg+1], "velocity") == 0) { - damping_model_one = VELOCITY; - iarg += 1; - } else if (strcmp(arg[iarg+1], "mass_velocity") == 0) { - damping_model_one = MASS_VELOCITY; - iarg += 1; - } else if (strcmp(arg[iarg+1], "viscoelastic") == 0) { - damping_model_one = VISCOELASTIC; - iarg += 1; - } else if (strcmp(arg[iarg+1], "tsuji") == 0) { - damping_model_one = TSUJI; - iarg += 1; - } else error->all(FLERR, "Illegal pair_coeff command, " - "unrecognized damping model"); + if (strcmp(arg[iarg], "rolling") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + model_one.init_rolling(arg[iarg+1]); iarg += 1; - } else if (strcmp(arg[iarg], "tangential") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR,"Illegal pair_coeff command, must specify " - "tangential model after tangential keyword"); - if (strcmp(arg[iarg+1], "linear_nohistory") == 0) { - if (iarg + 3 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for tangential model"); - tangential_model_one = TANGENTIAL_NOHISTORY; - tangential_coeffs_one[0] = 0; - // gammat and friction coeff - tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - iarg += 4; - } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || - (strcmp(arg[iarg+1], "mindlin") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale") == 0) || - (strcmp(arg[iarg+1], "mindlin/force") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0)) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for tangential model"); - if (strcmp(arg[iarg+1], "linear_history") == 0) - tangential_model_one = TANGENTIAL_HISTORY; - else if (strcmp(arg[iarg+1], "mindlin") == 0) - tangential_model_one = TANGENTIAL_MINDLIN; - else if (strcmp(arg[iarg+1], "mindlin_rescale") == 0) - tangential_model_one = TANGENTIAL_MINDLIN_RESCALE; - else if (strcmp(arg[iarg+1], "mindlin/force") == 0) - tangential_model_one = TANGENTIAL_MINDLIN_FORCE; - else if (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0) - tangential_model_one = TANGENTIAL_MINDLIN_RESCALE_FORCE; - tangential_history = 1; - if ((tangential_model_one == TANGENTIAL_MINDLIN || - tangential_model_one == TANGENTIAL_MINDLIN_RESCALE || - tangential_model_one == TANGENTIAL_MINDLIN_FORCE || - tangential_model_one == TANGENTIAL_MINDLIN_RESCALE_FORCE) && - (strcmp(arg[iarg+2], "NULL") == 0)) { - if (normal_model_one == HERTZ || normal_model_one == HOOKE) { - error->all(FLERR, "NULL setting for Mindlin tangential " - "stiffness requires a normal contact model that " - "specifies material properties"); - } - tangential_coeffs_one[0] = -1; - } else { - tangential_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // kt - } - // gammat and friction coeff - tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "tangential model not recognized"); - } - } else if (strcmp(arg[iarg], "rolling") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - if (strcmp(arg[iarg+1], "none") == 0) { - roll_model_one = ROLL_NONE; - iarg += 2; - } else if (strcmp(arg[iarg+1], "sds") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for rolling model"); - roll_model_one = ROLL_SDS; - roll_history = 1; - // kR and gammaR and rolling friction coeff - roll_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - roll_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - roll_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "rolling friction model not recognized"); - } - } else if (strcmp(arg[iarg], "twisting") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - if (strcmp(arg[iarg+1], "none") == 0) { - twist_model_one = TWIST_NONE; - iarg += 2; - } else if (strcmp(arg[iarg+1], "marshall") == 0) { - twist_model_one = TWIST_MARSHALL; - twist_history = 1; - iarg += 2; - } else if (strcmp(arg[iarg+1], "sds") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for twist model"); - twist_model_one = TWIST_SDS; - twist_history = 1; - // kt and gammat and friction coeff - twist_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - twist_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - twist_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "twisting friction model not recognized"); - } - } else if (strcmp(arg[iarg], "cutoff") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); - iarg += 2; + if (iarg + model_one.rolling_model->num_coeffs >= narg) + error->all(FLERR, "Illegal pair_coeff command" + "Insufficient arguments provided for rolling model."); + iarg += model_one.rolling_model->num_coeffs; + } + else if (strcmp(arg[iarg], "twisting") == 0) { + //... + } + else if (strcmp(arg[iarg], "cutoff") == 0) { + //.. } else if (strcmp(arg[iarg], "limit_damping") == 0) { - ld_flag = 1; - iarg += 1; + //.. } else if (strcmp(arg[iarg], "heat") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - conductivity_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (conductivity_one < 0.0) - error->all(FLERR, "Illegal pair_coeff command, conductivity must be positive"); - heat_flag = 1; - iarg += 2; + //.. } else error->all(FLERR, "Illegal pair_coeff command"); } - // error not to specify normal or tangential model - if ((normal_model_one < 0) || (tangential_model_one < 0)) - error->all(FLERR, "Illegal pair_coeff command, " - "must specify normal or tangential contact model"); + if (model_one.limit_damping && !model_one.normal_model->allow_limit_damping) + error->all(FLERR,"Illegal pair_coeff command, " + "Cannot limit damping with specified normal contact model"); int count = 0; - double damp; - if (damping_model_one == TSUJI) { - double cor; - cor = normal_coeffs_one[1]; - damp = 1.2728-4.2783*cor+11.087*square(cor)-22.348*cube(cor)+ - 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); - } else damp = normal_coeffs_one[1]; - - if (ld_flag && normal_model_one == JKR) - error->all(FLERR,"Illegal pair_coeff command, " - "Cannot limit damping with JKR model"); - - if (ld_flag && normal_model_one == DMT) - error->all(FLERR,"Illegal pair_coeff command, " - "Cannot limit damping with DMT model"); - - double Emod, poisson; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { - - // Define normal model - models[i][j].normal_model = models[j][i].normal_model = normal_model_one; - models[i][j].damping_model = models[j][i].damping_model = damping_model_one; - models[i][j].gamma_norm = models[j][i].gamma_norm = damp; - Emod = normal_coeffs_one[0]; - poisson = normal_coeffs_one[2]; - models[i][j].Emod = models[j][i].Emod = Emod; - models[i][j].poisson = models[j][i].poisson = poisson; - - if (normal_model_one != HERTZ && normal_model_one != HOOKE) { - models[i][j].k_norm = models[j][i].k_norm = - FOURTHIRDS*mix_stiffnessE(Emod,Emod,poisson,poisson); - } else { - models[i][j].k_norm = models[j][i].k_norm = normal_coeffs_one[0]; - } - if ((normal_model_one == JKR) || (normal_model_one == DMT)) - models[i][j].cohesion = models[j][i].cohesion = normal_coeffs_one[3]; - - // Define tangential model - models[i][j].tangential_model = models[j][i].tangential_model = tangential_model_one; - if (tangential_coeffs_one[0] == -1) { - models[i][j].k_tang = models[j][i].k_tang = - 8*mix_stiffnessG(Emod, Emod, poisson, poisson); - } else { - models[i][j].k_tang = models[j][i].k_tang = tangential_coeffs_one[0]; - } - models[i][j].gamma_tang = models[j][i].gamma_tang = tangential_coeffs_one[1]; - models[i][j].mu_tang = models[j][i].mu_tang = tangential_coeffs_one[2]; - - // Define rolling model - models[i][j].roll_model = models[j][i].roll_model = roll_model_one; - if (roll_model_one != ROLL_NONE) { - models[i][j].k_roll = models[j][i].k_roll = roll_coeffs_one[0]; - models[i][j].gamma_roll = models[j][i].gamma_roll = roll_coeffs_one[1]; - models[i][j].mu_roll = models[j][i].mu_roll = roll_coeffs_one[2]; - } - - // Define twisting model - models[i][j].twist_model = models[j][i].twist_model = twist_model_one; - if (twist_model_one != TWIST_NONE && twist_model_one != TWIST_MARSHALL) { - models[i][j].k_twist = models[j][i].k_twist = twist_coeffs_one[0]; - models[i][j].gamma_twist = models[j][i].gamma_twist = twist_coeffs_one[1]; - models[i][j].mu_twist = models[j][i].mu_twist = twist_coeffs_one[2]; - } - - // Define extra options - models[i][j].cutoff_type = models[j][i].cutoff_type = cutoff_one; - models[i][j].limit_damping = models[j][i].limit_damping = ld_flag; - models[i][j].conductivity = models[j][i].conductivity = conductivity_one; - + models[i][j] = model_one; //Not sure if this works to copy? May need to specify a copy operator for ContactModel.. setflag[i][j] = 1; count++; } @@ -641,48 +437,31 @@ void PairGranular::init_style() if (comm->ghost_velocity == 0) error->all(FLERR,"Pair granular requires ghost atoms store velocity"); - // determine whether we need a granular neigh list, how large it needs to be - - use_history = normal_history || tangential_history || - roll_history || twist_history; - - // for JKR, will need fix/neigh/history to keep track of touch arrays - + size_normal_history = 0; + size_tangential_history = 0; + size_rolling_history = 0; + size_twisting_history = 0; for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) - if (models[i][j].normal_model == JKR) use_history = 1; + for (int j = i; j <= atom->ntypes; j++){ + if (models[i][j].normal_model->history_flag || + models[i][j].tangential_model->history_flag || + models[i][j].rolling_model->history_flag || + models[i][j].twisting_model->history_flag) use_history = 1; - size_history = 3*tangential_history + 3*roll_history + twist_history; + if (models[i][j].nondefault_history_transfer) + if (models[i][j].normal_model->size_history > size_normal_history) + size_normal_history = models[i][j].normal_model->size_history; + //... + } + + size_history = size_normal_history + size_tangential_history + + size_roll_history + size_twist_history; // determine location of tangential/roll/twist histories in array - if (roll_history) { - if (tangential_history) roll_history_index = 3; - else roll_history_index = 0; - } - if (twist_history) { - if (tangential_history) { - if (roll_history) twist_history_index = 6; - else twist_history_index = 3; - } else { - if (roll_history) twist_history_index = 3; - else twist_history_index = 0; - } - } - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) - if (models[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE || - models[i][j].tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { - size_history += 1; - roll_history_index += 1; - twist_history_index += 1; - nondefault_history_transfer = 1; - history_transfer_factors = new int[size_history]; - for (int ii = 0; ii < size_history; ++ii) - history_transfer_factors[ii] = -1; - history_transfer_factors[3] = 1; - break; - } + tangential_history_index = size_normal_history; + roll_history_index = size_normal_history + size_tangential_history; + twist_history_index = size_normal_history + size_tangential_history + size_roll_history; if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY); else neighbor->add_request(this, NeighConst::REQ_SIZE); @@ -907,27 +686,9 @@ void PairGranular::write_restart(FILE *fp) for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { - fwrite(&models[i][j].normal_model,sizeof(int),1,fp); - fwrite(&models[i][j].damping_model,sizeof(int),1,fp); - fwrite(&models[i][j].tangential_model,sizeof(int),1,fp); - fwrite(&models[i][j].roll_model,sizeof(int),1,fp); - fwrite(&models[i][j].twist_model,sizeof(int),1,fp); - fwrite(&models[i][j].limit_damping,sizeof(int),1,fp); - fwrite(&models[i][j].Emod,sizeof(double),1,fp); - fwrite(&models[i][j].poisson,sizeof(double),1,fp); - fwrite(&models[i][j].k_norm,sizeof(double),1,fp); - fwrite(&models[i][j].gamma_norm,sizeof(double),1,fp); - fwrite(&models[i][j].cohesion,sizeof(double),1,fp); - fwrite(&models[i][j].k_tang,sizeof(double),1,fp); - fwrite(&models[i][j].gamma_tang,sizeof(double),1,fp); - fwrite(&models[i][j].mu_tang,sizeof(double),1,fp); - fwrite(&models[i][j].k_roll,sizeof(double),1,fp); - fwrite(&models[i][j].gamma_roll,sizeof(double),1,fp); - fwrite(&models[i][j].mu_roll,sizeof(double),1,fp); - fwrite(&models[i][j].k_twist,sizeof(double),1,fp); - fwrite(&models[i][j].gamma_twist,sizeof(double),1,fp); - fwrite(&models[i][j].mu_twist,sizeof(double),1,fp); - fwrite(&models[i][j].cutoff_type,sizeof(double),1,fp); + if (comm->me == 0){ + models[i][j].write_restart(fp); + } } } } @@ -948,12 +709,23 @@ void PairGranular::read_restart(FILE *fp) MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&models[i][j].normal_model,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].damping_model,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].tangential_model,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].roll_model,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].twist_model,sizeof(int),1,fp,nullptr,error); + std::string name; + utils::sfread(FLERR,&name.data(),sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].damping_model_type,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].tangential_model_type,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].roll_model_type,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&models[i][j].twist_model_type,sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&models[i][j].limit_damping,sizeof(int),1,fp,nullptr,error); + } + MPI_Bcast(&models[i][j].normal_model_type,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].damping_model_type,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].tangential_model_type,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].roll_model_type,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].twist_model_type,1,MPI_INT,0,world); + MPI_Bcast(&models[i][j].limit_damping,1,MPI_INT,0,world); + models[i][j].init(); + models[i][j].read_restart(); + utils::sfread(FLERR,&models[i][j].k_norm,sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&models[i][j].gamma_norm,sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&models[i][j].cohesion,sizeof(int),1,fp,nullptr,error); @@ -1087,6 +859,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, } double forces[3], torquesi[3], torquesj[3]; + models[itype][jtype].calculate_forces(forces, torquesi, torquesj, history); // apply forces & torques @@ -1185,10 +958,12 @@ double PairGranular::mix_geom(double valii, double valjj) only needed if any history entries i-j are not just negative of j-i entries ------------------------------------------------------------------------- */ -void PairGranular::transfer_history(double* source, double* target) +void PairGranular::transfer_history(double* source, double* target, int source_type, int target_type) { - for (int i = 0; i < size_history; i++) + models[itype][jtype].transfer_history(); + for (int i = 0; i < size_history; i++){ target[i] = history_transfer_factors[i]*source[i]; + } } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/rolling_contact_models.cpp b/src/GRANULAR/rolling_contact_models.cpp new file mode 100644 index 0000000000..e6bafe4b3c --- /dev/null +++ b/src/GRANULAR/rolling_contact_models.cpp @@ -0,0 +1,185 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "normal_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include + +using namespace MathConst; + +namespace Contact{ + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define ONETHIRD (1.0/3.0) // 1/3 +#define THREEQUARTERS 0.75 // 3/4 + +// ************************ +// Default behaviors where needed +// ************************ +void NormalModel::set_fncrit(){ + contact->Fncrit = fabs(contact->Fntot); +} + +void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ + for (int i = 0; i < num_coeffs; i++){ + coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); + } +} + +//----------------------------------------- + +//****************** +// Hooke +//****************** +void Hooke::Hooke(ContactModel &c){ + contact = c; + num_coeffs = 2; + allocate_coeffs(); +} + +void Hooke::coeffs_to_local(){ + k_norm = coeffs[0]; + damp = coeffs[1]; +} + +double Hooke::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = k_norm * contact.area; + return contact.knfac * contact.delta; +} + + +//****************** +// Hertz +//****************** +void Hertz::Hertz(ContactModel &c, int mat_flag){ + contact = c; + material_prop_flag = mat_flag; + if (material_prop_flag){ + num_coeffs = 3; + } + else{ + num_coeffs = 2; + } + allocate_coeffs(); +} + +void Hertz::coeffs_to_local(){ + if (material_prop_flag){ + Emod = coeffs[0]; + poiss = coeffs[1]; + k_norm = 4/3*Emod; + } + else{ + k_norm = coeffs[0]; + } +} + +double Hertz::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + return contact.knfac * contact.delta; +} + +//****************** +// DMT +//****************** +void DMT::DMT(ContactModel &c){ + contact = c; + material_prop_flag = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +double DMT::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + double Fne = contact.knfac * contact.delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne -= F_pulloff; + return Fne; +} + +void DMT::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); +} + +//****************** +// JKR +//****************** +void JKR::JKR(ContactModel &c){ + contact = c; + material_prop_flag = 1; + beyond_contact = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +bool JKR::touch(int touch){ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = contact.Reff * contact.Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = contact.radsum - delta_pulloff; + touchflag = (contact.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rcontact.sq < contact.radsum * contact.radsum); + } + return touchflag; +} + +double JKR::calculate_forces(){ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + return Fne; +} + +void JKR::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); +} + + + diff --git a/src/GRANULAR/rolling_contact_models.h b/src/GRANULAR/rolling_contact_models.h new file mode 100644 index 0000000000..1a2f1ddb7d --- /dev/null +++ b/src/GRANULAR/rolling_contact_models.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef NORMAL_CONTACT_MODELS_H_ +#define NORMAL_CONTACT_MODELS_H_ + +#include "contact.h"; +#include "sub_model.h" + +namespace Contact { + +class NormalModel:SubModel{ +public: + NormalModel(){}; + virtual ~NormalModel(){}; + virtual bool check_contact(); + virtual void prep_contact(); + virtual void set_fncrit(); + virtual double calculate_forces() = 0; + virtual void coeffs_to_local(); + virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed + +private: + int beyond_contact = 0; + int allow_limit_damping = 1; + +}; + +class Hooke:NormalModel{ +public: + Hooke(ContactModel &c); + ~Hooke(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp; +}; + +class Hertz:NormalModel{ +public: + Hertz(ContactModel&, int); + ~Hertz(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss; +}; + +class DMT:NormalModel{ +public: + DMT(ContactModel &c); + ~DMT(){}; + void coeffs_to_local(); + void coeffs_to_local(NormalModel*, NormalModel*); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; +}; + +class JKR:NormalModel{ +public: + JKR(ContactModel &c); + ~JKR(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; + +}; +} + +#endif /*NORMAL_CONTACT_MODELS_H_ */ + diff --git a/src/GRANULAR/sub_model.cpp b/src/GRANULAR/sub_model.cpp new file mode 100644 index 0000000000..e5ace9885e --- /dev/null +++ b/src/GRANULAR/sub_model.cpp @@ -0,0 +1,76 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- + + This class contains a series of tools for DEM contacts + Multiple models can be defined and used to calculate forces + and torques based on contact geometry +*/ +#include "sub_model.h" +#include "pointers.h" +#include "utils.h" +#include "error.h" +#include "comm.h" + +using namespace LAMMPS_NS; + +namespace Contact{ + +SubModel::SubModel(){ + allocated = 0; +} +SubModel::~SubModel(){ + if (allocated) delete [] coeffs; +} + +void SubModel::allocate_coeffs(){ + allocated = 1; + coeffs = new double[num_coeffs]; +} + +void SubModel::parse_coeffs(char **arg, int iarg){ + for (int i = 0; i < num_coeffs; i++){ + coeffs[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); + } + coeffs_to_local(); +} + +void SubModel::write_restart(FILE *fp){ + fwrite(&model_name.length(),sizeof(int),1,fp); + fwrite(model_name.data(),sizeof(char),model_name.length(),fp); + fwrite(&num_coeffs,sizeof(int),1,fp); + fwrite(coeffs,sizeof(int),num_coeffs,fp); +} + +void SubModel::read_restart(FILE *fp, int num_char){ + if (comm->me == 0){ + utils::sfread(FLERR,&num_coeffs,sizeof(int),1,fp,nullptr,error); + } + MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); + allocate_coeffs(); +} + +void SubModel::read_restart(FILE *fp){ + int num_char; + if (me == 0){ + utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); + } + MPI_BCast(&num_char, 1, MPI_INT, 0, world); + read_restart(fp, num_char); +} + + + + +} + diff --git a/src/GRANULAR/sub_model.h b/src/GRANULAR/sub_model.h new file mode 100644 index 0000000000..2d3261238b --- /dev/null +++ b/src/GRANULAR/sub_model.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GRANULAR_SUB_MODEL_H_ +#define GRANULAR_SUB_MODEL_H_ + +#include "contact.h" + +using namespace LAMMPS_NS; + +namespace Contact{ + +class SubModel : Pointers{ + SubModel(){}; + virtual ~SubModel(); +public: + int num_coeffs; + double *coeffs; + virtual double calculate_forces() = 0; + void read_restart(); + virtual void parse_coeffs(char **, int); + void write_restart(FILE*); + void read_restart(FILE*); + void read_restart(FILE*, int); + virtual void coeffs_to_local(); + void allocate_coeffs(); + std::string model_name; +private: + ContactModel &contact; + int allocated; + int material_prop_flag = 0; + int size_history; + +}; + +} + +#endif /* GRANULAR_SUB_MODEL_H_ */ diff --git a/src/GRANULAR/tangential_contact_models.cpp b/src/GRANULAR/tangential_contact_models.cpp new file mode 100644 index 0000000000..ff59ceabb7 --- /dev/null +++ b/src/GRANULAR/tangential_contact_models.cpp @@ -0,0 +1,168 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "tangential_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include + +using namespace MathConst; + +namespace Contact{ + +// ************************ +// Default behaviors where needed +// ************************ + +//----------------------------------------- + +//****************** +// Hooke +//****************** +void LinearNohistory::calculate_forces(){ + contact = c; + num_coeffs = 2; + allocate_coeffs(); +} + +void Hooke::coeffs_to_local(){ + k_norm = coeffs[0]; + damp = coeffs[1]; +} + +double Hooke::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = k_norm * contact.area; + return contact.knfac * contact.delta; +} + + +//****************** +// Hertz +//****************** +void Hertz::Hertz(ContactModel &c, int mat_flag){ + contact = c; + material_prop_flag = mat_flag; + if (material_prop_flag){ + num_coeffs = 3; + } + else{ + num_coeffs = 2; + } + allocate_coeffs(); +} + +void Hertz::coeffs_to_local(){ + if (material_prop_flag){ + Emod = coeffs[0]; + poiss = coeffs[1]; + k_norm = 4/3*Emod; + } + else{ + k_norm = coeffs[0]; + } +} + +double Hertz::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + return contact.knfac * contact.delta; +} + +//****************** +// DMT +//****************** +void DMT::DMT(ContactModel &c){ + contact = c; + material_prop_flag = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +double DMT::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + double Fne = contact.knfac * contact.delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne -= F_pulloff; + return Fne; +} + +void DMT::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); +} + +//****************** +// JKR +//****************** +void JKR::JKR(ContactModel &c){ + contact = c; + material_prop_flag = 1; + beyond_contact = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +bool JKR::touch(int touch){ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = contact.Reff * contact.Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = contact.radsum - delta_pulloff; + touchflag = (contact.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rcontact.sq < contact.radsum * contact.radsum); + } + return touchflag; +} + +double JKR::calculate_forces(){ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + return Fne; +} + +void JKR::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); +} + + + diff --git a/src/GRANULAR/tangential_contact_models.h b/src/GRANULAR/tangential_contact_models.h new file mode 100644 index 0000000000..207d129e7c --- /dev/null +++ b/src/GRANULAR/tangential_contact_models.h @@ -0,0 +1,79 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef TANGENTIAL_CONTACT_MODELS_H_ +#define TANGENTIAL_CONTACT_MODELS_H_ + +#include "contact.h"; +#include "sub_model.h" + +namespace Contact { + +class TangentialModel:SubModel{ +public: + TangentialModel(){}; + virtual ~TangentialModel(){}; + virtual double calculate_forces() = 0; + virtual void coeffs_to_local(); + virtual void mix_coeffs(TangentialModel*, TangentialModel*); //When mixing is needed + int rescale_flag = 0; +private: + int beyond_contact = 0; + int allow_limit_damping = 1; + +}; + +class LinearNohistory:TangentialModel{ +public: + double calculate_forces(); +private: + void allocate_coeffs(); + double k_t, damp; +}; + +class LinearHistory:TangentialModel{ +public: + LinearHistory(){} + ~LinearHistory(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss; +}; + +class Mindlin:TangentialModel{ +public: + Mindlin(int); + ~Mindlin(){}; + void coeffs_to_local(); + void coeffs_to_local(TangentialModel*, TangentialModel*); + double calculate_forces(); +private: + + double k_norm, damp, Emod, poiss, coh; +}; + +class MindlinForce:TangentialModel{ +public: + JKR(ContactModel &c); + ~JKR(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; + +}; +} + +#endif /*TANGENTIAL_CONTACT_MODELS_H_ */ + diff --git a/src/GRANULAR/twisting_contact_models.cpp b/src/GRANULAR/twisting_contact_models.cpp new file mode 100644 index 0000000000..e6bafe4b3c --- /dev/null +++ b/src/GRANULAR/twisting_contact_models.cpp @@ -0,0 +1,185 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "normal_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include + +using namespace MathConst; + +namespace Contact{ + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define ONETHIRD (1.0/3.0) // 1/3 +#define THREEQUARTERS 0.75 // 3/4 + +// ************************ +// Default behaviors where needed +// ************************ +void NormalModel::set_fncrit(){ + contact->Fncrit = fabs(contact->Fntot); +} + +void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ + for (int i = 0; i < num_coeffs; i++){ + coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); + } +} + +//----------------------------------------- + +//****************** +// Hooke +//****************** +void Hooke::Hooke(ContactModel &c){ + contact = c; + num_coeffs = 2; + allocate_coeffs(); +} + +void Hooke::coeffs_to_local(){ + k_norm = coeffs[0]; + damp = coeffs[1]; +} + +double Hooke::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = k_norm * contact.area; + return contact.knfac * contact.delta; +} + + +//****************** +// Hertz +//****************** +void Hertz::Hertz(ContactModel &c, int mat_flag){ + contact = c; + material_prop_flag = mat_flag; + if (material_prop_flag){ + num_coeffs = 3; + } + else{ + num_coeffs = 2; + } + allocate_coeffs(); +} + +void Hertz::coeffs_to_local(){ + if (material_prop_flag){ + Emod = coeffs[0]; + poiss = coeffs[1]; + k_norm = 4/3*Emod; + } + else{ + k_norm = coeffs[0]; + } +} + +double Hertz::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + return contact.knfac * contact.delta; +} + +//****************** +// DMT +//****************** +void DMT::DMT(ContactModel &c){ + contact = c; + material_prop_flag = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +double DMT::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + double Fne = contact.knfac * contact.delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne -= F_pulloff; + return Fne; +} + +void DMT::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); +} + +//****************** +// JKR +//****************** +void JKR::JKR(ContactModel &c){ + contact = c; + material_prop_flag = 1; + beyond_contact = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +bool JKR::touch(int touch){ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = contact.Reff * contact.Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = contact.radsum - delta_pulloff; + touchflag = (contact.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rcontact.sq < contact.radsum * contact.radsum); + } + return touchflag; +} + +double JKR::calculate_forces(){ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + return Fne; +} + +void JKR::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); +} + + + diff --git a/src/GRANULAR/twisting_contact_models.h b/src/GRANULAR/twisting_contact_models.h new file mode 100644 index 0000000000..1a2f1ddb7d --- /dev/null +++ b/src/GRANULAR/twisting_contact_models.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef NORMAL_CONTACT_MODELS_H_ +#define NORMAL_CONTACT_MODELS_H_ + +#include "contact.h"; +#include "sub_model.h" + +namespace Contact { + +class NormalModel:SubModel{ +public: + NormalModel(){}; + virtual ~NormalModel(){}; + virtual bool check_contact(); + virtual void prep_contact(); + virtual void set_fncrit(); + virtual double calculate_forces() = 0; + virtual void coeffs_to_local(); + virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed + +private: + int beyond_contact = 0; + int allow_limit_damping = 1; + +}; + +class Hooke:NormalModel{ +public: + Hooke(ContactModel &c); + ~Hooke(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp; +}; + +class Hertz:NormalModel{ +public: + Hertz(ContactModel&, int); + ~Hertz(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss; +}; + +class DMT:NormalModel{ +public: + DMT(ContactModel &c); + ~DMT(){}; + void coeffs_to_local(); + void coeffs_to_local(NormalModel*, NormalModel*); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; +}; + +class JKR:NormalModel{ +public: + JKR(ContactModel &c); + ~JKR(){}; + void coeffs_to_local(); + double calculate_forces(); +private: + double k_norm, damp, Emod, poiss, coh; + +}; +} + +#endif /*NORMAL_CONTACT_MODELS_H_ */ + From 6a1a06d76cd93dfe49caca16f708a3ddc0d620ed Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 15 Jul 2022 12:30:30 -0600 Subject: [PATCH 12/57] Take 2 --- src/.gitignore | 14 + src/GRANULAR/contact.cpp | 461 ++++-------------- src/GRANULAR/contact.h | 42 +- ..._models.cpp => contact_damping_models.cpp} | 0 ...tact_models.h => contact_damping_models.h} | 0 ...eat_models.cpp => contact_heat_models.cpp} | 0 .../{heat_models.h => contact_heat_models.h} | 0 ...t_models.cpp => contact_normal_models.cpp} | 108 ++-- ...ntact_models.h => contact_normal_models.h} | 1 + ..._models.cpp => contact_rolling_models.cpp} | 64 +++ ...tact_models.h => contact_rolling_models.h} | 0 .../{sub_model.cpp => contact_sub_models.cpp} | 29 +- .../{sub_model.h => contact_sub_models.h} | 5 +- src/GRANULAR/contact_tangential_models.cpp | 324 ++++++++++++ ...t_models.h => contact_tangential_models.h} | 0 ...models.cpp => contact_twisting_models.cpp} | 31 ++ ...act_models.h => contact_twisting_models.h} | 0 src/GRANULAR/pair_granular.cpp | 397 +++++++-------- src/GRANULAR/pair_granular.h | 5 +- src/GRANULAR/tangential_contact_models.cpp | 168 ------- 20 files changed, 817 insertions(+), 832 deletions(-) rename src/GRANULAR/{damping_contact_models.cpp => contact_damping_models.cpp} (100%) rename src/GRANULAR/{damping_contact_models.h => contact_damping_models.h} (100%) rename src/GRANULAR/{heat_models.cpp => contact_heat_models.cpp} (100%) rename src/GRANULAR/{heat_models.h => contact_heat_models.h} (100%) rename src/GRANULAR/{normal_contact_models.cpp => contact_normal_models.cpp} (63%) rename src/GRANULAR/{normal_contact_models.h => contact_normal_models.h} (97%) rename src/GRANULAR/{twisting_contact_models.cpp => contact_rolling_models.cpp} (73%) rename src/GRANULAR/{rolling_contact_models.h => contact_rolling_models.h} (100%) rename src/GRANULAR/{sub_model.cpp => contact_sub_models.cpp} (80%) rename src/GRANULAR/{sub_model.h => contact_sub_models.h} (93%) create mode 100644 src/GRANULAR/contact_tangential_models.cpp rename src/GRANULAR/{tangential_contact_models.h => contact_tangential_models.h} (100%) rename src/GRANULAR/{rolling_contact_models.cpp => contact_twisting_models.cpp} (82%) rename src/GRANULAR/{twisting_contact_models.h => contact_twisting_models.h} (100%) delete mode 100644 src/GRANULAR/tangential_contact_models.cpp diff --git a/src/.gitignore b/src/.gitignore index a1aee630b5..07230a10b4 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1474,6 +1474,20 @@ /compute_xrd_consts.h /contact.cpp /contact.h +/contact_normal_models.cpp +/contact_normal_models.h +/contact_damping_models.cpp +/contact_damping_models.h +/contact_tangential_models.cpp +/contact_tangential_models.h +/contact_twisting_models.cpp +/contact_twisting_models.h +/contact_rolling_models.cpp +/contact_rolling_models.h +/contact_heat_models.cpp +/contact_heat_models.h +/contact_sub_models.cpp +/contact_sub_models.h /fix_atom_swap.cpp /fix_atom_swap.h /fix_ave_spatial_sphere.cpp diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 554a54eec9..693721fe22 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -32,9 +32,12 @@ using namespace MathConst; namespace Contact { +enum {NORMAL, TANGENTIAL, DAMPING, ROLLING, TWISTING, HEAT} + ContactModel::ContactModel() { limit_damping = 0; + beyond_contact = 0; cutoff_type = 0.0; normal_model = nullptr; tangential_model = nullptr; @@ -42,115 +45,114 @@ ContactModel::ContactModel() rolling_model = nullptr; twisting_model = nullptr; reset_contact(); + + sub_models = {nullptr}; } /* ---------------------------------------------------------------------- */ -void ContactModel::init_normal(char *model_name){ - if (strcmp(model_name, "hooke") == 0) normal_model = new Hooke(); - else if (strcmp(model_name, "hertz") == 0) normal_model = new Hertz(0); - else if (strcmp(model_name, "hertz/material") == 0) normal_model = new Hertz(1); - //... - else error->all(FLERR, "Normal model name not recognized"); - normal_model->model_name.assign(model_name); - normal_model->contact = *this; - normal_model->allocate_coeffs(); +void ContactModel::init_model(char *model_name, int model_type) +{ + if (model_type == NORMAL) { + if (strcmp(model_name, "hooke") == 0) normal_model = new Hooke(); + else if (strcmp(model_name, "hertz") == 0) normal_model = new Hertz(0); + else if (strcmp(model_name, "hertz/material") == 0) normal_model = new Hertz(1); + //... + else error->all(FLERR, "Normal model name not recognized"); + sub_models[model_type] = &normal_model; + + } else if (model_type == TANGENTIAL) { + if (strcmp(model_name, "linear") == 0) tangential_model = new LinearNoHistory(); + //... + else error->all(FLERR, "Tangential model name not recognized"); + sub_models[model_type] = &tangential_model; + + } else if (model_type == DAMPING) { + if (strcmp(model_name, "linear") == 0) damping_model = new LinearNoHistory(); + //... + else error->all(FLERR, "Damping model name not recognized"); + sub_models[model_type] = &damping_model; + + } else if (model_type == ROLLING) { + if (strcmp(model_name, "linear") == 0) rolling_model = new LinearNoHistory(); + //... + else error->all(FLERR, "Rolling model name not recognized"); + sub_models[model_type] = &rolling_model; + + } else if (model_type == TWISTING) { + if (strcmp(model_name, "linear") == 0) twisting_model = new LinearNoHistory(); + //... + else error->all(FLERR, "Twisting model name not recognized"); + sub_models[model_type] = &twisting_model; + + } else if (model_type == HEAT) { + if (strcmp(model_name, "linear") == 0) heat_model = new LinearNoHistory(); + //... + else error->all(FLERR, "Heat model name not recognized"); + sub_models[model_type] = &heat_model; + } + + sub_models[model_type]->model_name.assign(model_name); + sub_models[model_type]->contact = *this; + sub_models[model_type]->allocate_coeffs(); } /* ---------------------------------------------------------------------- */ -void ContactModel::init_damping(char *model_name){ - if (strcmp(model_name, "velocity") == 0) tangential_model = new Velocity(*this); - //... - else error->all(FLERR, "Damping model name not recognized"); - tangential_model->model_name.assign(model_name); - tangential_model->contact = *this; - tangential_model->allocate_coeffs(); + +void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) +{ + for (int i = 0; i < 5; i++) + sum_model[i]->mix_coeffs(c1->submodel[i], c2->submodel[i]); + + limit_damping = MAX(c1->limit_damping, c2->limit_damping); + cutoff_type = MAX(c1->cutoff_type, c2->cutoff_type); } /* ---------------------------------------------------------------------- */ -void ContactModel::init_tangential(char *model_name){ - if (strcmp(model_name, "linear") == 0) tangential_model = new LinearNohistory(*this); - //... - else error->all(FLERR, "Tangential model name not recognized"); - damping_model->model_name.assign(model_name); - damping_model->contact = *this; - damping_model->allocate_coeffs(); -} +void ContactModel::write_restart(FILE *fp) +{ + int num_char = -1; + + for (int i = 0; i < 5; i++) { + if (sub_models[i]) { + sub_models[i]->write_restart(fp); + } else { + fwrite(&num_char, sizeof(int), 1, fp); + } + } +} /* ---------------------------------------------------------------------- */ -// .... same for rolling, twisting - -void ContactModel::write_restart(FILE *fp){ - normal_model->write_restart(fp); - tangential_model->write_restart(fp); - damping_model->write_restart(fp); - if (rolling_model){ - rolling_model->write_restart(fp); - } - else{ - int num_char = -1; - fwrite(&num_char, sizeof(int), 1, fp); - } - if (twisting_model){ - twisting_model->write_restart(fp); - } - else{ - int num_char = -1; - fwrite(&num_char, sizeof(int), 1, fp); - } -} - -void ContactModel::read_restart(FILE *fp){ +void ContactModel::read_restart(FILE *fp) +{ int num_char; - //Normal model - if (comm->me == 0){ - utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); - } - MPI_BCast(&num_char, 1, MPI_INT, 0, world); - std::string model_name(num_char); - if (comm->me == 0){ - utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr,error); - } - MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); - init_normal(const_cast(model_name.data())); - normal_model->read_restart(); - //Tangential model - if (comm->me == 0){ - utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); - } - MPI_BCast(&num_char, 1, MPI_INT, 0, world); - std::string model_name(num_char); - if (comm->me == 0){ - utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr,error); - } - init_tangential(const_cast(model_name.data())); - tangential_model->read_restart(); + for (int i = 0; i < 5; i++) { + if (comm->me == 0) + utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); + MPI_BCast(&num_char, 1, MPI_INT, 0, world); - //Damping - if (comm->me == 0){ - utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); - } - MPI_BCast(&num_char, 1, MPI_INT, 0, world); - std::string model_name(num_char); - if (comm->me == 0){ - utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr,error); - } - init_tangential(const_cast(model_name.data())); - damping_model->read_restart(); - - //Optional (rolling, twisting) - only if num_char is > 0. + if (num_char != -1) { + std::string model_name(num_char); + if (comm->me == 0) + utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr, error); + MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); + init_model(const_cast(model_name.data(), i)); + sub_models[i]->read_restart(); + } + } } /* ---------------------------------------------------------------------- */ void ContactModel::reset_contact() { - radi = radj = 0.0; + radi = radj = Fntot = Fncrit = magtortwist = 0.0; xi = xj = vi = vj = omegai = omegaj = nullptr; + forces = torquesi = torquesj = history = nullptr; prep_flag = check_flag = 0; touch = false; @@ -165,10 +167,10 @@ bool ContactModel::check_contact() sub3(xi, xj, dx); rsq = lensq3(dx); radsum = radi + radj; - Reff = radi*radj/radsum; + Reff = radi * radj / radsum; touch = false; - if (normal_model->beyond_contact) normal_model->touch(touch); + if (normal_model.beyond_contact) normal_model.touch(touch); else touch = (rsq < radsum*radsum); return touch; @@ -213,7 +215,7 @@ void ContactModel::prep_contact() if (roll_model || twist_model) sub3(omegai, omegaj, relrot); - if (roll_model) { + if (rolling_model) { // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) // this is different from the Marshall papers, which use the Bagi/Kuhn formulation // for rolling velocity (see Wang et al for why the latter is wrong) @@ -222,7 +224,7 @@ void ContactModel::prep_contact() vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); } - if (twist_model) { + if (twisting_model) { // omega_T (eq 29 of Marshall) magtwist = dot3(relrot, nx); } @@ -244,16 +246,16 @@ void ContactModel::calculate_forces() //********************************************** double Fne, Fdamp; - Fne = normal_model->calculate_forces(); - Fdamp = damping_model->calculate_forces(); + Fne = normal_model.calculate_forces(); + Fdamp = damping_model.calculate_forces(); Fntot = Fne + Fdamp; if (limit_damping && Fntot < 0.0) Fntot = 0.0; - normal_model->set_fncrit(); + normal_model.set_fncrit(); - tangential_model->calculate_forces(); - if (roll_model) roll_model->calculate_forces(); - if (twist_model) twist_model->calculate_forces(); + tangential_model.calculate_forces(); + if (rolling_model) rolling_model.calculate_forces(); + if (twisting_model) twisting_model.calculate_forces(); //********************************************** // sum contributions @@ -272,7 +274,7 @@ void ContactModel::calculate_forces() scale3(dist_to_contact, torquesj); double torroll[3]; - if (roll_model) { + if (rolling_model) { cross3(nx, fr, torroll); scale3(Reff, torroll); add3(torquesi, torroll, torquesi); @@ -280,7 +282,7 @@ void ContactModel::calculate_forces() } double tortwist[3]; - if (twist_model) { + if (twisting_model) { scale3(magtortwist, nx, tortwist); add3(torquesi, tortwist, torquesi); sub3(torquesj, tortwist, torquesj); @@ -291,262 +293,7 @@ void ContactModel::calculate_forces() double ContactModel::calculate_heat() { - double dT = Ti - Tj; - return conductivity * a * dT; -} - -/* ---------------------------------------------------------------------- */ - - - -/* ---------------------------------------------------------------------- */ - -void ContactModel::tangential_no_history() -{ - double gamma_scaled = gamma_tang * damp_normal_prefactor; - double fsmag, Ft; - - // classic pair gran/hooke (no history) - fsmag = gamma_scaled * vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fsmag) / vrel; - else Ft = 0.0; - - Ft = -Ft; - scale3(Ft, vtr, fs); -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::tangential_history(double *history) -{ - double gamma_scaled = gamma_tang * damp_normal_prefactor; - double k = k_tang; - int frame_update = 0; - double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; - - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = dot3(history, nx); - frame_update = fabs(rsht) * k > EPSILON * Fscrit; - - if (frame_update) { - shrmag = len3(history); - // projection - scale3(rsht, nx, history); - // also rescale to preserve magnitude - prjmag = len3(history); - if (prjmag > 0) temp_dbl = shrmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, history); - } - - // update history - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = k * dt; - scale3(temp_dbl, vtr, temp_array); - sub3(history, temp_array, history); - } - - // tangential forces = history + tangential velocity damping - temp_dbl = -gamma_norm; - scale3(temp_dbl, vtr, fs); - - // rescale frictional displacements and forces if needed - magfs = len3(fs); - if (magfs > Fscrit) { - shrmag = len3(history); - if (shrmag != 0.0) { - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs, history); - scale3(gamma_norm, vtr, temp_array); - add3(history, temp_array, history); - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs); - } else { - zero3(fs); - } - } -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::tangential_mindlin(double *history) -{ - double k_scaled, gamma_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; - double temp_array[3]; - int frame_update = 0; - - gamma_scaled = gamma_tang * damp_normal_prefactor; - k_scaled = k_tang * a; - if (mindlin_rescale) { - // on unloading, rescale the shear displacements/force - if (a < history[3]) { - temp_dbl = a / history[3]; - scale3(temp_dbl, history); - } - } - - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = dot3(history, nx); - if (mindlin_force) - frame_update = fabs(rsht) > EPSILON * Fscrit; - else - frame_update = fabs(rsht) * k_scaled > EPSILON * Fscrit; - - if (frame_update) { - shrmag = len3(history); - // projection - scale3(rsht, nx, history); - // also rescale to preserve magnitude - prjmag = len3(history); - if (prjmag > 0) temp_dbl = shrmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, history); - } - - // update history - if (mindlin_force) { - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = -k_scaled * dt; - scale3(temp_dbl, vtr, temp_array); - } else { - scale3(dt, vtr, temp_array); - } - add3(history, temp_array, history); - - if (mindlin_rescale) history[3] = a; - } - - // tangential forces = history + tangential velocity damping - temp_dbl = -gamma_scaled; - scale3(temp_dbl, vtr, fs); - - if (! mindlin_force) { - scale3(k_scaled, history, temp_array); - add3(fs, temp_array, fs); - } - - // rescale frictional displacements and forces if needed - magfs = len3(fs); - if (magfs > Fscrit) { - shrmag = len3(history); - if (shrmag != 0.0) { - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs, history); - scale3(gamma_tang, vtr, temp_array); - add3(history, temp_array, history); - if (! mindlin_force) { - temp_dbl = -1.0 / k_tang; - scale3(temp_dbl, history); - } - temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs); - } else { - zero3(fs); - } - } -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::rolling(double *history) -{ - int rhist0, rhist1, rhist2, frameupdate; - double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; - - rhist0 = roll_history_index; - rhist1 = rhist0 + 1; - rhist2 = rhist1 + 1; - - Frcrit = mu_roll * Fncrit; - - if (history_update) { - hist_temp[0] = history[rhist0]; - hist_temp[1] = history[rhist1]; - hist_temp[2] = history[rhist2]; - rolldotn = dot3(hist_temp, nx); - - frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; - if (frameupdate) { // rotate into tangential plane - rollmag = len3(hist_temp); - // projection - temp_dbl = -rolldotn; - scale3(temp_dbl, nx, temp_array); - sub3(hist_temp, temp_array, hist_temp); - - // also rescale to preserve magnitude - prjmag = len3(hist_temp); - if (prjmag > 0) temp_dbl = rollmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, hist_temp); - } - scale3(dt, vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - } - - scaleadd3(k_roll, hist_temp, gamma_roll, vrl, fr); - negate3(fr); - - // rescale frictional displacements and forces if needed - - magfr = len3(fr); - if (magfr > Frcrit) { - rollmag = len3(hist_temp); - if (rollmag != 0.0) { - temp_dbl = -Frcrit / (magfr * k_roll); - scale3(temp_dbl, fr, temp_array); - add3(hist_temp, temp_array, hist_temp); - - temp_dbl = -gamma_roll/k_roll; - scale3(temp_dbl, vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - - temp_dbl = Frcrit / magfr; - scale3(temp_dbl, fr); - } else { - zero3(fr); - } - } - - history[rhist0] = hist_temp[0]; - history[rhist1] = hist_temp[1]; - history[rhist2] = hist_temp[2]; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::twisting_marshall(double *history) -{ - // Overwrite twist coefficients with derived values - k_twist = 0.5 * k_tang * a * a; // eq 32 of Marshall paper - gamma_twist = 0.5 * gamma_tang * a * a; - mu_twist = TWOTHIRDS * a * mu_tang; - - twisting_SDS(history); -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::twisting_SDS(double *history) -{ - double signtwist, Mtcrit; - - if (history_update) { - history[twist_history_index] += magtwist * dt; - } - - magtortwist = -k_twist * history[twist_history_index] - gamma_twist*magtwist; // M_t torque (eq 30) - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - history[twist_history_index] = (Mtcrit * signtwist - gamma_twist * magtwist) / k_twist; - magtortwist = -Mtcrit * signtwist; // eq 34 - } + return heat_model.calculate_heat(); } /* ---------------------------------------------------------------------- @@ -556,15 +303,7 @@ void ContactModel::twisting_SDS(double *history) double ContactModel::pulloff_distance(double radi, double radj) { - double Ecaled, a_tmp, Reff_tmp; - - if (normal_model != JKR) return radi+radj; - - Reff_tmp = radi * radj / (radi + radj); - if (Reff_tmp <= 0) return 0; - Ecaled = k_norm * THREEQUARTERS; - a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); - return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); + return normal_model.pulloff_distance(radi, radj); } } diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index cb6d1865af..8883ecb08e 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -39,36 +39,35 @@ public: double calculate_heat(); double pulloff_distance(double, double); - void init_normal(char*); - void init_tangential(char*); - void init_damping(char*); - void init_rolling(char*); - void init_twisting(char*); - void init_heat(char*); + void init_model(char*, int); + + void mix_coeffs(ContactModel*, ContactModel*); void write_restart(FILE *); void read_restart(FILE *); - NormalModel *normal_model; - DampingModel *damping_model; //Classes below need .h and .cpp files analogous to normal_contact_models.h/.cpp - TangentialModel *tangential_model; - RollingModel *rolling_model; - TwistingModel *twisting_model; - HeatModel *heat_model; + // Sub models + NormalModel normal_model; + DampingModel damping_model; + TangentialModel tangential_model; + RollingModel rolling_model; + TwistingModel twisting_model; + HeatModel heat_model; + SubModel *sub_models[6]; // Need to resize if we add more model flavors - double *forces; - double *torquesi; - double *torquesj; + // Extra options + int beyond_contact, limit_damping; + double cutoff_type; + + // Contact properties/output + double *forces, *torquesi, *torquesj; double *history; - int limit_damping; - - double radi, radj, meff, dt, Ti, Tj; - double area; + double radi, radj, meff, dt, Ti, Tj, area; + double Fntot, Fncrit, magtortwist; double *xi, *xj, *vi, *vj, *omegai, *omegaj; - double Fntot, Fncrit; - double fs[3], fr[3], ft[3], magtortwist; + double fs[3], fr[3], ft[3]; private: double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; @@ -77,7 +76,6 @@ private: bool touch; int prep_flag, check_flag; - int mindlin_rescale, mindlin_force; }; } // namespace Contact diff --git a/src/GRANULAR/damping_contact_models.cpp b/src/GRANULAR/contact_damping_models.cpp similarity index 100% rename from src/GRANULAR/damping_contact_models.cpp rename to src/GRANULAR/contact_damping_models.cpp diff --git a/src/GRANULAR/damping_contact_models.h b/src/GRANULAR/contact_damping_models.h similarity index 100% rename from src/GRANULAR/damping_contact_models.h rename to src/GRANULAR/contact_damping_models.h diff --git a/src/GRANULAR/heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp similarity index 100% rename from src/GRANULAR/heat_models.cpp rename to src/GRANULAR/contact_heat_models.cpp diff --git a/src/GRANULAR/heat_models.h b/src/GRANULAR/contact_heat_models.h similarity index 100% rename from src/GRANULAR/heat_models.h rename to src/GRANULAR/contact_heat_models.h diff --git a/src/GRANULAR/normal_contact_models.cpp b/src/GRANULAR/contact_normal_models.cpp similarity index 63% rename from src/GRANULAR/normal_contact_models.cpp rename to src/GRANULAR/contact_normal_models.cpp index cc01a3ddb2..e17798ca25 100644 --- a/src/GRANULAR/normal_contact_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "normal_contact_models.h" +#include "contact_normal_models.h" #include "math_const.h" #include "contact.h" @@ -32,32 +32,42 @@ namespace Contact{ // ************************ // Default behaviors where needed // ************************ -void NormalModel::set_fncrit(){ +void NormalModel::set_fncrit() +{ contact->Fncrit = fabs(contact->Fntot); } -void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ - for (int i = 0; i < num_coeffs; i++){ +void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + for (int i = 0; i < num_coeffs; i++) { coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); } } +void NormalModel::pulloff_distance(double radi, double radj) +{ + return radi + radj; +} + //----------------------------------------- //****************** // Hooke //****************** -void Hooke::Hooke(ContactModel &c){ +void Hooke::Hooke(ContactModel &c) +{ num_coeffs = 2; allocate_coeffs(); } -void Hooke::coeffs_to_local(){ +void Hooke::coeffs_to_local() +{ k_norm = coeffs[0]; damp = coeffs[1]; } -double Hooke::calculate_forces(){ +double Hooke::calculate_forces() +{ contact.area = sqrt(contact.dR); contact.knfac = k_norm * contact.area; return contact.knfac * contact.delta; @@ -67,7 +77,8 @@ double Hooke::calculate_forces(){ //****************** // Hertz //****************** -void Hertz::Hertz(ContactModel &c, int mat_flag){ +void Hertz::Hertz(ContactModel &c, int mat_flag) +{ material_prop_flag = mat_flag; if (material_prop_flag){ num_coeffs = 3; @@ -77,7 +88,8 @@ void Hertz::Hertz(ContactModel &c, int mat_flag){ } } -void Hertz::coeffs_to_local(){ +void Hertz::coeffs_to_local() +{ if (material_prop_flag){ Emod = coeffs[0]; poiss = coeffs[1]; @@ -88,7 +100,8 @@ void Hertz::coeffs_to_local(){ } } -double Hertz::calculate_forces(){ +double Hertz::calculate_forces() +{ contact.area = sqrt(contact.dR); contact.knfac = contact.k_norm * contact.area; return contact.knfac * contact.delta; @@ -97,12 +110,14 @@ double Hertz::calculate_forces(){ //****************** // DMT //****************** -void DMT::DMT(ContactModel &c){ +void DMT::DMT(ContactModel &c) +{ material_prop_flag = 1; num_coeffs = 4; } -double DMT::calculate_forces(){ +double DMT::calculate_forces() +{ contact.area = sqrt(contact.dR); contact.knfac = contact.k_norm * contact.area; double Fne = contact.knfac * contact.delta; @@ -111,20 +126,23 @@ double DMT::calculate_forces(){ return Fne; } -void DMT::set_fncrit(){ +void DMT::set_fncrit() +{ contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); } //****************** // JKR //****************** -void JKR::JKR(ContactModel &c){ +void JKR::JKR(ContactModel &c) +{ material_prop_flag = 1; - beyond_contact = 1; + contact.beyond_contact = beyond_contact = 1; num_coeffs = 4; } -bool JKR::touch(int touch){ +bool JKR::touch(int touch) +{ double Escaled, R2, delta_pulloff, dist_pulloff; bool touchflag; @@ -141,38 +159,50 @@ bool JKR::touch(int touch){ return touchflag; } -double JKR::calculate_forces(){ +double JKR::calculate_forces() +{ double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - Escaled = k_norm * THREEQUARTERS; + Escaled = k_norm * THREEQUARTERS; - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; - knfac = Escaled * a; - return Fne; + knfac = Escaled * a; + return Fne; } -void JKR::set_fncrit(){ +void JKR::set_fncrit() +{ contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); } +void JKR::pulloff_distance(double radi, double radj) +{ + double Ecaled, a_tmp, Reff_tmp; + Reff_tmp = radi * radj / (radi + radj); + if (Reff_tmp <= 0) return 0; + + Ecaled = k_norm * THREEQUARTERS; + a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); + return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); +} diff --git a/src/GRANULAR/normal_contact_models.h b/src/GRANULAR/contact_normal_models.h similarity index 97% rename from src/GRANULAR/normal_contact_models.h rename to src/GRANULAR/contact_normal_models.h index 198e4bcb59..7d54fc942b 100644 --- a/src/GRANULAR/normal_contact_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -29,6 +29,7 @@ public: virtual double calculate_forces() = 0; virtual void coeffs_to_local(); virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed + void pulloff_distance(double, double); private: int size_history = 0; diff --git a/src/GRANULAR/twisting_contact_models.cpp b/src/GRANULAR/contact_rolling_models.cpp similarity index 73% rename from src/GRANULAR/twisting_contact_models.cpp rename to src/GRANULAR/contact_rolling_models.cpp index e6bafe4b3c..5521e10aee 100644 --- a/src/GRANULAR/twisting_contact_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -183,3 +183,67 @@ void JKR::set_fncrit(){ + +void ContactModel::rolling(double *history) +{ + int rhist0, rhist1, rhist2, frameupdate; + double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; + + rhist0 = roll_history_index; + rhist1 = rhist0 + 1; + rhist2 = rhist1 + 1; + + Frcrit = mu_roll * Fncrit; + + if (history_update) { + hist_temp[0] = history[rhist0]; + hist_temp[1] = history[rhist1]; + hist_temp[2] = history[rhist2]; + rolldotn = dot3(hist_temp, nx); + + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; + if (frameupdate) { // rotate into tangential plane + rollmag = len3(hist_temp); + // projection + temp_dbl = -rolldotn; + scale3(temp_dbl, nx, temp_array); + sub3(hist_temp, temp_array, hist_temp); + + // also rescale to preserve magnitude + prjmag = len3(hist_temp); + if (prjmag > 0) temp_dbl = rollmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, hist_temp); + } + scale3(dt, vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); + } + + scaleadd3(k_roll, hist_temp, gamma_roll, vrl, fr); + negate3(fr); + + // rescale frictional displacements and forces if needed + + magfr = len3(fr); + if (magfr > Frcrit) { + rollmag = len3(hist_temp); + if (rollmag != 0.0) { + temp_dbl = -Frcrit / (magfr * k_roll); + scale3(temp_dbl, fr, temp_array); + add3(hist_temp, temp_array, hist_temp); + + temp_dbl = -gamma_roll/k_roll; + scale3(temp_dbl, vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); + + temp_dbl = Frcrit / magfr; + scale3(temp_dbl, fr); + } else { + zero3(fr); + } + } + + history[rhist0] = hist_temp[0]; + history[rhist1] = hist_temp[1]; + history[rhist2] = hist_temp[2]; +} diff --git a/src/GRANULAR/rolling_contact_models.h b/src/GRANULAR/contact_rolling_models.h similarity index 100% rename from src/GRANULAR/rolling_contact_models.h rename to src/GRANULAR/contact_rolling_models.h diff --git a/src/GRANULAR/sub_model.cpp b/src/GRANULAR/contact_sub_models.cpp similarity index 80% rename from src/GRANULAR/sub_model.cpp rename to src/GRANULAR/contact_sub_models.cpp index e5ace9885e..8802622c78 100644 --- a/src/GRANULAR/sub_model.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -16,7 +16,7 @@ Multiple models can be defined and used to calculate forces and torques based on contact geometry */ -#include "sub_model.h" +#include "contact_sub_model.h" #include "pointers.h" #include "utils.h" #include "error.h" @@ -26,33 +26,43 @@ using namespace LAMMPS_NS; namespace Contact{ -SubModel::SubModel(){ +SubModel::SubModel() +{ allocated = 0; + material_prop_flag = 0; + size_history = 0; + history_index = 0; } -SubModel::~SubModel(){ + +SubModel::~SubModel() +{ if (allocated) delete [] coeffs; } -void SubModel::allocate_coeffs(){ +void SubModel::allocate_coeffs() +{ allocated = 1; coeffs = new double[num_coeffs]; } -void SubModel::parse_coeffs(char **arg, int iarg){ - for (int i = 0; i < num_coeffs; i++){ +void SubModel::parse_coeffs(char **arg, int iarg) +{ + for (int i = 0; i < num_coeffs; i++) { coeffs[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); } coeffs_to_local(); } -void SubModel::write_restart(FILE *fp){ +void SubModel::write_restart(FILE *fp) +{ fwrite(&model_name.length(),sizeof(int),1,fp); fwrite(model_name.data(),sizeof(char),model_name.length(),fp); fwrite(&num_coeffs,sizeof(int),1,fp); fwrite(coeffs,sizeof(int),num_coeffs,fp); } -void SubModel::read_restart(FILE *fp, int num_char){ +void SubModel::read_restart(FILE *fp, int num_char) +{ if (comm->me == 0){ utils::sfread(FLERR,&num_coeffs,sizeof(int),1,fp,nullptr,error); } @@ -60,7 +70,8 @@ void SubModel::read_restart(FILE *fp, int num_char){ allocate_coeffs(); } -void SubModel::read_restart(FILE *fp){ +void SubModel::read_restart(FILE *fp) +{ int num_char; if (me == 0){ utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); diff --git a/src/GRANULAR/sub_model.h b/src/GRANULAR/contact_sub_models.h similarity index 93% rename from src/GRANULAR/sub_model.h rename to src/GRANULAR/contact_sub_models.h index 2d3261238b..771f0f0890 100644 --- a/src/GRANULAR/sub_model.h +++ b/src/GRANULAR/contact_sub_models.h @@ -29,6 +29,7 @@ public: virtual double calculate_forces() = 0; void read_restart(); virtual void parse_coeffs(char **, int); + void mix_coeff(SubModel*, SubModel*); void write_restart(FILE*); void read_restart(FILE*); void read_restart(FILE*, int); @@ -38,9 +39,9 @@ public: private: ContactModel &contact; int allocated; - int material_prop_flag = 0; + int material_prop_flag; int size_history; - + int history_index; }; } diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp new file mode 100644 index 0000000000..1ceb940111 --- /dev/null +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -0,0 +1,324 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "tangential_contact_models.h" +#include "math_const.h" +#include "contact.h" + +#include + +using namespace MathConst; + +namespace Contact{ + +// ************************ +// Default behaviors where needed +// ************************ + +//----------------------------------------- + +//****************** +// Hooke +//****************** +void LinearNohistory::calculate_forces(){ + contact = c; + num_coeffs = 2; + allocate_coeffs(); +} + +void Hooke::coeffs_to_local(){ + k_norm = coeffs[0]; + damp = coeffs[1]; +} + +double Hooke::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = k_norm * contact.area; + return contact.knfac * contact.delta; +} + + +//****************** +// Hertz +//****************** +void Hertz::Hertz(ContactModel &c, int mat_flag){ + contact = c; + material_prop_flag = mat_flag; + if (material_prop_flag){ + num_coeffs = 3; + } + else{ + num_coeffs = 2; + } + allocate_coeffs(); +} + +void Hertz::coeffs_to_local(){ + if (material_prop_flag){ + Emod = coeffs[0]; + poiss = coeffs[1]; + k_norm = 4/3*Emod; + } + else{ + k_norm = coeffs[0]; + } +} + +double Hertz::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + return contact.knfac * contact.delta; +} + +//****************** +// DMT +//****************** +void DMT::DMT(ContactModel &c){ + contact = c; + material_prop_flag = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +double DMT::calculate_forces(){ + contact.area = sqrt(contact.dR); + contact.knfac = contact.k_norm * contact.area; + double Fne = contact.knfac * contact.delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne -= F_pulloff; + return Fne; +} + +void DMT::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); +} + +//****************** +// JKR +//****************** +void JKR::JKR(ContactModel &c){ + contact = c; + material_prop_flag = 1; + beyond_contact = 1; + num_coeffs = 4; + allocate_coeffs(); +} + +bool JKR::touch(int touch){ + double Escaled, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + Escaled = k_norm * THREEQUARTERS; + if (touch) { + R2 = contact.Reff * contact.Reff; + a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); + dist_pulloff = contact.radsum - delta_pulloff; + touchflag = (contact.rsq < dist_pulloff * dist_pulloff); + } else { + touchflag = (rcontact.sq < contact.radsum * contact.radsum); + } + return touchflag; +} + +double JKR::calculate_forces(){ + double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; + + Escaled = k_norm * THREEQUARTERS; + + R2 = Reff * Reff; + dR2 = dR * dR; + t0 = cohesion * cohesion * R2 * R2 * Escaled; + t1 = PI27SQ*t0; + t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4 * dR2 * Escaled; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Escaled; + sqrt2 = MAX(0, 2 * dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + a = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = a * a; + Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + F_pulloff = 3 * MY_PI * cohesion * Reff; + + knfac = Escaled * a; + return Fne; +} + +void JKR::set_fncrit(){ + contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); +} + + + + + +/* ---------------------------------------------------------------------- */ + +void ContactModel::tangential_no_history() +{ + double gamma_scaled = gamma_tang * damp_normal_prefactor; + double fsmag, Ft; + + // classic pair gran/hooke (no history) + fsmag = gamma_scaled * vrel; + if (vrel != 0.0) Ft = MIN(Fscrit,fsmag) / vrel; + else Ft = 0.0; + + Ft = -Ft; + scale3(Ft, vtr, fs); +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::tangential_history(double *history) +{ + double gamma_scaled = gamma_tang * damp_normal_prefactor; + double k = k_tang; + int frame_update = 0; + double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (history_update) { + rsht = dot3(history, nx); + frame_update = fabs(rsht) * k > EPSILON * Fscrit; + + if (frame_update) { + shrmag = len3(history); + // projection + scale3(rsht, nx, history); + // also rescale to preserve magnitude + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); + } + + // update history + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + temp_dbl = k * dt; + scale3(temp_dbl, vtr, temp_array); + sub3(history, temp_array, history); + } + + // tangential forces = history + tangential velocity damping + temp_dbl = -gamma_norm; + scale3(temp_dbl, vtr, fs); + + // rescale frictional displacements and forces if needed + magfs = len3(fs); + if (magfs > Fscrit) { + shrmag = len3(history); + if (shrmag != 0.0) { + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs, history); + scale3(gamma_norm, vtr, temp_array); + add3(history, temp_array, history); + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs); + } else { + zero3(fs); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::tangential_mindlin(double *history) +{ + double k_scaled, gamma_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; + double temp_array[3]; + int frame_update = 0; + + gamma_scaled = gamma_tang * damp_normal_prefactor; + k_scaled = k_tang * a; + if (mindlin_rescale) { + // on unloading, rescale the shear displacements/force + if (a < history[3]) { + temp_dbl = a / history[3]; + scale3(temp_dbl, history); + } + } + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (history_update) { + rsht = dot3(history, nx); + if (mindlin_force) + frame_update = fabs(rsht) > EPSILON * Fscrit; + else + frame_update = fabs(rsht) * k_scaled > EPSILON * Fscrit; + + if (frame_update) { + shrmag = len3(history); + // projection + scale3(rsht, nx, history); + // also rescale to preserve magnitude + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); + } + + // update history + if (mindlin_force) { + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + temp_dbl = -k_scaled * dt; + scale3(temp_dbl, vtr, temp_array); + } else { + scale3(dt, vtr, temp_array); + } + add3(history, temp_array, history); + + if (mindlin_rescale) history[3] = a; + } + + // tangential forces = history + tangential velocity damping + temp_dbl = -gamma_scaled; + scale3(temp_dbl, vtr, fs); + + if (! mindlin_force) { + scale3(k_scaled, history, temp_array); + add3(fs, temp_array, fs); + } + + // rescale frictional displacements and forces if needed + magfs = len3(fs); + if (magfs > Fscrit) { + shrmag = len3(history); + if (shrmag != 0.0) { + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs, history); + scale3(gamma_tang, vtr, temp_array); + add3(history, temp_array, history); + if (! mindlin_force) { + temp_dbl = -1.0 / k_tang; + scale3(temp_dbl, history); + } + temp_dbl = Fscrit / magfs; + scale3(temp_dbl, fs); + } else { + zero3(fs); + } + } +} + +/* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/tangential_contact_models.h b/src/GRANULAR/contact_tangential_models.h similarity index 100% rename from src/GRANULAR/tangential_contact_models.h rename to src/GRANULAR/contact_tangential_models.h diff --git a/src/GRANULAR/rolling_contact_models.cpp b/src/GRANULAR/contact_twisting_models.cpp similarity index 82% rename from src/GRANULAR/rolling_contact_models.cpp rename to src/GRANULAR/contact_twisting_models.cpp index e6bafe4b3c..0e9e9115ac 100644 --- a/src/GRANULAR/rolling_contact_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -183,3 +183,34 @@ void JKR::set_fncrit(){ + +/* ---------------------------------------------------------------------- */ + +void ContactModel::twisting_marshall(double *history) +{ + // Overwrite twist coefficients with derived values + k_twist = 0.5 * k_tang * a * a; // eq 32 of Marshall paper + gamma_twist = 0.5 * gamma_tang * a * a; + mu_twist = TWOTHIRDS * a * mu_tang; + + twisting_SDS(history); +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::twisting_SDS(double *history) +{ + double signtwist, Mtcrit; + + if (history_update) { + history[twist_history_index] += magtwist * dt; + } + + magtortwist = -k_twist * history[twist_history_index] - gamma_twist*magtwist; // M_t torque (eq 30) + signtwist = (magtwist > 0) - (magtwist < 0); + Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) + if (fabs(magtortwist) > Mtcrit) { + history[twist_history_index] = (Mtcrit * signtwist - gamma_twist * magtwist) / k_twist; + magtortwist = -Mtcrit * signtwist; // eq 34 + } +} diff --git a/src/GRANULAR/twisting_contact_models.h b/src/GRANULAR/contact_twisting_models.h similarity index 100% rename from src/GRANULAR/twisting_contact_models.h rename to src/GRANULAR/contact_twisting_models.h diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 855ed36cf0..7378df2f77 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -198,13 +198,13 @@ void PairGranular::compute(int eflag, int vflag) jtype = type[j]; // Reset model and copy initial geometric data - models[itype][jtype].reset_contact(); - models[itype][jtype].xi = x[i]; - models[itype][jtype].xj = x[j]; - models[itype][jtype].radi = radius[i]; - models[itype][jtype].radj = radius[j]; + models[itype][jtype]->reset_contact(); + models[itype][jtype]->xi = x[i]; + models[itype][jtype]->xj = x[j]; + models[itype][jtype]->radi = radius[i]; + models[itype][jtype]->radj = radius[j]; - touchflag = models[itype][jtype].check_contact(); + touchflag = models[itype][jtype]->check_contact(); if (!touchflag) { // unset non-touching neighbors @@ -229,22 +229,21 @@ void PairGranular::compute(int eflag, int vflag) if (mask[j] & freeze_group_bit) meff = mi; // Copy additional information and prepare force calculations - models[itype][jtype].meff = meff; - models[itype][jtype].vi = v[i]; - models[itype][jtype].vj = v[j]; - models[itype][jtype].omegai = omega[i]; - models[itype][jtype].omegaj = omega[j]; - models[itype][jtype].history_update = historyupdate; - models[itype][jtype].history = history; - models[itype][jtype].prep_contact(); + models[itype][jtype]->meff = meff; + models[itype][jtype]->vi = v[i]; + models[itype][jtype]->vj = v[j]; + models[itype][jtype]->omegai = omega[i]; + models[itype][jtype]->omegaj = omega[j]; + models[itype][jtype]->history_update = historyupdate; + models[itype][jtype]->history = history; + models[itype][jtype]->prep_contact(); if (heat_flag) { - models[itype][jtype].Ti = temperature[i]; - models[itype][jtype].Tj = temperature[j]; + models[itype][jtype]->Ti = temperature[i]; + models[itype][jtype]->Tj = temperature[j]; } - - if (models[itype][jtype].normal_model == JKR) touch[jj] = 1; + if (models[itype][jtype]->beyond_contact) touch[jj] = 1; // if any history is needed if (use_history) { @@ -252,12 +251,12 @@ void PairGranular::compute(int eflag, int vflag) history = &allhistory[size_history*jj]; } - double *forces = models[itype][jtype].forces; - double *torquesi = models[itype][jtype].torquesi; - double *torquesj = models[itype][jtype].torquesj; + models[itype][jtype]->calculate_forces(); + if (heat_flag) dq = models[itype][jtype]->calculate_heat(); - models[itype][jtype].calculate_forces(); - if (heat_flag) dq = models[itype][jtype].calculate_heat(); + forces = models[itype][jtype]->forces; + torquesi = models[itype][jtype]->torquesi; + torquesj = models[itype][jtype]->torquesj; // apply forces & torques MathExtra::scale3(factor_lj, forces); @@ -302,9 +301,8 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - for (int i = 0; i < n+1; i++) { - models.push_back(std::vector (n+1)); - } + + models = (ContactModel **) memory->srealloc(fix, n+1,n+1, "pair:contact_models"); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -334,16 +332,8 @@ void PairGranular::settings(int narg, char **arg) void PairGranular::coeff(int narg, char **arg) { - int normal_model_one, damping_model_one; - int tangential_model_one, roll_model_one, twist_model_one; - - double normal_coeffs_one[4]; - double tangential_coeffs_one[4]; - double roll_coeffs_one[4]; - double twist_coeffs_one[4]; - - double conductivity_one; double cutoff_one = -1; + int ncoeff; if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients"); @@ -354,66 +344,97 @@ void PairGranular::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - //Here's one option for handing off parsing to the SubModel objects: - ContactModel model_one; + // Create new model stored in vector + vec_models.push_back(ContactModel()); //Parse mandatory normal and tangential specifications int iarg = 2; - model_one.init_normal(arg[iarg]); + vec_models.back().init(arg[iarg], Contact::NORMAL); + ncoeff = vec_models.back().normal_model.num_coeffs iarg += 1; - if (iarg + model_one.normal_model->num_coeffs >= narg) + if (iarg + ncoeff >= narg) error->all(FLERR,"Illegal pair_coeff command" - "Insufficient arguments provided."); - model_one.normal_model->parse_coeffs(arg, iarg); - iarg += model_one.normal_model->num_coeffs; + "Insufficient arguments provided for normal model."); + vec_models.back().normal_model.parse_coeffs(arg, iarg); + iarg += ncoeff; if (strcmp(arg[iarg], "tangential") == 0) { if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_coeff command, must specify " "tangential model after tangential keyword"); - model_one.init_tangential(arg[iarg]); + vec_models.back().init(arg[iarg], Contact::TANGENTIAL); + ncoeff = vec_models.back().tangential_model.num_coeffs; iarg += 1; - if (iarg + model_one.tangential_model->num_coeffs >= narg) + if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" - "Insufficient arguments provided."); - model_one.tangential_model->parse_coeffs(arg, iarg); - iarg += model_one.tangential_model->num_coeffs; - } - else{ + "Insufficient arguments provided for tangential model."); + vec_models.back().tangential_model.parse_coeffs(arg, iarg); + iarg += ncoeff; + } else{ error->all(FLERR, "Illegal pair_coeff command, 'tangential' keyword expected"); } + //Parse optional arguments while (iarg < narg) { if (strcmp(arg[iarg], "rolling") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - model_one.init_rolling(arg[iarg+1]); + vec_models.back().init(arg[iarg], Contact::ROLLING); + ncoeff = vec_models.back().rolling_model.num_coeffs; iarg += 1; - if (iarg + model_one.rolling_model->num_coeffs >= narg) + if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for rolling model."); - iarg += model_one.rolling_model->num_coeffs; - } - else if (strcmp(arg[iarg], "twisting") == 0) { - //... - } - else if (strcmp(arg[iarg], "cutoff") == 0) { - //.. - } else if (strcmp(arg[iarg], "limit_damping") == 0) { - //.. + vec_models.back().rolling_model.parse_coeffs(arg, iarg); + iarg += ncoeff; + + } else if (strcmp(arg[iarg], "twisting") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + vec_models.back().init(arg[iarg], Contact::TWISTING); + ncoeff = vec_models.back().twisting_model.num_coeffs; + iarg += 1; + if (iarg + ncoeff >= narg) + error->all(FLERR, "Illegal pair_coeff command" + "Insufficient arguments provided for twisting model."); + vec_models.back().twisting_model.parse_coeffs(arg, iarg); + iarg += ncoeff; + } else if (strcmp(arg[iarg], "heat") == 0) { - //.. + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + vec_models.back().init(arg[iarg], Contact::HEAT); + ncoeff = vec_models.back().heat_model.num_coeffs; + iarg += 1; + if (iarg + ncoeff >= narg) + error->all(FLERR, "Illegal pair_coeff command" + "Insufficient arguments provided for heat model."); + ncoeff = vec_models.back().heat_model.num_coeffs; + vec_models.back().heat_model.parse_coeffs(arg, iarg); + iarg += ncoeff; + heat_flag = 1; + + } else if (strcmp(arg[iarg], "cutoff") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + vec_models.back().cutoff_type = utils::numeric(FLERR,arg[iarg+1],false,lmp); + iarg += 2; + + } else if (strcmp(arg[iarg], "limit_damping") == 0) { + vec_models.back().limit_damping = 1; + iarg += 1; + } else error->all(FLERR, "Illegal pair_coeff command"); } - if (model_one.limit_damping && !model_one.normal_model->allow_limit_damping) + if (vec_models.back().limit_damping && !vec_models.back().normal_model->allow_limit_damping) error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with specified normal contact model"); int count = 0; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { - models[i][j] = model_one; //Not sure if this works to copy? May need to specify a copy operator for ContactModel.. + models[i][j] = & vec_models.back(); setflag[i][j] = 1; count++; } @@ -437,31 +458,38 @@ void PairGranular::init_style() if (comm->ghost_velocity == 0) error->all(FLERR,"Pair granular requires ghost atoms store velocity"); - size_normal_history = 0; - size_tangential_history = 0; - size_rolling_history = 0; - size_twisting_history = 0; - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++){ - if (models[i][j].normal_model->history_flag || - models[i][j].tangential_model->history_flag || - models[i][j].rolling_model->history_flag || - models[i][j].twisting_model->history_flag) use_history = 1; + // allocate history - if (models[i][j].nondefault_history_transfer) - if (models[i][j].normal_model->size_history > size_normal_history) - size_normal_history = models[i][j].normal_model->size_history; - //... + int size_normal_history = 0; + int size_tangential_history = 0; + int size_rolling_history = 0; + int size_twisting_history = 0; + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = i; j <= atom->ntypes; j++) { + if (models[i][j]->normal_model.history_flag || + models[i][j]->tangential_model.history_flag || + models[i][j]->rolling_model.history_flag || + models[i][j]->twisting_model.history_flag) use_history = 1; + + if (models[i][j]->nondefault_history_transfer) // ??? + + if (models[i][j]->normal_model->size_history > size_normal_history) + size_normal_history = models[i][j]->normal_model.size_history; + if (models[i][j]->tangential_model->size_history > size_tangential_history) + size_tangential_history = models[i][j]->tangential_model.size_history; + if (models[i][j]->rolling_model->size_history > size_rolling_history) + size_rolling_history = models[i][j]->rolling_model.size_history; + if (models[i][j]->twisting_model->size_history > size_twisting_history) + size_twisting_history = models[i][j]->twisting_model.size_history; } + } size_history = size_normal_history + size_tangential_history + - size_roll_history + size_twist_history; - - // determine location of tangential/roll/twist histories in array + size_rolling_history + size_twisting_history; tangential_history_index = size_normal_history; roll_history_index = size_normal_history + size_tangential_history; - twist_history_index = size_normal_history + size_tangential_history + size_roll_history; + twist_history_index = size_normal_history + size_tangential_history + size_rolling_history; if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY); else neighbor->add_request(this, NeighConst::REQ_SIZE); @@ -556,71 +584,25 @@ double PairGranular::init_one(int i, int j) double cutoff = 0.0; if (setflag[i][j] == 0) { - if ((models[i][i].normal_model != models[j][j].normal_model) || - (models[i][i].damping_model != models[j][j].damping_model) || - (models[i][i].tangential_model != models[j][j].tangential_model) || - (models[i][i].roll_model != models[j][j].roll_model) || - (models[i][i].twist_model != models[j][j].twist_model)) { + if ((models[i][i]->normal_model != models[j][j]->normal_model) || + (models[i][i]->damping_model != models[j][j]->damping_model) || + (models[i][i]->tangential_model != models[j][j]->tangential_model) || + (models[i][i]->roll_model != models[j][j]->roll_model) || + (models[i][i]->twist_model != models[j][j]->twist_model)) { error->all(FLERR,"Granular pair style functional forms are different, " "cannot mix coefficients for types {} and {}. \n" "This combination must be set explicitly via a " "pair_coeff command",i,j); } - // Mix normal coefficients - if (models[i][j].normal_model == HERTZ || models[i][j].normal_model == HOOKE) - models[i][j].k_norm = models[j][i].k_norm = - mix_geom(models[i][i].k_norm, models[j][j].k_norm); - else - models[i][j].k_norm = models[j][i].k_norm = - mix_stiffnessE(models[i][i].Emod, models[j][j].Emod, - models[i][i].poisson, models[j][j].poisson); - - models[i][j].gamma_norm = models[j][i].gamma_norm = - mix_geom(models[i][i].gamma_norm, models[j][j].gamma_norm); - if ((models[i][j].normal_model == JKR) || (models[i][j].normal_model == DMT)) - models[i][j].cohesion = models[j][i].cohesion = - mix_geom(models[i][i].cohesion, models[j][j].cohesion); - - // Mix tangential coefficients - models[i][j].k_tang = models[j][i].k_tang = - mix_geom(models[i][i].k_tang, models[j][j].k_tang); - models[i][j].gamma_tang = models[j][i].gamma_tang = - mix_geom(models[i][i].gamma_tang, models[j][j].gamma_tang); - models[i][j].mu_tang = models[j][i].mu_tang = - mix_geom(models[i][i].mu_tang, models[j][j].mu_tang); - - // Mix rolling coefficients - if (models[i][j].roll_model != ROLL_NONE) { - models[i][j].k_roll = models[j][i].k_roll = - mix_geom(models[i][i].k_roll, models[j][j].k_roll); - models[i][j].gamma_roll = models[j][i].gamma_roll = - mix_geom(models[i][i].gamma_roll, models[j][j].gamma_roll); - models[i][j].mu_roll = models[j][i].mu_roll = - mix_geom(models[i][i].mu_roll, models[j][j].mu_roll); - } - - // Mix twisting coefficients - if (models[i][j].twist_model != TWIST_NONE && models[i][j].twist_model != TWIST_MARSHALL) { - models[i][j].k_twist = models[j][i].k_twist = - mix_geom(models[i][i].k_twist, models[j][j].k_twist); - models[i][j].gamma_twist = models[j][i].gamma_twist = - mix_geom(models[i][i].gamma_twist, models[j][j].gamma_twist); - models[i][j].mu_twist = models[j][i].mu_twist = - mix_geom(models[i][i].mu_twist, models[j][j].mu_twist); - } - - models[i][j].limit_damping = models[j][i].limit_damping = - MAX(models[i][i].limit_damping, models[j][j].limit_damping); - if (heat_flag) { - models[i][j].conductivity = models[j][i].conductivity = - mix_geom(models[i][i].conductivity, models[j][j].conductivity); - } + vec_models.push_back(ContactModel()); + models[i][j] = models[j][i] = & vec_models.back(); + vec_models.back().mix_coeffs(models[i][i], models[j][j]); } - // Check if conductivity is undefined (negative) for any type combination - if (heat_flag && models[i][j].conductivity < 0.0) - error->all(FLERR, "To calculate heat, conductivity must be defined for all pair coeff"); + // Check if heat model is defined for all type combinations + if (heat_flag && !models[i][j]->heat_model) + error->all(FLERR, "Must specify a heat model for all pair types"); // It is possible that cut[i][j] at this point is still 0.0. // This can happen when @@ -631,21 +613,21 @@ double PairGranular::init_one(int i, int j) // we assign cutoff = max(cut[i][j]) for i,j such that cut[i][j] > 0.0. double pulloff; - if (models[i][j].cutoff_type < 0 && cutoff_global < 0) { + if (models[i][j]->cutoff_type < 0 && cutoff_global < 0) { if (((maxrad_dynamic[i] > 0.0) && (maxrad_dynamic[j] > 0.0)) || ((maxrad_dynamic[i] > 0.0) && (maxrad_frozen[j] > 0.0)) || // radius info about both i and j exist ((maxrad_frozen[i] > 0.0) && (maxrad_dynamic[j] > 0.0))) { cutoff = maxrad_dynamic[i] + maxrad_dynamic[j]; pulloff = 0.0; - if (models[i][j].normal_model == JKR) { - pulloff = models[i][j].pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); + if (models[i][j]->beyond_contact) { + pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); cutoff += pulloff; - pulloff = models[i][j].pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); + pulloff = models[i][j]->pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); cutoff = MAX(cutoff, maxrad_frozen[i] + maxrad_dynamic[j] + pulloff); - pulloff = models[i][j].pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); + pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); cutoff = MAX(cutoff,maxrad_dynamic[i] + maxrad_frozen[j] + pulloff); } } else { @@ -661,16 +643,18 @@ double PairGranular::init_one(int i, int j) } cutoff = cutmax; } - } else if (models[i][j].cutoff_type > 0) { - cutoff = models[i][j].cutoff_type; + } else if (models[i][j]->cutoff_type > 0) { + cutoff = models[i][j]->cutoff_type; } else if (cutoff_global > 0) { cutoff = cutoff_global; } // Copy global options - models[i][j].dt = models[j][i].dt = dt; - models[i][j].roll_history_index = models[j][i].roll_history_index = roll_history_index; - models[i][j].twist_history_index = models[j][i].twist_history_index = twist_history_index; + models[i][j]->dt = models[j][i]->dt = dt; + models[i][j]->normal_model.history_index = models[j][i]->normal_model.history_index = normal_history_index; + models[i][j]->tangential_model.history_index = models[j][i]->tangential_model.history_index = tangential_history_index; + models[i][j]->rolling_model.history_index = models[j][i]->rolling_model.history_index = rolling_history_index; + models[i][j]->twisting_model.history_index = models[j][i]->twisting_model.history_index = twisting_history_index; return cutoff; } @@ -687,7 +671,7 @@ void PairGranular::write_restart(FILE *fp) fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { if (comm->me == 0){ - models[i][j].write_restart(fp); + models[i][j]->write_restart(fp); } } } @@ -708,57 +692,9 @@ void PairGranular::read_restart(FILE *fp) if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) { - std::string name; - utils::sfread(FLERR,&name.data(),sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].damping_model_type,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].tangential_model_type,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].roll_model_type,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].twist_model_type,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].limit_damping,sizeof(int),1,fp,nullptr,error); - } - MPI_Bcast(&models[i][j].normal_model_type,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].damping_model_type,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].tangential_model_type,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].roll_model_type,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].twist_model_type,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].limit_damping,1,MPI_INT,0,world); - models[i][j].init(); - models[i][j].read_restart(); - - utils::sfread(FLERR,&models[i][j].k_norm,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].gamma_norm,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].cohesion,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].k_tang,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].gamma_tang,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].mu_tang,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].k_roll,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].gamma_roll,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].mu_roll,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].k_twist,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].gamma_twist,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].mu_twist,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&models[i][j].cutoff_type,sizeof(double),1,fp,nullptr,error); - } - MPI_Bcast(&models[i][j].normal_model,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].damping_model,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].tangential_model,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].roll_model,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].twist_model,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].limit_damping,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].k_norm,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].gamma_norm,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].cohesion,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].k_tang,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].gamma_tang,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].mu_tang,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].k_roll,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].gamma_roll,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].mu_roll,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].k_twist,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].gamma_twist,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].mu_twist,1,MPI_INT,0,world); - MPI_Bcast(&models[i][j].cutoff_type,1,MPI_DOUBLE,0,world); + vec_models.push_back(ContactModel()); + models[i][j] = & vec_models.back(); + models[i][j]->read_restart(); } } } @@ -798,14 +734,14 @@ double PairGranular::single(int i, int j, int itype, int jtype, double *radius = atom->radius; // Reset model and copy initial geometric data - models[itype][jtype].reset_contact(); - models[itype][jtype].xi = x[i]; - models[itype][jtype].xj = x[j]; - models[itype][jtype].radi = radius[i]; - models[itype][jtype].radj = radius[j]; - models[i][j].history_update = 0; // Don't update history + models[itype][jtype]->reset_contact(); + models[itype][jtype]->xi = x[i]; + models[itype][jtype]->xj = x[j]; + models[itype][jtype]->radi = radius[i]; + models[itype][jtype]->radj = radius[j]; + models[i][j]->history_update = 0; // Don't update history - touchflag = models[itype][jtype].check_contact(); + touchflag = models[itype][jtype]->check_contact(); if (!touchflag) { fforce = 0.0; @@ -834,12 +770,13 @@ double PairGranular::single(int i, int j, int itype, int jtype, double **v = atom->v; double **omega = atom->omega; - models[itype][jtype].meff = meff; - models[itype][jtype].vi = v[i]; - models[itype][jtype].vj = v[j]; - models[itype][jtype].omegai = omega[i]; - models[itype][jtype].omegaj = omega[j]; - models[itype][jtype].prep_contact(); + models[itype][jtype]->meff = meff; + models[itype][jtype]->vi = v[i]; + models[itype][jtype]->vj = v[j]; + models[itype][jtype]->omegai = omega[i]; + models[itype][jtype]->omegaj = omega[j]; + models[itype][jtype]->history = history; + models[itype][jtype]->prep_contact(); // if any history is needed @@ -859,8 +796,10 @@ double PairGranular::single(int i, int j, int itype, int jtype, } double forces[3], torquesi[3], torquesj[3]; - - models[itype][jtype].calculate_forces(forces, torquesi, torquesj, history); + models[itype][jtype]->calculate_forces(); + forces = models[itype][jtype]->forces; + torquesi = models[itype][jtype]->torquesi; + torquesj = models[itype][jtype]->torquesj; // apply forces & torques fforce = MathExtra::len3(forces); @@ -871,15 +810,15 @@ double PairGranular::single(int i, int j, int itype, int jtype, double dely = x[i][1] - x[j][1]; double delz = x[i][2] - x[j][2]; - svector[0] = models[itype][jtype].fs[0]; - svector[1] = models[itype][jtype].fs[1]; - svector[2] = models[itype][jtype].fs[2]; - svector[3] = MathExtra::len3(models[itype][jtype].fs); - svector[4] = models[itype][jtype].fr[0]; - svector[5] = models[itype][jtype].fr[1]; - svector[6] = models[itype][jtype].fr[2]; - svector[7] = MathExtra::len3(models[itype][jtype].fr); - svector[8] = models[itype][jtype].magtortwist; + svector[0] = models[itype][jtype]->fs[0]; + svector[1] = models[itype][jtype]->fs[1]; + svector[2] = models[itype][jtype]->fs[2]; + svector[3] = MathExtra::len3(models[itype][jtype]->fs); + svector[4] = models[itype][jtype]->fr[0]; + svector[5] = models[itype][jtype]->fr[1]; + svector[6] = models[itype][jtype]->fr[2]; + svector[7] = MathExtra::len3(models[itype][jtype]->fr); + svector[8] = models[itype][jtype]->magtortwist; svector[9] = delx; svector[10] = dely; svector[11] = delz; @@ -960,7 +899,7 @@ double PairGranular::mix_geom(double valii, double valjj) void PairGranular::transfer_history(double* source, double* target, int source_type, int target_type) { - models[itype][jtype].transfer_history(); + models[itype][jtype]->transfer_history(); for (int i = 0; i < size_history; i++){ target[i] = history_transfer_factors[i]*source[i]; } @@ -977,8 +916,8 @@ double PairGranular::atom2cut(int i) cut = atom->radius[i] * 2; if (beyond_contact) { int itype = atom->type[i]; - if (models[itype][itype].normal_model == JKR) { - cut += models[itype][itype].pulloff_distance(cut, cut); + if (models[itype][itype]->beyond_contact) { + cut += models[itype][itype]->pulloff_distance(cut, cut); } } @@ -1000,8 +939,8 @@ double PairGranular::radii2cut(double r1, double r2) // Check all combinations of i and j to find theoretical maximum pull off distance for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ - if (models[i][j].normal_model == JKR) { - temp = models[i][j].pulloff_distance(r1, r2); + if (models[i][j]->beyond_contact) { + temp = models[i][j]->pulloff_distance(r1, r2); if (temp > cut) cut = temp; } } diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 3440d60e29..503e3ed938 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -22,7 +22,7 @@ PairStyle(granular,PairGranular); #include "contact.h" #include "pair.h" -#include +#include "vector.h" namespace LAMMPS_NS { @@ -73,7 +73,8 @@ class PairGranular : public Pair { int heat_flag; // contact models - std::vector > models; + std::vector vec_models; + Contact::ContactModel ***models; // history flags int normal_history, tangential_history, roll_history, twist_history; diff --git a/src/GRANULAR/tangential_contact_models.cpp b/src/GRANULAR/tangential_contact_models.cpp deleted file mode 100644 index ff59ceabb7..0000000000 --- a/src/GRANULAR/tangential_contact_models.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "tangential_contact_models.h" -#include "math_const.h" -#include "contact.h" - -#include - -using namespace MathConst; - -namespace Contact{ - -// ************************ -// Default behaviors where needed -// ************************ - -//----------------------------------------- - -//****************** -// Hooke -//****************** -void LinearNohistory::calculate_forces(){ - contact = c; - num_coeffs = 2; - allocate_coeffs(); -} - -void Hooke::coeffs_to_local(){ - k_norm = coeffs[0]; - damp = coeffs[1]; -} - -double Hooke::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = k_norm * contact.area; - return contact.knfac * contact.delta; -} - - -//****************** -// Hertz -//****************** -void Hertz::Hertz(ContactModel &c, int mat_flag){ - contact = c; - material_prop_flag = mat_flag; - if (material_prop_flag){ - num_coeffs = 3; - } - else{ - num_coeffs = 2; - } - allocate_coeffs(); -} - -void Hertz::coeffs_to_local(){ - if (material_prop_flag){ - Emod = coeffs[0]; - poiss = coeffs[1]; - k_norm = 4/3*Emod; - } - else{ - k_norm = coeffs[0]; - } -} - -double Hertz::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - return contact.knfac * contact.delta; -} - -//****************** -// DMT -//****************** -void DMT::DMT(ContactModel &c){ - contact = c; - material_prop_flag = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -double DMT::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - double Fne = contact.knfac * contact.delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; - Fne -= F_pulloff; - return Fne; -} - -void DMT::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); -} - -//****************** -// JKR -//****************** -void JKR::JKR(ContactModel &c){ - contact = c; - material_prop_flag = 1; - beyond_contact = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -bool JKR::touch(int touch){ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = contact.Reff * contact.Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = contact.radsum - delta_pulloff; - touchflag = (contact.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rcontact.sq < contact.radsum * contact.radsum); - } - return touchflag; -} - -double JKR::calculate_forces(){ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - return Fne; -} - -void JKR::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); -} - - - From 8557ce7c97634b855c896374a69b1e90041f2424 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 15 Jul 2022 17:57:38 -0600 Subject: [PATCH 13/57] Adding normal, damping, and tangential sub models --- src/GRANULAR/contact.cpp | 38 ++- src/GRANULAR/contact.h | 2 +- src/GRANULAR/contact_damping_models.cpp | 64 +++- src/GRANULAR/contact_damping_models.h | 42 ++- src/GRANULAR/contact_normal_models.cpp | 251 +++++++++----- src/GRANULAR/contact_normal_models.h | 100 +++--- src/GRANULAR/contact_sub_models.cpp | 57 +++- src/GRANULAR/contact_sub_models.h | 11 +- src/GRANULAR/contact_tangential_models.cpp | 365 ++++++++++----------- src/GRANULAR/contact_tangential_models.h | 79 +++-- src/GRANULAR/pair_granular.cpp | 68 ++-- src/GRANULAR/pair_granular.h | 4 - 12 files changed, 660 insertions(+), 421 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 693721fe22..12a9476585 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -54,45 +54,53 @@ ContactModel::ContactModel() void ContactModel::init_model(char *model_name, int model_type) { if (model_type == NORMAL) { - if (strcmp(model_name, "hooke") == 0) normal_model = new Hooke(); - else if (strcmp(model_name, "hertz") == 0) normal_model = new Hertz(0); - else if (strcmp(model_name, "hertz/material") == 0) normal_model = new Hertz(1); - //... + if (strcmp(model_name, "hooke") == 0) normal_model = new NormalHooke(); + else if (strcmp(model_name, "hertz") == 0) normal_model = new NormalHertz(); + else if (strcmp(model_name, "hertz/material") == 0) normal_model = new NormalHertzMaterial(); + else if (strcmp(model_name, "dmt") == 0) normal_model = new NormalDMT(); + else if (strcmp(model_name, "jkr") == 0) normal_model = new NormalJKR(); else error->all(FLERR, "Normal model name not recognized"); sub_models[model_type] = &normal_model; } else if (model_type == TANGENTIAL) { - if (strcmp(model_name, "linear") == 0) tangential_model = new LinearNoHistory(); - //... + if (strcmp(model_name, "linear_nohistory") == 0) tangential_model = new TangentialLinearNoHistory(); + else if (strcmp(model_name, "linear_history") == 0) tangential_model = new TangentialLinearHistory(); + else if (strcmp(model_name, "mindlin") == 0) tangential_model = new TangentialMindlin(); + else if (strcmp(model_name, "mindlin/force") == 0) tangential_model = new TangentialMindlinForce(); + else if (strcmp(model_name, "mindlin_rescale") == 0) tangential_model = new TangentialMindlinRescale(); + else if (strcmp(model_name, "mindlin_rescale/force") == 0) tangential_model = new TangentialMindlinRescaleForce(); else error->all(FLERR, "Tangential model name not recognized"); sub_models[model_type] = &tangential_model; } else if (model_type == DAMPING) { - if (strcmp(model_name, "linear") == 0) damping_model = new LinearNoHistory(); - //... + if (strcmp(model_name, "velocity") == 0) damping_model = new DampingVelocity(); + else if (strcmp(model_name, "mass_velocity") == 0) damping_model = new DampingMassVelocity(); + else if (strcmp(model_name, "viscoelastic") == 0) damping_model = new DampingViscoelastic(); + else if (strcmp(model_name, "tsuji") == 0) damping_model = new DampingTsuji(); else error->all(FLERR, "Damping model name not recognized"); sub_models[model_type] = &damping_model; } else if (model_type == ROLLING) { - if (strcmp(model_name, "linear") == 0) rolling_model = new LinearNoHistory(); - //... + if (strcmp(model_name, "none") == 0) delete rolling_model; + else if (strcmp(model_name, "sds") == 0) rolling_model = new RollingSDS(); else error->all(FLERR, "Rolling model name not recognized"); sub_models[model_type] = &rolling_model; } else if (model_type == TWISTING) { - if (strcmp(model_name, "linear") == 0) twisting_model = new LinearNoHistory(); - //... + if (strcmp(model_name, "none") == 0) delete twisting_model; + else if (strcmp(model_name, "sds") == 0) twisting_model = new TwistingSDS(); + else if (strcmp(model_name, "marshall") == 0) twisting_model = new TwistingMarshall(); else error->all(FLERR, "Twisting model name not recognized"); sub_models[model_type] = &twisting_model; } else if (model_type == HEAT) { - if (strcmp(model_name, "linear") == 0) heat_model = new LinearNoHistory(); - //... + if (strcmp(model_name, "none") == 0) delete heat_model; + else if (strcmp(model_name, "area") == 0) heat_model = new HeatArea(); else error->all(FLERR, "Heat model name not recognized"); sub_models[model_type] = &heat_model; } - sub_models[model_type]->model_name.assign(model_name); + sub_models[model_type]->name.assign(model_name); sub_models[model_type]->contact = *this; sub_models[model_type]->allocate_coeffs(); } diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 8883ecb08e..f9f18a1eb4 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -64,7 +64,7 @@ public: double *history; double radi, radj, meff, dt, Ti, Tj, area; - double Fntot, Fncrit, magtortwist; + double Fntot, magtortwist; double *xi, *xj, *vi, *vj, *omegai, *omegaj; double fs[3], fr[3], ft[3]; diff --git a/src/GRANULAR/contact_damping_models.cpp b/src/GRANULAR/contact_damping_models.cpp index 11d2c19b57..1e233234b2 100644 --- a/src/GRANULAR/contact_damping_models.cpp +++ b/src/GRANULAR/contact_damping_models.cpp @@ -23,32 +23,66 @@ using namespace MathSpecial; namespace Contact{ -void DampingModel::allocate_coeffs(){ - damp = contact.normal_model->coeffs[1]; + +/* ---------------------------------------------------------------------- + Default damping model +------------------------------------------------------------------------- */ + +void DampingModel::DampingModel() +{ + num_coeffs = 0; } -//----------------------------------------- -double Velocity::calculate_forces(){ - return -damp*contact.vnnr; +/* ---------------------------------------------------------------------- */ + +void DampingModel::coeffs_to_local() +{ + damp = contact.normal_model.damp; } -double MassVelocity::calculate_forces(){ - return -damp*contact.meff*contact.vnnr; +/* ---------------------------------------------------------------------- + Velocity damping +------------------------------------------------------------------------- */ + +double DampingVelocity::calculate_forces() +{ + return -damp * contact.vnnr; } +/* ---------------------------------------------------------------------- + Mass velocity damping +------------------------------------------------------------------------- */ -double ViscoElastic::calculate_forces(){ - return -damp*contact.meff*contact.area*contact.vnnr; +double MassVelocity::calculate_forces() +{ + return -damp * contact.meff * contact.vnnr; } +/* ---------------------------------------------------------------------- + Default, viscoelastic damping +------------------------------------------------------------------------- */ -void Tsuji::allocate_coeffs(){ - double cor = contact.normal_model->coeffs[1]; - damp = 1.2728-4.2783*cor+11.087*square(cor)-22.348*cube(cor)+ - 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); +double ViscoElastic::calculate_forces() +{ + return -damp * contact.meff * contact.area * contact.vnnr; } -double Tsuji::calculate_forces(){ - return -damp*sqrt(contact.meff*contact.knfac)*contact.vnnr; +/* ---------------------------------------------------------------------- + Tsuji damping +------------------------------------------------------------------------- */ + +void Tsuji::coeffs_to_local() +{ + double tmp = contact.normal_model.damp; + damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); + damp += -22.348 * cube(tmp)+ 27.467 * powint(tmp, 4); + damp += -18.022 * powint(tmp, 5) + 4.8218 * powint(tmp,6); +} + +/* ---------------------------------------------------------------------- */ + +double Tsuji::calculate_forces() +{ + return -damp_scaled * sqrt(contact.meff * contact.normal_model.knfac) * contact.vnnr; } diff --git a/src/GRANULAR/contact_damping_models.h b/src/GRANULAR/contact_damping_models.h index 036f6e3452..0fc4fd2c17 100644 --- a/src/GRANULAR/contact_damping_models.h +++ b/src/GRANULAR/contact_damping_models.h @@ -19,34 +19,48 @@ namespace Contact { -class DampingModel:SubModel{ -public: - DampingModel(){}; - virtual ~DampingModel(){}; +class DampingModel:SubModel +{ + public: + DampingModel(); + virtual ~DampingModel() {}; virtual double calculate_forces() = 0; - virtual void allocate_coeffs(); + virtual void coeffs_to_local(); + virtual void mix_coeffs(NormalModel*, NormalModel*); double damp; }; -class Velocity:DampingModel{ -public: +/* ---------------------------------------------------------------------- */ + +class DampingVelocity:DampingModel +{ + public: double calculate_forces(); }; -class MassVelocity:DampingModel{ -public: +/* ---------------------------------------------------------------------- */ + +class DampingMassVelocity:DampingModel +{ + public: double calculate_forces(); }; -class ViscoElastic:DampingModel{ -public: +/* ---------------------------------------------------------------------- */ + +class DampingViscoElastic:DampingModel +{ + public: double calculate_forces(); }; -class Tsuji:DampingModel{ -public: +/* ---------------------------------------------------------------------- */ + +class DampingTsuji:DampingModel +{ + public: double calculate_forces(); - void allocate_coeffs(); + void coeffs_to_local(); }; diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index e17798ca25..9b1d85d123 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -29,124 +29,226 @@ namespace Contact{ #define ONETHIRD (1.0/3.0) // 1/3 #define THREEQUARTERS 0.75 // 3/4 -// ************************ -// Default behaviors where needed -// ************************ -void NormalModel::set_fncrit() +/* ---------------------------------------------------------------------- + Default normal model +------------------------------------------------------------------------- */ + +NormalModel::NormalModel() { - contact->Fncrit = fabs(contact->Fntot); + material_properties = 0; } -void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +/* ---------------------------------------------------------------------- */ + +void NormalModel::set_fncrit() { - for (int i = 0; i < num_coeffs; i++) { - coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); - } + Fncrit = fabs(contact.Fntot); } +/* ---------------------------------------------------------------------- */ + void NormalModel::pulloff_distance(double radi, double radj) { return radi + radj; } -//----------------------------------------- +/* ---------------------------------------------------------------------- + Hookean normal force +------------------------------------------------------------------------- */ -//****************** -// Hooke -//****************** -void Hooke::Hooke(ContactModel &c) +void NormalHooke::NormalHooke() { num_coeffs = 2; allocate_coeffs(); } -void Hooke::coeffs_to_local() +/* ---------------------------------------------------------------------- */ + +void NormalHooke::coeffs_to_local() { k_norm = coeffs[0]; damp = coeffs[1]; } -double Hooke::calculate_forces() +/* ---------------------------------------------------------------------- */ + +void NormalHooke::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +double NormalHooke::calculate_forces() { contact.area = sqrt(contact.dR); - contact.knfac = k_norm * contact.area; - return contact.knfac * contact.delta; + knfac = k_norm * contact.area; + Fne = knfac * contact.delta; + return Fne; } +/* ---------------------------------------------------------------------- + Hertzian normal force +------------------------------------------------------------------------- */ -//****************** -// Hertz -//****************** -void Hertz::Hertz(ContactModel &c, int mat_flag) +void NormalHertz::NormalHertz() { - material_prop_flag = mat_flag; - if (material_prop_flag){ - num_coeffs = 3; - } - else{ - num_coeffs = 2; - } + num_coeffs = 2; } -void Hertz::coeffs_to_local() +/* ---------------------------------------------------------------------- */ + +void NormalHertz::coeffs_to_local() { - if (material_prop_flag){ - Emod = coeffs[0]; - poiss = coeffs[1]; - k_norm = 4/3*Emod; - } - else{ - k_norm = coeffs[0]; - } + k_norm = coeffs[0]; + damp = coeffs[1]; } -double Hertz::calculate_forces() +/* ---------------------------------------------------------------------- */ + +void NormalHertz::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +double NormalHertz::calculate_forces() { contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - return contact.knfac * contact.delta; + knfac = contact.k_norm * contact.area; + Fne = knfac * contact.delta; + return Fne; } -//****************** -// DMT -//****************** -void DMT::DMT(ContactModel &c) +/* ---------------------------------------------------------------------- + Hertzian normal force with material properties +------------------------------------------------------------------------- */ + +void NormalHertzMaterial::NormalHertzMaterial() { - material_prop_flag = 1; + material_properties = 1; + num_coeffs = 3; +} + +/* ---------------------------------------------------------------------- */ + +void NormalHertzMaterial::coeffs_to_local() +{ + Emod = coeffs[0]; + damp = coeffs[1]; + poiss = coeffs[2]; + k_norm = 4 / 3 * Emod; +} + +/* ---------------------------------------------------------------------- */ + +void NormalHertzMaterial::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- + DMT normal force +------------------------------------------------------------------------- */ + +void NormalDMT::NormalDMT(ContactModel &c) +{ + allow_limit_damping = 0; + material_properties = 1; num_coeffs = 4; } -double DMT::calculate_forces() +/* ---------------------------------------------------------------------- */ + +void NormalDMT::coeffs_to_local() +{ + Emod = coeffs[0]; + damp = coeffs[1]; + poiss = coeffs[2]; + cohesion = coeffs[3]; + k_norm = 4 / 3 * Emod; +} + +/* ---------------------------------------------------------------------- */ + +void NormalDMT::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +double NormalDMT::calculate_forces() { contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - double Fne = contact.knfac * contact.delta; + knfac = k_norm * contact.area; + Fne = knfac * contact.delta; F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; Fne -= F_pulloff; return Fne; } -void DMT::set_fncrit() +/* ---------------------------------------------------------------------- */ + +void NormalDMT::set_fncrit() { - contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); + Fncrit = fabs(Fne + 2* F_pulloff); } -//****************** -// JKR -//****************** -void JKR::JKR(ContactModel &c) +/* ---------------------------------------------------------------------- + JKR normal force +------------------------------------------------------------------------- */ + +void NormalJKR::NormalJKR(ContactModel &c) { - material_prop_flag = 1; + allow_limit_damping = 0; + material_properties = 1; contact.beyond_contact = beyond_contact = 1; num_coeffs = 4; } -bool JKR::touch(int touch) +/* ---------------------------------------------------------------------- */ + +void NormalJKR::coeffs_to_local() { - double Escaled, R2, delta_pulloff, dist_pulloff; + Emod = coeffs[0]; + damp = coeffs[1]; + poiss = coeffs[2]; + cohesion = coeffs[3]; + k_norm = 4/3*Emod; + Escaled = k_norm * THREEQUARTERS; +} + +/* ---------------------------------------------------------------------- */ + +void NormalJKR::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +bool NormalJKR::touch(int touch) +{ + double R2, delta_pulloff, dist_pulloff; bool touchflag; - Escaled = k_norm * THREEQUARTERS; if (touch) { R2 = contact.Reff * contact.Reff; a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); @@ -159,12 +261,12 @@ bool JKR::touch(int touch) return touchflag; } -double JKR::calculate_forces() -{ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; +/* ---------------------------------------------------------------------- */ - Escaled = k_norm * THREEQUARTERS; +double NormalJKR::calculate_forces() +{ + double R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3, a2; R2 = Reff * Reff; dR2 = dR * dR; @@ -180,28 +282,31 @@ double JKR::calculate_forces() sqrt2 = MAX(0, 2 * dR + t5); t6 = sqrt(sqrt2); sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); + contact.area = INVROOT6 * (t6 + sqrt(sqrt3)); + a2 = contact.area * contact.area; + Fne = Escaled * contact.area * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * contact.area)); F_pulloff = 3 * MY_PI * cohesion * Reff; - knfac = Escaled * a; + knfac = Escaled * contact.area; return Fne; } -void JKR::set_fncrit() +/* ---------------------------------------------------------------------- */ + +void NormalJKR::set_fncrit() { - contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); + Fncrit = fabs(Fne + 2 * F_pulloff); } -void JKR::pulloff_distance(double radi, double radj) +/* ---------------------------------------------------------------------- */ + +void NormalJKR::pulloff_distance(double radi, double radj) { - double Ecaled, a_tmp, Reff_tmp; + double a_tmp, Reff_tmp; Reff_tmp = radi * radj / (radi + radj); if (Reff_tmp <= 0) return 0; - Ecaled = k_norm * THREEQUARTERS; a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); } diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index 7d54fc942b..e91d5af1c9 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -20,65 +20,91 @@ namespace Contact { class NormalModel:SubModel{ -public: - NormalModel(){}; - virtual ~NormalModel(){}; + public: + NormalModel(); + virtual ~NormalModel() {}; virtual bool check_contact(); - virtual void prep_contact(); virtual void set_fncrit(); virtual double calculate_forces() = 0; virtual void coeffs_to_local(); - virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed + virtual void mix_coeffs(NormalModel*, NormalModel*); void pulloff_distance(double, double); - -private: - int size_history = 0; - int beyond_contact = 0; - int allow_limit_damping = 1; - + double damp; // Vestigial argument needed by damping + double Fncrit, Fne, knfac; + int material_properties; }; -class Hooke:NormalModel{ -public: - Hooke(); - ~Hooke(){}; +/* ---------------------------------------------------------------------- */ + +class NormalHooke:NormalModel +{ + public: + NormalHooke(); + ~NormalHooke() {}; void coeffs_to_local(); + void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); -private: - double k_norm, damp; + double Emod, poiss; }; -class Hertz:NormalModel{ -public: - Hertz(int); - ~Hertz(){}; +/* ---------------------------------------------------------------------- */ + +class NormalHertz:NormalModel +{ + public: + NormalHertz(); + ~NormalHertz() {}; void coeffs_to_local(); + void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); -private: - double k_norm, damp, Emod, poiss; + private: + double k_norm; }; -class DMT:NormalModel{ -public: - DMT(); - ~DMT(){}; +/* ---------------------------------------------------------------------- */ + +class NormalHertzMaterial:NormalHertz +{ + public: + NormalHertzMaterial(); + ~NormalHertzMaterial() {}; void coeffs_to_local(); - void coeffs_to_local(NormalModel*, NormalModel*); + void mix_coeffs(NormalModel*, NormalModel*); + private: + double k_norm; +}; + +/* ---------------------------------------------------------------------- */ + +class NormalDMT:NormalModel +{ + public: + NormalDMT(); + ~NormalDMT() {}; + void coeffs_to_local(); + void mix_coeffs(NormalModel*, NormalModel*); + void set_fncrit(); double calculate_forces(); -private: - double k_norm, damp, Emod, cohesion, poiss; + private: + double k_norm, cohesion; double F_pulloff; }; -class JKR:NormalModel{ -public: - JKR(); - ~JKR(){}; +/* ---------------------------------------------------------------------- */ + +class NormalJKR:NormalModel +{ + public: + NormalJKR(); + ~NormalJKR() {}; void coeffs_to_local(); + void mix_coeffs(NormalModel*, NormalModel*); + void set_fncrit(); double calculate_forces(); -private: - double k_norm, damp, Emod, cohesion, poiss; - double F_pulloff; + void pulloff_distance(double, double); + private: + double k_norm, cohesion; + double Escaled, F_pulloff; }; } diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index 8802622c78..99fcd638b4 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -29,30 +29,41 @@ namespace Contact{ SubModel::SubModel() { allocated = 0; - material_prop_flag = 0; size_history = 0; history_index = 0; + allow_limit_damping = 1; + beyond_contact = 0; } +/* ---------------------------------------------------------------------- */ + SubModel::~SubModel() { if (allocated) delete [] coeffs; } +/* ---------------------------------------------------------------------- */ + void SubModel::allocate_coeffs() { allocated = 1; coeffs = new double[num_coeffs]; } +/* ---------------------------------------------------------------------- */ + void SubModel::parse_coeffs(char **arg, int iarg) { for (int i = 0; i < num_coeffs; i++) { - coeffs[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); + // A few parameters (eg.g kt for tangential mindlin) allow null + if (strcmp(arg[iarg+i+1], "NULL") == 0) coeffs[i] = -1; + else coeffs[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); } coeffs_to_local(); } +/* ---------------------------------------------------------------------- */ + void SubModel::write_restart(FILE *fp) { fwrite(&model_name.length(),sizeof(int),1,fp); @@ -61,27 +72,61 @@ void SubModel::write_restart(FILE *fp) fwrite(coeffs,sizeof(int),num_coeffs,fp); } +/* ---------------------------------------------------------------------- */ + void SubModel::read_restart(FILE *fp, int num_char) { - if (comm->me == 0){ + if (comm->me == 0) { utils::sfread(FLERR,&num_coeffs,sizeof(int),1,fp,nullptr,error); } MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); allocate_coeffs(); } +/* ---------------------------------------------------------------------- */ + void SubModel::read_restart(FILE *fp) { int num_char; - if (me == 0){ + if (me == 0) { utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); } MPI_BCast(&num_char, 1, MPI_INT, 0, world); read_restart(fp, num_char); } +/* ---------------------------------------------------------------------- + mixing of Young's modulus (E) +------------------------------------------------------------------------- */ - - +double SubModel::mix_stiffnessE(double E1, double E2, + double pois1, double pois2) +{ + double factor1 = (1 - pois1 * pois1) / E1; + double factor2 = (1 - pois2 * pois2) / E2; + return 1 / (factor1 + factor2); } +/* ---------------------------------------------------------------------- + mixing of shear modulus (G) +------------------------------------------------------------------------ */ + +double SubModel::mix_stiffnessG(double E1, double E2, + double pois1, double pois2) +{ + double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; + double factor2 = 2 * (2 - pois2) * (1 + pois2) / E2) + return 1 / (factor1 + factor2); +} + +/* ---------------------------------------------------------------------- + mixing of everything else +------------------------------------------------------------------------- */ + +double SubModel::mix_geom(double val1, double val2) +{ + return sqrt(val1 * val2); +} + + +} \ No newline at end of file diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index 771f0f0890..f659ef1504 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; namespace Contact{ class SubModel : Pointers{ - SubModel(){}; + SubModel(); virtual ~SubModel(); public: int num_coeffs; @@ -35,13 +35,18 @@ public: void read_restart(FILE*, int); virtual void coeffs_to_local(); void allocate_coeffs(); - std::string model_name; + std::string name; private: ContactModel &contact; int allocated; - int material_prop_flag; int size_history; int history_index; + int beyond_contact; + int allow_limit_damping; + + double mix_stiffnessE(double, double, double, double); + double mix_stiffnessG(double, double, double, double); + double mix_geom(double, double); }; } diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 1ceb940111..9f092aaf29 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -21,188 +21,101 @@ using namespace MathConst; namespace Contact{ -// ************************ -// Default behaviors where needed -// ************************ +/* ---------------------------------------------------------------------- + Linear model with no history +------------------------------------------------------------------------- */ -//----------------------------------------- - -//****************** -// Hooke -//****************** -void LinearNohistory::calculate_forces(){ - contact = c; +TangentialLinearNoHistory::TangentialLinearNoHistory() +{ num_coeffs = 2; - allocate_coeffs(); + size_history = 3; } -void Hooke::coeffs_to_local(){ - k_norm = coeffs[0]; - damp = coeffs[1]; -} - -double Hooke::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = k_norm * contact.area; - return contact.knfac * contact.delta; -} - - -//****************** -// Hertz -//****************** -void Hertz::Hertz(ContactModel &c, int mat_flag){ - contact = c; - material_prop_flag = mat_flag; - if (material_prop_flag){ - num_coeffs = 3; - } - else{ - num_coeffs = 2; - } - allocate_coeffs(); -} - -void Hertz::coeffs_to_local(){ - if (material_prop_flag){ - Emod = coeffs[0]; - poiss = coeffs[1]; - k_norm = 4/3*Emod; - } - else{ - k_norm = coeffs[0]; - } -} - -double Hertz::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - return contact.knfac * contact.delta; -} - -//****************** -// DMT -//****************** -void DMT::DMT(ContactModel &c){ - contact = c; - material_prop_flag = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -double DMT::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - double Fne = contact.knfac * contact.delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; - Fne -= F_pulloff; - return Fne; -} - -void DMT::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); -} - -//****************** -// JKR -//****************** -void JKR::JKR(ContactModel &c){ - contact = c; - material_prop_flag = 1; - beyond_contact = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -bool JKR::touch(int touch){ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = contact.Reff * contact.Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = contact.radsum - delta_pulloff; - touchflag = (contact.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rcontact.sq < contact.radsum * contact.radsum); - } - return touchflag; -} - -double JKR::calculate_forces(){ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - return Fne; -} - -void JKR::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); -} - - - - - /* ---------------------------------------------------------------------- */ -void ContactModel::tangential_no_history() +void TangentialLinearNoHistory::coeffs_to_local() { - double gamma_scaled = gamma_tang * damp_normal_prefactor; - double fsmag, Ft; + xt = coeffs[0]; + mu = coeffs[1]; + damp = xt * contact.damping_model.damp; +} + +/* ---------------------------------------------------------------------- */ + +void TangentialLinearNoHistory::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +void TangentialLinearNoHistory::calculate_forces() +{ + double Fscrit, fsmag, Ft; // classic pair gran/hooke (no history) - fsmag = gamma_scaled * vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fsmag) / vrel; + Fscrit = mu * contact.normal_model.Fncrit + fsmag = damp * contact.vrel; + if (contact.vrel != 0.0) Ft = MIN(Fscrit, fsmag) / contact.vrel; else Ft = 0.0; Ft = -Ft; - scale3(Ft, vtr, fs); + scale3(Ft, contact.vtr, contact.fs); +} + +/* ---------------------------------------------------------------------- + Linear model with history +------------------------------------------------------------------------- */ + +TangentialLinearHistory::TangentialLinearHistory() +{ + num_coeffs = 3; + size_history = 3; } /* ---------------------------------------------------------------------- */ -void ContactModel::tangential_history(double *history) +void TangentialLinearHistory::coeffs_to_local() { - double gamma_scaled = gamma_tang * damp_normal_prefactor; - double k = k_tang; + kt = coeffs[0]; + xt = coeffs[1]; + mu = coeffs[2]; + damp = xt * contact.damping_model.damp; +} + +/* ---------------------------------------------------------------------- */ + +void TangentialLinearHistory::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +void TangentialLinearHistory::calculate_forces() +{ + double Fscrit, magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; int frame_update = 0; - double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + + Fscrit = contact.normal_model.Fncrit * mu; + + double *history = & contact.history[history_index]; // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = dot3(history, nx); - frame_update = fabs(rsht) * k > EPSILON * Fscrit; + if (contact.history_update) { + rsht = dot3(history, contact.nx); + frame_update = fabs(rsht) * kt > EPSILON * Fscrit; if (frame_update) { shrmag = len3(history); // projection - scale3(rsht, nx, history); + scale3(rsht, contact.nx, history); // also rescale to preserve magnitude prjmag = len3(history); if (prjmag > 0) temp_dbl = shrmag / prjmag; @@ -213,54 +126,94 @@ void ContactModel::tangential_history(double *history) // update history // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = k * dt; - scale3(temp_dbl, vtr, temp_array); + temp_dbl = kt * contact.dt; + scale3(temp_dbl, contact.vtr, temp_array); sub3(history, temp_array, history); } // tangential forces = history + tangential velocity damping - temp_dbl = -gamma_norm; - scale3(temp_dbl, vtr, fs); + temp_dbl = -damp; + scale3(temp_dbl, contact.vtr, contact.fs); // rescale frictional displacements and forces if needed - magfs = len3(fs); + magfs = len3(contact.fs); if (magfs > Fscrit) { shrmag = len3(history); if (shrmag != 0.0) { temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs, history); - scale3(gamma_norm, vtr, temp_array); + scale3(temp_dbl, contact.fs, history); + scale3(damp, contact.vtr, temp_array); add3(history, temp_array, history); temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs); + scale3(temp_dbl, contact.fs); } else { - zero3(fs); + zero3(contact.fs); } } } +/* ---------------------------------------------------------------------- + Mindlin model +------------------------------------------------------------------------- */ + +TangentialMindlin::TangentialMindlin() +{ + num_coeffs = 3; + size_history = 3; + mindlin_force = 0; + mindlin_rescale = 0; +} + /* ---------------------------------------------------------------------- */ -void ContactModel::tangential_mindlin(double *history) +void TangentialMindlin::coeffs_to_local() { - double k_scaled, gamma_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; + kt = coeffs[0]; + xt = coeffs[1]; + mu = coeffs[2]; + + if (ke == -1) + kt = 8.0 * mix_stiffness(contact.normal_model.Emod, contact.normal_model.Emod, + contact.normal_model.poiss, contact.normal_model.poiss); + + damp = xt * contact.damping_model.damp; +} + +/* ---------------------------------------------------------------------- */ + +void TangentialMindlin::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +{ + if (imodel->coeffs[0] == -1 || imodel->coeffs[0] == -1) coeffs[0] = -1; + else coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +void TangentialMindlin::calculate_forces() +{ + double Fscrit, k_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; int frame_update = 0; - gamma_scaled = gamma_tang * damp_normal_prefactor; - k_scaled = k_tang * a; + double *history = & contact.history[history_index]; + Fscrit = contact.normal_model.Fncrit * mu; + + k_scaled = k_tang * contact.area; if (mindlin_rescale) { // on unloading, rescale the shear displacements/force - if (a < history[3]) { - temp_dbl = a / history[3]; + if (contact.area < history[3]) { + temp_dbl = contact.area / history[3]; scale3(temp_dbl, history); } } // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = dot3(history, nx); + if (contact.history_update) { + rsht = dot3(history, contact.nx); if (mindlin_force) frame_update = fabs(rsht) > EPSILON * Fscrit; else @@ -269,7 +222,7 @@ void ContactModel::tangential_mindlin(double *history) if (frame_update) { shrmag = len3(history); // projection - scale3(rsht, nx, history); + scale3(rsht, contact.nx, history); // also rescale to preserve magnitude prjmag = len3(history); if (prjmag > 0) temp_dbl = shrmag / prjmag; @@ -281,44 +234,78 @@ void ContactModel::tangential_mindlin(double *history) if (mindlin_force) { // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = -k_scaled * dt; - scale3(temp_dbl, vtr, temp_array); + temp_dbl = -k_scaled * contact.dt; + scale3(temp_dbl, contact.vtr, temp_array); } else { - scale3(dt, vtr, temp_array); + scale3(contact.dt, contact.vtr, temp_array); } add3(history, temp_array, history); - if (mindlin_rescale) history[3] = a; + if (mindlin_rescale) history[3] = contact.area; } // tangential forces = history + tangential velocity damping - temp_dbl = -gamma_scaled; - scale3(temp_dbl, vtr, fs); + temp_dbl = -damp; + scale3(temp_dbl, contact.vtr, contact.fs); if (! mindlin_force) { scale3(k_scaled, history, temp_array); - add3(fs, temp_array, fs); + add3(contact.fs, temp_array, contact.fs); } // rescale frictional displacements and forces if needed - magfs = len3(fs); + magfs = len3(contact.fs); if (magfs > Fscrit) { shrmag = len3(history); if (shrmag != 0.0) { temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs, history); - scale3(gamma_tang, vtr, temp_array); + scale3(temp_dbl, contact.fs, history); + scale3(damp, contact.vtr, temp_array); add3(history, temp_array, history); if (! mindlin_force) { - temp_dbl = -1.0 / k_tang; + temp_dbl = -1.0 / k_scaled; scale3(temp_dbl, history); } temp_dbl = Fscrit / magfs; - scale3(temp_dbl, fs); + scale3(temp_dbl, contact.fs); } else { - zero3(fs); + zero3(contact.fs); } } } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Mindlin force model +------------------------------------------------------------------------- */ + +void TangentialMindlinForce::TangentialMindlinForce() +{ + num_coeffs = 3; + size_history = 3; + mindlin_force = 1; + mindlin_rescale = 0; +} + +/* ---------------------------------------------------------------------- + Mindlin rescale model +------------------------------------------------------------------------- */ + +void TangentialMindlinRescale::TangentialMindlinForce() +{ + num_coeffs = 3; + size_history = 4; + mindlin_force = 0; + mindlin_rescale = 1; +} + +/* ---------------------------------------------------------------------- + Mindlin rescale force model +------------------------------------------------------------------------- */ + +void TangentialMindlinRescaleForce::TangentialMindlinForce() +{ + num_coeffs = 3; + size_history = 4; + mindlin_force = 1; + mindlin_rescale = 1; +} diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index 207d129e7c..c0a5a727f0 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -19,59 +19,82 @@ namespace Contact { -class TangentialModel:SubModel{ +class TangentialModel:SubModel +{ public: - TangentialModel(){}; - virtual ~TangentialModel(){}; + TangentialModel() {}; + virtual ~TangentialModel() {}; virtual double calculate_forces() = 0; virtual void coeffs_to_local(); - virtual void mix_coeffs(TangentialModel*, TangentialModel*); //When mixing is needed - int rescale_flag = 0; + virtual void mix_coeffs(TangentialModel*, TangentialModel*); + int rescale_flag; private: - int beyond_contact = 0; - int allow_limit_damping = 1; - + int beyond_contact; + int allow_limit_damping; }; -class LinearNohistory:TangentialModel{ +/* ---------------------------------------------------------------------- */ + +class TangentialLinearNoHistory:TangentialModel +{ public: + TangentialLinearNoHistory() + virtual void coeffs_to_local(); + virtual void mix_coeffs(TangentialModel*, TangentialModel*); double calculate_forces(); private: - void allocate_coeffs(); - double k_t, damp; + double xt, damp, mu; }; -class LinearHistory:TangentialModel{ +/* ---------------------------------------------------------------------- */ + +class TangentialLinearHistory:TangentialModel +{ public: - LinearHistory(){} - ~LinearHistory(){}; - void coeffs_to_local(); + TangentialLinearHistory() + virtual void coeffs_to_local(); + virtual void mix_coeffs(TangentialModel*, TangentialModel*); double calculate_forces(); private: - double k_norm, damp, Emod, poiss; + double kt, xt, damp, mu; }; -class Mindlin:TangentialModel{ +/* ---------------------------------------------------------------------- */ + +class TangentialMindlin:TangentialModel +{ public: - Mindlin(int); - ~Mindlin(){}; + TangentialMindlin(); void coeffs_to_local(); void coeffs_to_local(TangentialModel*, TangentialModel*); double calculate_forces(); private: - double k_norm, damp, Emod, poiss, coh; + int mindlin_rescale, mindlin_force; }; -class MindlinForce:TangentialModel{ -public: - JKR(ContactModel &c); - ~JKR(){}; - void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; +/* ---------------------------------------------------------------------- */ +class TangentialMindlinForce:TangentialMindlin +{ +public: + TangentialMindlinForce(); +}; + +/* ---------------------------------------------------------------------- */ + +class TangentialMindlinRescale:TangentialMindlin +{ +public: + TangentialMindlinRescale(); +}; + +/* ---------------------------------------------------------------------- */ + +class TangentialMindlinRescaleForce:TangentialMindlinRescale +{ +public: + TangentialMindlinForceRescale(); }; } diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 7378df2f77..5816850ef2 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -376,7 +376,19 @@ void PairGranular::coeff(int narg, char **arg) //Parse optional arguments while (iarg < narg) { - if (strcmp(arg[iarg], "rolling") == 0) { + if (strcmp(arg[iarg], "damping") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + vec_models.back().init(arg[iarg], Contact::DAMPING); + ncoeff = vec_models.back().damping_model.num_coeffs; + iarg += 1; + if (iarg + ncoeff >= narg) + error->all(FLERR, "Illegal pair_coeff command" + "Insufficient arguments provided for damping model."); + vec_models.back().damping_model.parse_coeffs(arg, iarg); + iarg += ncoeff; + + } else if (strcmp(arg[iarg], "rolling") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); vec_models.back().init(arg[iarg], Contact::ROLLING); @@ -409,7 +421,6 @@ void PairGranular::coeff(int narg, char **arg) if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for heat model."); - ncoeff = vec_models.back().heat_model.num_coeffs; vec_models.back().heat_model.parse_coeffs(arg, iarg); iarg += ncoeff; heat_flag = 1; @@ -427,6 +438,12 @@ void PairGranular::coeff(int narg, char **arg) } else error->all(FLERR, "Illegal pair_coeff command"); } + // Define default damping model if unspecified, takes no args + if (!vec_models.back().damping_model) { + vec_models.back().init("viscoelastic", Contact::DAMPING); + vec_models.back().damping_model.parse_coeffs(arg, 0); + } + if (vec_models.back().limit_damping && !vec_models.back().normal_model->allow_limit_damping) error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with specified normal contact model"); @@ -584,11 +601,11 @@ double PairGranular::init_one(int i, int j) double cutoff = 0.0; if (setflag[i][j] == 0) { - if ((models[i][i]->normal_model != models[j][j]->normal_model) || - (models[i][i]->damping_model != models[j][j]->damping_model) || - (models[i][i]->tangential_model != models[j][j]->tangential_model) || - (models[i][i]->roll_model != models[j][j]->roll_model) || - (models[i][i]->twist_model != models[j][j]->twist_model)) { + if ((models[i][i]->normal_model.name != models[j][j]->normal_model.name) || + (models[i][i]->damping_model.name != models[j][j]->damping_model.name) || + (models[i][i]->tangential_model.name != models[j][j]->tangential_model.name) || + (models[i][i]->rolling_model.name != models[j][j]->rolling_model.name) || + (models[i][i]->twisting_model.name != models[j][j]->twisting_model.name)) { error->all(FLERR,"Granular pair style functional forms are different, " "cannot mix coefficients for types {} and {}. \n" "This combination must be set explicitly via a " @@ -597,6 +614,13 @@ double PairGranular::init_one(int i, int j) vec_models.push_back(ContactModel()); models[i][j] = models[j][i] = & vec_models.back(); + vec_models.back().init(models[i][i]->normal_model.name, Contact::NORMAL); + vec_models.back().init(models[i][i]->tangential_model.name, Contact::TANGENTIAL); + vec_models.back().init(models[i][i]->damping_model.name, Contact::DAMPING); + vec_models.back().init(models[i][i]->rolling_model.name, Contact::ROLLING); + vec_models.back().init(models[i][i]->twisting_model.name, Contact::TWISTING); + vec_models.back().init(models[i][i]->heat_model.name, Contact::HEAT); + vec_models.back().mix_coeffs(models[i][i], models[j][j]); } @@ -802,6 +826,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, torquesj = models[itype][jtype]->torquesj; // apply forces & torques + fforce = MathExtra::len3(forces); // set single_extra quantities @@ -863,35 +888,6 @@ double PairGranular::memory_usage() return bytes; } -/* ---------------------------------------------------------------------- - mixing of Young's modulus (E) -------------------------------------------------------------------------- */ - -double PairGranular::mix_stiffnessE(double Eii, double Ejj, - double poisii, double poisjj) -{ - return 1/((1-poisii*poisii)/Eii+(1-poisjj*poisjj)/Ejj); -} - -/* ---------------------------------------------------------------------- - mixing of shear modulus (G) ------------------------------------------------------------------------- */ - -double PairGranular::mix_stiffnessG(double Eii, double Ejj, - double poisii, double poisjj) -{ - return 1/((2*(2-poisii)*(1+poisii)/Eii) + (2*(2-poisjj)*(1+poisjj)/Ejj)); -} - -/* ---------------------------------------------------------------------- - mixing of everything else -------------------------------------------------------------------------- */ - -double PairGranular::mix_geom(double valii, double valjj) -{ - return sqrt(valii*valjj); -} - /* ---------------------------------------------------------------------- transfer history during fix/neigh/history exchange only needed if any history entries i-j are not just negative of j-i entries diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 503e3ed938..e018f9fe7c 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -88,10 +88,6 @@ class PairGranular : public Pair { // optional user-specified global cutoff, per-type user-specified cutoffs double **cutoff_type; double cutoff_global; - - double mix_stiffnessE(double, double, double, double); - double mix_stiffnessG(double, double, double, double); - double mix_geom(double, double); }; } // namespace LAMMPS_NS From 22de863da999a45f7fd3d16c270dedf5337a2665 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 1 Aug 2022 13:12:44 -0600 Subject: [PATCH 14/57] Fixing compilation errors and finishing model classes --- src/GRANULAR/contact.cpp | 209 ++++++++++------ src/GRANULAR/contact.h | 61 +++-- src/GRANULAR/contact_damping_models.cpp | 40 ++-- src/GRANULAR/contact_damping_models.h | 40 ++-- src/GRANULAR/contact_heat_models.cpp | 184 ++------------ src/GRANULAR/contact_heat_models.h | 83 ++----- src/GRANULAR/contact_normal_models.cpp | 184 ++++++++------ src/GRANULAR/contact_normal_models.h | 68 +++--- src/GRANULAR/contact_rolling_models.cpp | 236 +++++------------- src/GRANULAR/contact_rolling_models.h | 79 ++---- src/GRANULAR/contact_sub_models.cpp | 55 +---- src/GRANULAR/contact_sub_models.h | 42 ++-- src/GRANULAR/contact_tangential_models.cpp | 130 +++++----- src/GRANULAR/contact_tangential_models.h | 92 ++++--- src/GRANULAR/contact_twisting_models.cpp | 265 ++++++--------------- src/GRANULAR/contact_twisting_models.h | 81 ++----- src/GRANULAR/pair_granular.cpp | 169 +++++++------ src/GRANULAR/pair_granular.h | 6 +- src/contact.h | 129 +++++----- src/fix_neigh_history.cpp | 6 +- src/pair.h | 2 +- 21 files changed, 903 insertions(+), 1258 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 12a9476585..4358f6df1c 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -18,99 +18,140 @@ */ #include "contact.h" +#include "pointers.h" #include "math_const.h" #include "math_extra.h" -#include "pointers.h" +#include "contact_sub_models.h" +#include "contact_normal_models.h" +#include "contact_tangential_models.h" +#include "contact_damping_models.h" +#include "contact_rolling_models.h" +#include "contact_twisting_models.h" +#include "contact_heat_models.h" #include "comm.h" #include "error.h" #include -using namespace LAMMPS_NS; using namespace MathExtra; -using namespace MathConst; +using namespace LAMMPS_NS::MathConst; +using namespace LAMMPS_NS::Contact; -namespace Contact { - -enum {NORMAL, TANGENTIAL, DAMPING, ROLLING, TWISTING, HEAT} - -ContactModel::ContactModel() +ContactModel::ContactModel() : + Pointers(lmp) { limit_damping = 0; beyond_contact = 0; + nondefault_history_transfer = 0; cutoff_type = 0.0; - normal_model = nullptr; - tangential_model = nullptr; - damping_model = nullptr; - rolling_model = nullptr; - twisting_model = nullptr; + nmodels = 5; + reset_contact(); - sub_models = {nullptr}; + for (int i = 0; i < nmodels; i++) sub_models[i] = nullptr; } /* ---------------------------------------------------------------------- */ -void ContactModel::init_model(char *model_name, int model_type) +ContactModel::~ContactModel() +{ + delete[] transfer_history_factor; +} + +/* ---------------------------------------------------------------------- */ + +void ContactModel::init_model(std::string model_name, ModelType model_type) { if (model_type == NORMAL) { - if (strcmp(model_name, "hooke") == 0) normal_model = new NormalHooke(); - else if (strcmp(model_name, "hertz") == 0) normal_model = new NormalHertz(); - else if (strcmp(model_name, "hertz/material") == 0) normal_model = new NormalHertzMaterial(); - else if (strcmp(model_name, "dmt") == 0) normal_model = new NormalDMT(); - else if (strcmp(model_name, "jkr") == 0) normal_model = new NormalJKR(); + if (model_name == "hooke") normal_model = new NormalHooke(); + else if (model_name == "hertz") normal_model = new NormalHertz(); + else if (model_name == "hertz/material") normal_model = new NormalHertzMaterial(); + else if (model_name == "dmt") normal_model = new NormalDMT(); + else if (model_name == "jkr") normal_model = new NormalJKR(); else error->all(FLERR, "Normal model name not recognized"); - sub_models[model_type] = &normal_model; + sub_models[model_type] = normal_model; } else if (model_type == TANGENTIAL) { - if (strcmp(model_name, "linear_nohistory") == 0) tangential_model = new TangentialLinearNoHistory(); - else if (strcmp(model_name, "linear_history") == 0) tangential_model = new TangentialLinearHistory(); - else if (strcmp(model_name, "mindlin") == 0) tangential_model = new TangentialMindlin(); - else if (strcmp(model_name, "mindlin/force") == 0) tangential_model = new TangentialMindlinForce(); - else if (strcmp(model_name, "mindlin_rescale") == 0) tangential_model = new TangentialMindlinRescale(); - else if (strcmp(model_name, "mindlin_rescale/force") == 0) tangential_model = new TangentialMindlinRescaleForce(); + if (model_name =="linear_nohistory") tangential_model = new TangentialLinearNoHistory(); + else if (model_name =="linear_history") tangential_model = new TangentialLinearHistory(); + else if (model_name =="mindlin") tangential_model = new TangentialMindlin(); + else if (model_name =="mindlin/force") tangential_model = new TangentialMindlinForce(); + else if (model_name =="mindlin_rescale") tangential_model = new TangentialMindlinRescale(); + else if (model_name =="mindlin_rescale/force") tangential_model = new TangentialMindlinRescaleForce(); else error->all(FLERR, "Tangential model name not recognized"); - sub_models[model_type] = &tangential_model; + sub_models[model_type] = tangential_model; } else if (model_type == DAMPING) { - if (strcmp(model_name, "velocity") == 0) damping_model = new DampingVelocity(); - else if (strcmp(model_name, "mass_velocity") == 0) damping_model = new DampingMassVelocity(); - else if (strcmp(model_name, "viscoelastic") == 0) damping_model = new DampingViscoelastic(); - else if (strcmp(model_name, "tsuji") == 0) damping_model = new DampingTsuji(); + if (model_name =="velocity") damping_model = new DampingVelocity(); + else if (model_name =="mass_velocity") damping_model = new DampingMassVelocity(); + else if (model_name =="viscoelastic") damping_model = new DampingViscoelastic(); + else if (model_name =="tsuji") damping_model = new DampingTsuji(); else error->all(FLERR, "Damping model name not recognized"); - sub_models[model_type] = &damping_model; + sub_models[model_type] = damping_model; } else if (model_type == ROLLING) { - if (strcmp(model_name, "none") == 0) delete rolling_model; - else if (strcmp(model_name, "sds") == 0) rolling_model = new RollingSDS(); + if (model_name =="none") delete rolling_model; + else if (model_name =="sds") rolling_model = new RollingSDS(); else error->all(FLERR, "Rolling model name not recognized"); - sub_models[model_type] = &rolling_model; + sub_models[model_type] = rolling_model; } else if (model_type == TWISTING) { - if (strcmp(model_name, "none") == 0) delete twisting_model; - else if (strcmp(model_name, "sds") == 0) twisting_model = new TwistingSDS(); - else if (strcmp(model_name, "marshall") == 0) twisting_model = new TwistingMarshall(); + if (model_name =="none") delete twisting_model; + else if (model_name =="sds") twisting_model = new TwistingSDS(); + else if (model_name =="marshall") twisting_model = new TwistingMarshall(); else error->all(FLERR, "Twisting model name not recognized"); - sub_models[model_type] = &twisting_model; + sub_models[model_type] = twisting_model; } else if (model_type == HEAT) { - if (strcmp(model_name, "none") == 0) delete heat_model; - else if (strcmp(model_name, "area") == 0) heat_model = new HeatArea(); + if (model_name =="none") delete heat_model; + else if (model_name =="area") heat_model = new HeatArea(); else error->all(FLERR, "Heat model name not recognized"); - sub_models[model_type] = &heat_model; + sub_models[model_type] = heat_model; } sub_models[model_type]->name.assign(model_name); - sub_models[model_type]->contact = *this; + sub_models[model_type]->contact = this; sub_models[model_type]->allocate_coeffs(); } /* ---------------------------------------------------------------------- */ +void ContactModel::init() +{ + int i, j, size_cumulative; + for (i = 0; i < nmodels; i++) { + if (sub_models[i]->nondefault_history_transfer) + nondefault_history_transfer = 1; + if (sub_models[i]->beyond_contact) + beyond_contact = 1; + } + + transfer_history_factor = new double(size_history); + for (i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; + + if (nondefault_history_transfer) { + for (i = 0; i < size_history; i++) { + // Find which model controls this history value + size_cumulative = 0; + for (j = 0; j < nmodels; j++) { + if (size_cumulative + sub_models[j]->size_history > i) break; + size_cumulative += sub_models[j]->size_history; + } + + // Check if model has nondefault transfers, if so copy its array + if (sub_models[j]->nondefault_history_transfer) { + transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) { - for (int i = 0; i < 5; i++) - sum_model[i]->mix_coeffs(c1->submodel[i], c2->submodel[i]); + for (int i = 0; i < nmodels; i++) + sub_models[i]->mix_coeffs(c1->sub_models[i], c2->sub_models[i]); limit_damping = MAX(c1->limit_damping, c2->limit_damping); cutoff_type = MAX(c1->cutoff_type, c2->cutoff_type); @@ -120,11 +161,17 @@ void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) void ContactModel::write_restart(FILE *fp) { - int num_char = -1; + int num_char, num_coeffs; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < nmodels; i++) { + num_char = -1; if (sub_models[i]) { - sub_models[i]->write_restart(fp); + num_char = sub_models[i]->name.length(); + num_coeffs = sub_models[i]->num_coeffs; + fwrite(&num_char, sizeof(int), 1, fp); + fwrite(sub_models[i]->name.data(), sizeof(char), num_char, fp); + fwrite(&num_coeffs, sizeof(int), 1, fp); + fwrite(sub_models[i]->coeffs, sizeof(int), num_coeffs, fp); } else { fwrite(&num_char, sizeof(int), 1, fp); } @@ -135,21 +182,34 @@ void ContactModel::write_restart(FILE *fp) void ContactModel::read_restart(FILE *fp) { - int num_char; + int num_char, num_coeff; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < nmodels; i++) { if (comm->me == 0) - utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); - MPI_BCast(&num_char, 1, MPI_INT, 0, world); + utils::sfread(FLERR, &num_char, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&num_char, 1, MPI_INT, 0, world); if (num_char != -1) { - std::string model_name(num_char); + std::string model_name (num_char, ' '); if (comm->me == 0) - utils::sfread(FLERR,const_cast(model_name.data()),sizeof(char),num_char,fp,nullptr, error); - MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); + utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); + MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); - init_model(const_cast(model_name.data(), i)); - sub_models[i]->read_restart(); + init_model(model_name, (ModelType) i); + + if (comm->me == 0) { + utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); + if (num_coeff != sub_models[i]->num_coeffs) + error->one(FLERR, "Invalid contact model written to restart file"); + } + MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); + + if (comm->me == 0) { + utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(int), num_coeff, fp, nullptr, error); + } + MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); + + sub_models[i]->coeffs_to_local(); } } } @@ -158,7 +218,7 @@ void ContactModel::read_restart(FILE *fp) void ContactModel::reset_contact() { - radi = radj = Fntot = Fncrit = magtortwist = 0.0; + radi = radj = Fntot = magtortwist = 0.0; xi = xj = vi = vj = omegai = omegaj = nullptr; forces = torquesi = torquesj = history = nullptr; @@ -177,10 +237,7 @@ bool ContactModel::check_contact() radsum = radi + radj; Reff = radi * radj / radsum; - touch = false; - if (normal_model.beyond_contact) normal_model.touch(touch); - else touch = (rsq < radsum*radsum); - + touch = normal_model->touch(); return touch; } @@ -220,7 +277,7 @@ void ContactModel::prep_contact() sub3(vt, temp, vtr); vrel = len3(vtr); - if (roll_model || twist_model) + if (rolling_model || twisting_model) sub3(omegai, omegaj, relrot); if (rolling_model) { @@ -250,20 +307,24 @@ void ContactModel::calculate_forces() } //********************************************** - // normal forces + // calculate forces //********************************************** double Fne, Fdamp; - Fne = normal_model.calculate_forces(); - Fdamp = damping_model.calculate_forces(); + area = normal_model->calculate_area(); + Fne = normal_model->calculate_forces(); + normal_model->set_knfac(); // Needed for damping + + Fdamp = damping_model->calculate_forces(); + + normal_model->set_fncrit(); // Needed for tangential, rolling, twisting Fntot = Fne + Fdamp; if (limit_damping && Fntot < 0.0) Fntot = 0.0; - normal_model.set_fncrit(); - tangential_model.calculate_forces(); - if (rolling_model) rolling_model.calculate_forces(); - if (twisting_model) twisting_model.calculate_forces(); + tangential_model->calculate_forces(); + if (rolling_model) rolling_model->calculate_forces(); + if (twisting_model) twisting_model->calculate_forces(); //********************************************** // sum contributions @@ -301,7 +362,7 @@ void ContactModel::calculate_forces() double ContactModel::calculate_heat() { - return heat_model.calculate_heat(); + return heat_model->calculate_heat(); } /* ---------------------------------------------------------------------- @@ -311,7 +372,5 @@ double ContactModel::calculate_heat() double ContactModel::pulloff_distance(double radi, double radj) { - return normal_model.pulloff_distance(radi, radj); -} - + return normal_model->pulloff_distance(radi, radj); } diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index f9f18a1eb4..96758771b4 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -14,32 +14,44 @@ #ifndef LMP_CONTACT_H #define LMP_CONTACT_H -#include "pointers.h" -#include "normal_contact_models.h" -#include "tangential_contact_models.h" -#include "damping_contact_models.h" -#include "rolling_contact_models.h" -#include "twisting_contact_models.h" -#include "heat_models.h" - -using namespace LAMMPS_NS; +#include "pointers.h" // IWYU pragma: export +namespace LAMMPS_NS { namespace Contact { +enum ModelType { + NORMAL = 0, + DAMPING = 1, + TANGENTIAL = 2, + ROLLING = 3, + TWISTING = 4, + HEAT = 5 +}; + #define EPSILON 1e-10 +// forward declaration +class NormalModel; +class DampingModel; +class TangentialModel; +class RollingModel; +class TwistingModel; +class HeatModel; +class SubModel; + class ContactModel : protected Pointers { -public: + public: ContactModel(); ~ContactModel(); - int init(); + void init(); bool check_contact(); void reset_contact(); + void prep_contact(); void calculate_forces(); double calculate_heat(); double pulloff_distance(double, double); - void init_model(char*, int); + void init_model(std::string, ModelType); void mix_coeffs(ContactModel*, ContactModel*); @@ -47,21 +59,25 @@ public: void read_restart(FILE *); // Sub models - NormalModel normal_model; - DampingModel damping_model; - TangentialModel tangential_model; - RollingModel rolling_model; - TwistingModel twisting_model; - HeatModel heat_model; + NormalModel *normal_model; + DampingModel *damping_model; + TangentialModel *tangential_model; + RollingModel *rolling_model; + TwistingModel *twisting_model; + HeatModel *heat_model; SubModel *sub_models[6]; // Need to resize if we add more model flavors // Extra options - int beyond_contact, limit_damping; + int beyond_contact, limit_damping, history_update; double cutoff_type; + // History variables + int size_history, nondefault_history_transfer; + double *transfer_history_factor; + double *history; + // Contact properties/output double *forces, *torquesi, *torquesj; - double *history; double radi, radj, meff, dt, Ti, Tj, area; double Fntot, magtortwist; @@ -69,15 +85,18 @@ public: double *xi, *xj, *vi, *vj, *omegai, *omegaj; double fs[3], fr[3], ft[3]; -private: double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; double magtwist; bool touch; + protected: + int prep_flag, check_flag; + int nmodels; }; } // namespace Contact +} // namespace LAMMPS_NS #endif diff --git a/src/GRANULAR/contact_damping_models.cpp b/src/GRANULAR/contact_damping_models.cpp index 1e233234b2..7a79c6946c 100644 --- a/src/GRANULAR/contact_damping_models.cpp +++ b/src/GRANULAR/contact_damping_models.cpp @@ -11,33 +11,22 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "damping_contact_models.h" -#include "math_const.h" +#include "contact_damping_models.h" +#include "contact_normal_models.h" #include "contact.h" - -#include #include "math_special.h" -using namespace MathConst; +using namespace LAMMPS_NS; +using namespace Contact; using namespace MathSpecial; -namespace Contact{ - - /* ---------------------------------------------------------------------- Default damping model ------------------------------------------------------------------------- */ -void DampingModel::DampingModel() -{ - num_coeffs = 0; -} - -/* ---------------------------------------------------------------------- */ - void DampingModel::coeffs_to_local() { - damp = contact.normal_model.damp; + damp = contact->normal_model->damp; } /* ---------------------------------------------------------------------- @@ -46,34 +35,34 @@ void DampingModel::coeffs_to_local() double DampingVelocity::calculate_forces() { - return -damp * contact.vnnr; + return -damp * contact->vnnr; } /* ---------------------------------------------------------------------- Mass velocity damping ------------------------------------------------------------------------- */ -double MassVelocity::calculate_forces() +double DampingMassVelocity::calculate_forces() { - return -damp * contact.meff * contact.vnnr; + return -damp * contact->meff * contact->vnnr; } /* ---------------------------------------------------------------------- Default, viscoelastic damping ------------------------------------------------------------------------- */ -double ViscoElastic::calculate_forces() +double DampingViscoelastic::calculate_forces() { - return -damp * contact.meff * contact.area * contact.vnnr; + return -damp * contact->meff * contact->area * contact->vnnr; } /* ---------------------------------------------------------------------- Tsuji damping ------------------------------------------------------------------------- */ -void Tsuji::coeffs_to_local() +void DampingTsuji::coeffs_to_local() { - double tmp = contact.normal_model.damp; + double tmp = contact->normal_model->damp; damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); damp += -22.348 * cube(tmp)+ 27.467 * powint(tmp, 4); damp += -18.022 * powint(tmp, 5) + 4.8218 * powint(tmp,6); @@ -81,8 +70,7 @@ void Tsuji::coeffs_to_local() /* ---------------------------------------------------------------------- */ -double Tsuji::calculate_forces() +double DampingTsuji::calculate_forces() { - return -damp_scaled * sqrt(contact.meff * contact.normal_model.knfac) * contact.vnnr; + return -damp * sqrt(contact->meff * contact->normal_model->knfac) * contact->vnnr; } - diff --git a/src/GRANULAR/contact_damping_models.h b/src/GRANULAR/contact_damping_models.h index 0fc4fd2c17..440ab36369 100644 --- a/src/GRANULAR/contact_damping_models.h +++ b/src/GRANULAR/contact_damping_models.h @@ -11,60 +11,54 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef DAMPING_CONTACT_MODELS_H_ -#define DAMPING_CONTACT_MODELS_H_ +#ifndef CONTACT_DAMPING_MODELS_H_ +#define CONTACT_DAMPING_MODELS_H_ -#include "contact.h"; -#include "sub_model.h" +#include "contact_sub_models.h" +namespace LAMMPS_NS { namespace Contact { -class DampingModel:SubModel -{ +class DampingModel : public SubModel { public: - DampingModel(); - virtual ~DampingModel() {}; - virtual double calculate_forces() = 0; + DampingModel() {}; + ~DampingModel() {}; virtual void coeffs_to_local(); - virtual void mix_coeffs(NormalModel*, NormalModel*); + virtual void mix_coeffs(DampingModel*, DampingModel*) {}; + virtual double calculate_forces() = 0; double damp; }; /* ---------------------------------------------------------------------- */ -class DampingVelocity:DampingModel -{ +class DampingVelocity: public DampingModel { public: double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class DampingMassVelocity:DampingModel -{ +class DampingMassVelocity: public DampingModel { public: double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class DampingViscoElastic:DampingModel -{ +class DampingViscoelastic: public DampingModel { public: double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class DampingTsuji:DampingModel -{ +class DampingTsuji: public DampingModel { public: - double calculate_forces(); void coeffs_to_local(); + double calculate_forces(); }; +} // namespace Contact +} // namespace LAMMPS_NS -} - -#endif /*DAMPING_CONTACT_MODELS_H_ */ - +#endif /*CONTACT_DAMPING_MODELS_H_ */ diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp index e6bafe4b3c..29134b3e73 100644 --- a/src/GRANULAR/contact_heat_models.cpp +++ b/src/GRANULAR/contact_heat_models.cpp @@ -11,175 +11,39 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "normal_contact_models.h" -#include "math_const.h" +#include "contact_heat_models.h" #include "contact.h" -#include +using namespace LAMMPS_NS; +using namespace Contact; -using namespace MathConst; +/* ---------------------------------------------------------------------- + Area-based heat conduction +------------------------------------------------------------------------- */ -namespace Contact{ - -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define ONETHIRD (1.0/3.0) // 1/3 -#define THREEQUARTERS 0.75 // 3/4 - -// ************************ -// Default behaviors where needed -// ************************ -void NormalModel::set_fncrit(){ - contact->Fncrit = fabs(contact->Fntot); +HeatArea::HeatArea() +{ + num_coeffs = 1; } -void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ - for (int i = 0; i < num_coeffs; i++){ - coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); - } +/* ---------------------------------------------------------------------- */ + +void HeatArea::coeffs_to_local() +{ + conductivity = coeffs[0]; } -//----------------------------------------- +/* ---------------------------------------------------------------------- */ -//****************** -// Hooke -//****************** -void Hooke::Hooke(ContactModel &c){ - contact = c; - num_coeffs = 2; - allocate_coeffs(); +void HeatArea::mix_coeffs(HeatModel* imodel, HeatModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs_to_local(); } -void Hooke::coeffs_to_local(){ - k_norm = coeffs[0]; - damp = coeffs[1]; +/* ---------------------------------------------------------------------- */ + +double HeatArea::calculate_heat() +{ + return conductivity * contact->area * (contact->Ti - contact->Tj); } - -double Hooke::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = k_norm * contact.area; - return contact.knfac * contact.delta; -} - - -//****************** -// Hertz -//****************** -void Hertz::Hertz(ContactModel &c, int mat_flag){ - contact = c; - material_prop_flag = mat_flag; - if (material_prop_flag){ - num_coeffs = 3; - } - else{ - num_coeffs = 2; - } - allocate_coeffs(); -} - -void Hertz::coeffs_to_local(){ - if (material_prop_flag){ - Emod = coeffs[0]; - poiss = coeffs[1]; - k_norm = 4/3*Emod; - } - else{ - k_norm = coeffs[0]; - } -} - -double Hertz::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - return contact.knfac * contact.delta; -} - -//****************** -// DMT -//****************** -void DMT::DMT(ContactModel &c){ - contact = c; - material_prop_flag = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -double DMT::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - double Fne = contact.knfac * contact.delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; - Fne -= F_pulloff; - return Fne; -} - -void DMT::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); -} - -//****************** -// JKR -//****************** -void JKR::JKR(ContactModel &c){ - contact = c; - material_prop_flag = 1; - beyond_contact = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -bool JKR::touch(int touch){ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = contact.Reff * contact.Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = contact.radsum - delta_pulloff; - touchflag = (contact.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rcontact.sq < contact.radsum * contact.radsum); - } - return touchflag; -} - -double JKR::calculate_forces(){ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - return Fne; -} - -void JKR::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); -} - - - diff --git a/src/GRANULAR/contact_heat_models.h b/src/GRANULAR/contact_heat_models.h index 1a2f1ddb7d..469a53cb13 100644 --- a/src/GRANULAR/contact_heat_models.h +++ b/src/GRANULAR/contact_heat_models.h @@ -11,73 +11,36 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef NORMAL_CONTACT_MODELS_H_ -#define NORMAL_CONTACT_MODELS_H_ +#ifndef CONTACT_HEAT_MODELS_H_ +#define CONTACT_HEAT_MODELS_H_ -#include "contact.h"; -#include "sub_model.h" +#include "contact_sub_models.h" +namespace LAMMPS_NS { namespace Contact { -class NormalModel:SubModel{ -public: - NormalModel(){}; - virtual ~NormalModel(){}; - virtual bool check_contact(); - virtual void prep_contact(); - virtual void set_fncrit(); - virtual double calculate_forces() = 0; - virtual void coeffs_to_local(); - virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed - -private: - int beyond_contact = 0; - int allow_limit_damping = 1; - +class HeatModel : public SubModel { + public: + HeatModel() {}; + ~HeatModel() {}; + virtual void coeffs_to_local() {}; + virtual void mix_coeffs(HeatModel*, HeatModel*) {}; + virtual double calculate_heat() = 0; }; -class Hooke:NormalModel{ -public: - Hooke(ContactModel &c); - ~Hooke(){}; +/* ---------------------------------------------------------------------- */ + +class HeatArea: public HeatModel { + public: + HeatArea(); void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp; + void mix_coeffs(HeatModel*, HeatModel*); + double calculate_heat(); + private: + double conductivity; }; -class Hertz:NormalModel{ -public: - Hertz(ContactModel&, int); - ~Hertz(){}; - void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss; -}; - -class DMT:NormalModel{ -public: - DMT(ContactModel &c); - ~DMT(){}; - void coeffs_to_local(); - void coeffs_to_local(NormalModel*, NormalModel*); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; -}; - -class JKR:NormalModel{ -public: - JKR(ContactModel &c); - ~JKR(){}; - void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; - -}; -} - -#endif /*NORMAL_CONTACT_MODELS_H_ */ +} // namespace Contact +} // namespace LAMMPS_NS +#endif /*CONTACT_HEAT_MODELS_H_ */ diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index 9b1d85d123..c11fddb1d7 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -12,15 +12,13 @@ ------------------------------------------------------------------------- */ #include "contact_normal_models.h" -#include "math_const.h" #include "contact.h" +#include "math_const.h" -#include - +using namespace LAMMPS_NS; +using namespace Contact; using namespace MathConst; -namespace Contact{ - #define PI27SQ 266.47931882941264802866 // 27*PI**2 #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) @@ -40,23 +38,40 @@ NormalModel::NormalModel() /* ---------------------------------------------------------------------- */ -void NormalModel::set_fncrit() +bool NormalModel::touch() { - Fncrit = fabs(contact.Fntot); + bool touchflag = (contact->rsq < contact->radsum * contact->radsum); + return touchflag; +} + +/* ---------------------------------------------------------------------- + called outside of compute(), do not assume geometry defined in contact +------------------------------------------------------------------------- */ + +double NormalModel::pulloff_distance(double radi, double radj) +{ + return radi + radj; } /* ---------------------------------------------------------------------- */ -void NormalModel::pulloff_distance(double radi, double radj) +double NormalModel::calculate_area() { - return radi + radj; + return sqrt(contact->dR); +} + +/* ---------------------------------------------------------------------- */ + +void NormalModel::set_fncrit() +{ + Fncrit = fabs(contact->Fntot); } /* ---------------------------------------------------------------------- Hookean normal force ------------------------------------------------------------------------- */ -void NormalHooke::NormalHooke() +NormalHooke::NormalHooke() { num_coeffs = 2; allocate_coeffs(); @@ -66,7 +81,7 @@ void NormalHooke::NormalHooke() void NormalHooke::coeffs_to_local() { - k_norm = coeffs[0]; + k = coeffs[0]; damp = coeffs[1]; } @@ -83,17 +98,22 @@ void NormalHooke::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) double NormalHooke::calculate_forces() { - contact.area = sqrt(contact.dR); - knfac = k_norm * contact.area; - Fne = knfac * contact.delta; + Fne = knfac * contact->delta; return Fne; } +/* ---------------------------------------------------------------------- */ + +void NormalHooke::set_knfac() +{ + knfac = k * contact->area; +} + /* ---------------------------------------------------------------------- Hertzian normal force ------------------------------------------------------------------------- */ -void NormalHertz::NormalHertz() +NormalHertz::NormalHertz() { num_coeffs = 2; } @@ -102,7 +122,7 @@ void NormalHertz::NormalHertz() void NormalHertz::coeffs_to_local() { - k_norm = coeffs[0]; + k = coeffs[0]; damp = coeffs[1]; } @@ -119,17 +139,23 @@ void NormalHertz::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) double NormalHertz::calculate_forces() { - contact.area = sqrt(contact.dR); - knfac = contact.k_norm * contact.area; - Fne = knfac * contact.delta; + contact->area = sqrt(contact->dR); + Fne = knfac * contact->delta; return Fne; } +/* ---------------------------------------------------------------------- */ + +void NormalHertz::set_knfac() +{ + knfac = k * contact->area; +} + /* ---------------------------------------------------------------------- Hertzian normal force with material properties ------------------------------------------------------------------------- */ -void NormalHertzMaterial::NormalHertzMaterial() +NormalHertzMaterial::NormalHertzMaterial() { material_properties = 1; num_coeffs = 3; @@ -142,7 +168,7 @@ void NormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - k_norm = 4 / 3 * Emod; + k = 4 / 3 * Emod; } /* ---------------------------------------------------------------------- */ @@ -159,7 +185,7 @@ void NormalHertzMaterial::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) DMT normal force ------------------------------------------------------------------------- */ -void NormalDMT::NormalDMT(ContactModel &c) +NormalDMT::NormalDMT() { allow_limit_damping = 0; material_properties = 1; @@ -174,7 +200,7 @@ void NormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k_norm = 4 / 3 * Emod; + k = 4 / 3 * Emod; } /* ---------------------------------------------------------------------- */ @@ -192,30 +218,35 @@ void NormalDMT::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) double NormalDMT::calculate_forces() { - contact.area = sqrt(contact.dR); - knfac = k_norm * contact.area; - Fne = knfac * contact.delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; + Fne = knfac * contact->delta; + F_pulloff = 4 * MathConst::MY_PI * cohesion * contact->Reff; Fne -= F_pulloff; return Fne; } /* ---------------------------------------------------------------------- */ +void NormalDMT::set_knfac() +{ + knfac = k * contact->area; +} + +/* ---------------------------------------------------------------------- */ + void NormalDMT::set_fncrit() { - Fncrit = fabs(Fne + 2* F_pulloff); + Fncrit = fabs(Fne + 2 * F_pulloff); } /* ---------------------------------------------------------------------- JKR normal force ------------------------------------------------------------------------- */ -void NormalJKR::NormalJKR(ContactModel &c) +NormalJKR::NormalJKR() { allow_limit_damping = 0; material_properties = 1; - contact.beyond_contact = beyond_contact = 1; + beyond_contact = 1; num_coeffs = 4; } @@ -227,8 +258,8 @@ void NormalJKR::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k_norm = 4/3*Emod; - Escaled = k_norm * THREEQUARTERS; + k = 4/3*Emod; + Escaled = k * THREEQUARTERS; } /* ---------------------------------------------------------------------- */ @@ -244,70 +275,83 @@ void NormalJKR::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) /* ---------------------------------------------------------------------- */ -bool NormalJKR::touch(int touch) +bool NormalJKR::touch() { - double R2, delta_pulloff, dist_pulloff; + double area_at_pulloff, R2, delta_pulloff, dist_pulloff; bool touchflag; - if (touch) { - R2 = contact.Reff * contact.Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = contact.radsum - delta_pulloff; - touchflag = (contact.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rcontact.sq < contact.radsum * contact.radsum); - } + R2 = contact->Reff * contact->Reff; + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); + delta_pulloff = area_at_pulloff * area_at_pulloff / contact->Reff - 2 * sqrt(MY_PI * cohesion * area_at_pulloff /Escaled); + dist_pulloff = contact->radsum - delta_pulloff; + touchflag = (contact->rsq < dist_pulloff * dist_pulloff); + return touchflag; } +/* ---------------------------------------------------------------------- + called outside of compute(), do not assume geometry defined in contact +------------------------------------------------------------------------- */ + +double NormalJKR::pulloff_distance(double radi, double radj) +{ + double area_at_pulloff, Reff_tmp; + + Reff_tmp = radi * radj / (radi + radj); // May not be defined + if (Reff_tmp <= 0) return 0; + + area_at_pulloff = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Escaled)); + return area_at_pulloff * area_at_pulloff / Reff_tmp - 2 * sqrt(MY_PI * cohesion * area_at_pulloff / Escaled); +} + /* ---------------------------------------------------------------------- */ -double NormalJKR::calculate_forces() +double NormalJKR::calculate_area() { double R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2; + double sqrt1, sqrt2, sqrt3; - R2 = Reff * Reff; - dR2 = dR * dR; + R2 = contact->Reff * contact->Reff; + dR2 = contact->dR * contact->dR; t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; + t1 = PI27SQ * t0; + t2 = 8 * contact->dR * dR2 * Escaled * Escaled * Escaled; t3 = 4 * dR2 * Escaled; // in case sqrt(0) < 0 due to precision issues sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); + sqrt2 = MAX(0, 2 * contact->dR + t5); t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - contact.area = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = contact.area * contact.area; - Fne = Escaled * contact.area * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * contact.area)); - F_pulloff = 3 * MY_PI * cohesion * Reff; + sqrt3 = MAX(0, 4 * contact->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + + return INVROOT6 * (t6 + sqrt(sqrt3)); +} + +/* ---------------------------------------------------------------------- */ + +double NormalJKR::calculate_forces() +{ + double a2; + + a2 = contact->area * contact->area; + Fne = Escaled * contact->area * a2 / contact->Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * contact->area)); + F_pulloff = 3 * MY_PI * cohesion * contact->Reff; - knfac = Escaled * contact.area; return Fne; } /* ---------------------------------------------------------------------- */ +void NormalJKR::set_knfac() +{ + knfac = Escaled * contact->area; +} + +/* ---------------------------------------------------------------------- */ + void NormalJKR::set_fncrit() { Fncrit = fabs(Fne + 2 * F_pulloff); } - -/* ---------------------------------------------------------------------- */ - -void NormalJKR::pulloff_distance(double radi, double radj) -{ - double a_tmp, Reff_tmp; - - Reff_tmp = radi * radj / (radi + radj); - if (Reff_tmp <= 0) return 0; - - a_tmp = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Ecaled)); - return a_tmp * a_tmp / Reff_tmp - 2 * sqrt(MY_PI * cohesion * a_tmp / Ecaled); -} - diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index e91d5af1c9..74e2800eaa 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -11,102 +11,108 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef NORMAL_CONTACT_MODELS_H_ -#define NORMAL_CONTACT_MODELS_H_ +#ifndef CONTACT_NORMAL_MODELS_H_ +#define CONTACT_NORMAL_MODELS_H_ -#include "contact.h"; -#include "sub_model.h" +#include "contact_sub_models.h" +namespace LAMMPS_NS { namespace Contact { -class NormalModel:SubModel{ +class NormalModel : public SubModel { public: NormalModel(); - virtual ~NormalModel() {}; - virtual bool check_contact(); - virtual void set_fncrit(); + ~NormalModel() {}; + virtual void coeffs_to_local() {}; + virtual void mix_coeffs(NormalModel*, NormalModel*) {}; + virtual bool touch(); + virtual double pulloff_distance(double, double); + virtual double calculate_area(); virtual double calculate_forces() = 0; - virtual void coeffs_to_local(); - virtual void mix_coeffs(NormalModel*, NormalModel*); - void pulloff_distance(double, double); + virtual void set_knfac() = 0; + virtual void set_fncrit(); double damp; // Vestigial argument needed by damping + double Emod, poiss; double Fncrit, Fne, knfac; int material_properties; }; /* ---------------------------------------------------------------------- */ -class NormalHooke:NormalModel -{ +class NormalHooke: public NormalModel { public: NormalHooke(); ~NormalHooke() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); - double Emod, poiss; + void set_knfac(); + private: + double k; }; /* ---------------------------------------------------------------------- */ -class NormalHertz:NormalModel -{ +class NormalHertz: public NormalModel { public: NormalHertz(); ~NormalHertz() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); + void set_knfac(); private: - double k_norm; + double k; }; /* ---------------------------------------------------------------------- */ -class NormalHertzMaterial:NormalHertz -{ +class NormalHertzMaterial: public NormalHertz { public: NormalHertzMaterial(); ~NormalHertzMaterial() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); private: - double k_norm; + double k; }; /* ---------------------------------------------------------------------- */ -class NormalDMT:NormalModel -{ +class NormalDMT: public NormalModel { public: NormalDMT(); ~NormalDMT() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); - void set_fncrit(); double calculate_forces(); + void set_knfac(); + void set_fncrit(); private: - double k_norm, cohesion; + double k, cohesion; double F_pulloff; }; /* ---------------------------------------------------------------------- */ -class NormalJKR:NormalModel -{ +class NormalJKR: public NormalModel { public: NormalJKR(); ~NormalJKR() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); - void set_fncrit(); + bool touch(); + double pulloff_distance(double, double); + double calculate_area(); double calculate_forces(); - void pulloff_distance(double, double); + void set_knfac(); + void set_fncrit(); private: - double k_norm, cohesion; + double k, cohesion; double Escaled, F_pulloff; }; -} -#endif /*NORMAL_CONTACT_MODELS_H_ */ +} // namespace Contact +} // namespace LAMMPS_NS +#endif /*CONTACT_NORMAL_MODELS_H_ */ diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/GRANULAR/contact_rolling_models.cpp index 5521e10aee..0c256b0fbf 100644 --- a/src/GRANULAR/contact_rolling_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -11,202 +11,71 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "normal_contact_models.h" +#include "contact_normal_models.h" +#include "contact_rolling_models.h" #include "math_const.h" +#include "math_extra.h" #include "contact.h" -#include - +using namespace LAMMPS_NS; +using namespace Contact; using namespace MathConst; +using namespace MathExtra; -namespace Contact{ +/* ---------------------------------------------------------------------- + SDS rolling friction model +------------------------------------------------------------------------- */ -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define ONETHIRD (1.0/3.0) // 1/3 -#define THREEQUARTERS 0.75 // 3/4 - -// ************************ -// Default behaviors where needed -// ************************ -void NormalModel::set_fncrit(){ - contact->Fncrit = fabs(contact->Fntot); +RollingSDS::RollingSDS() +{ + num_coeffs = 3; + size_history = 3; } -void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ - for (int i = 0; i < num_coeffs; i++){ - coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); - } +/* ---------------------------------------------------------------------- */ + +void RollingSDS::coeffs_to_local() +{ + k = coeffs[0]; + mu = coeffs[1]; + gamma = coeffs[2]; } -//----------------------------------------- +/* ---------------------------------------------------------------------- */ -//****************** -// Hooke -//****************** -void Hooke::Hooke(ContactModel &c){ - contact = c; - num_coeffs = 2; - allocate_coeffs(); +void RollingSDS::mix_coeffs(RollingModel* imodel, RollingModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs_to_local(); } -void Hooke::coeffs_to_local(){ - k_norm = coeffs[0]; - damp = coeffs[1]; -} +/* ---------------------------------------------------------------------- */ -double Hooke::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = k_norm * contact.area; - return contact.knfac * contact.delta; -} - - -//****************** -// Hertz -//****************** -void Hertz::Hertz(ContactModel &c, int mat_flag){ - contact = c; - material_prop_flag = mat_flag; - if (material_prop_flag){ - num_coeffs = 3; - } - else{ - num_coeffs = 2; - } - allocate_coeffs(); -} - -void Hertz::coeffs_to_local(){ - if (material_prop_flag){ - Emod = coeffs[0]; - poiss = coeffs[1]; - k_norm = 4/3*Emod; - } - else{ - k_norm = coeffs[0]; - } -} - -double Hertz::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - return contact.knfac * contact.delta; -} - -//****************** -// DMT -//****************** -void DMT::DMT(ContactModel &c){ - contact = c; - material_prop_flag = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -double DMT::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - double Fne = contact.knfac * contact.delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; - Fne -= F_pulloff; - return Fne; -} - -void DMT::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); -} - -//****************** -// JKR -//****************** -void JKR::JKR(ContactModel &c){ - contact = c; - material_prop_flag = 1; - beyond_contact = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -bool JKR::touch(int touch){ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = contact.Reff * contact.Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = contact.radsum - delta_pulloff; - touchflag = (contact.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rcontact.sq < contact.radsum * contact.radsum); - } - return touchflag; -} - -double JKR::calculate_forces(){ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - return Fne; -} - -void JKR::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); -} - - - - -void ContactModel::rolling(double *history) +double RollingSDS::calculate_forces() { int rhist0, rhist1, rhist2, frameupdate; - double rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; + double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; - rhist0 = roll_history_index; + rhist0 = history_index; rhist1 = rhist0 + 1; rhist2 = rhist1 + 1; - Frcrit = mu_roll * Fncrit; + Frcrit = mu * contact->normal_model->Fncrit; - if (history_update) { - hist_temp[0] = history[rhist0]; - hist_temp[1] = history[rhist1]; - hist_temp[2] = history[rhist2]; - rolldotn = dot3(hist_temp, nx); + if (contact->history_update) { + hist_temp[0] = contact->history[rhist0]; + hist_temp[1] = contact->history[rhist1]; + hist_temp[2] = contact->history[rhist2]; + rolldotn = dot3(hist_temp, contact->nx); - frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; + frameupdate = fabs(rolldotn) * k > EPSILON * Frcrit; if (frameupdate) { // rotate into tangential plane rollmag = len3(hist_temp); // projection temp_dbl = -rolldotn; - scale3(temp_dbl, nx, temp_array); + scale3(temp_dbl, contact->nx, temp_array); sub3(hist_temp, temp_array, hist_temp); // also rescale to preserve magnitude @@ -215,35 +84,36 @@ void ContactModel::rolling(double *history) else temp_dbl = 0; scale3(temp_dbl, hist_temp); } - scale3(dt, vrl, temp_array); + scale3(contact->dt, contact->vrl, temp_array); add3(hist_temp, temp_array, hist_temp); } - scaleadd3(k_roll, hist_temp, gamma_roll, vrl, fr); - negate3(fr); + scaleadd3(k, hist_temp, gamma, contact->vrl, contact->fr); + negate3(contact->fr); // rescale frictional displacements and forces if needed - magfr = len3(fr); + magfr = len3(contact->fr); if (magfr > Frcrit) { rollmag = len3(hist_temp); if (rollmag != 0.0) { - temp_dbl = -Frcrit / (magfr * k_roll); - scale3(temp_dbl, fr, temp_array); + temp_dbl = -Frcrit / (magfr * k); + scale3(temp_dbl, contact->fr, temp_array); add3(hist_temp, temp_array, hist_temp); - temp_dbl = -gamma_roll/k_roll; - scale3(temp_dbl, vrl, temp_array); + temp_dbl = -gamma/k; + scale3(temp_dbl, contact->vrl, temp_array); add3(hist_temp, temp_array, hist_temp); temp_dbl = Frcrit / magfr; - scale3(temp_dbl, fr); + scale3(temp_dbl, contact->fr); } else { - zero3(fr); + zero3(contact->fr); } } - history[rhist0] = hist_temp[0]; - history[rhist1] = hist_temp[1]; - history[rhist2] = hist_temp[2]; + contact->history[rhist0] = hist_temp[0]; + contact->history[rhist1] = hist_temp[1]; + contact->history[rhist2] = hist_temp[2]; + return 0; } diff --git a/src/GRANULAR/contact_rolling_models.h b/src/GRANULAR/contact_rolling_models.h index 1a2f1ddb7d..1cd23e1d5d 100644 --- a/src/GRANULAR/contact_rolling_models.h +++ b/src/GRANULAR/contact_rolling_models.h @@ -11,73 +11,36 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef NORMAL_CONTACT_MODELS_H_ -#define NORMAL_CONTACT_MODELS_H_ +#ifndef CONTACT_ROLLING_MODELS_H_ +#define CONTACT_ROLLING_MODELS_H_ -#include "contact.h"; -#include "sub_model.h" +#include "contact_sub_models.h" +namespace LAMMPS_NS { namespace Contact { -class NormalModel:SubModel{ -public: - NormalModel(){}; - virtual ~NormalModel(){}; - virtual bool check_contact(); - virtual void prep_contact(); - virtual void set_fncrit(); +class RollingModel : public SubModel { + public: + RollingModel() {}; + ~RollingModel() {}; + virtual void coeffs_to_local() {}; + virtual void mix_coeffs(RollingModel*, RollingModel*) {}; virtual double calculate_forces() = 0; - virtual void coeffs_to_local(); - virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed - -private: - int beyond_contact = 0; - int allow_limit_damping = 1; - }; -class Hooke:NormalModel{ -public: - Hooke(ContactModel &c); - ~Hooke(){}; +/* ---------------------------------------------------------------------- */ + +class RollingSDS: public RollingModel { + public: + RollingSDS(); void coeffs_to_local(); + void mix_coeffs(RollingModel*, RollingModel*); double calculate_forces(); -private: - double k_norm, damp; + private: + double k, mu, gamma; }; -class Hertz:NormalModel{ -public: - Hertz(ContactModel&, int); - ~Hertz(){}; - void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss; -}; - -class DMT:NormalModel{ -public: - DMT(ContactModel &c); - ~DMT(){}; - void coeffs_to_local(); - void coeffs_to_local(NormalModel*, NormalModel*); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; -}; - -class JKR:NormalModel{ -public: - JKR(ContactModel &c); - ~JKR(){}; - void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; - -}; -} - -#endif /*NORMAL_CONTACT_MODELS_H_ */ +} // namespace Contact +} // namespace LAMMPS_NS +#endif /*CONTACT_ROLLING_MODELS_H_ */ diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index 99fcd638b4..2809204de7 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -16,23 +16,25 @@ Multiple models can be defined and used to calculate forces and torques based on contact geometry */ -#include "contact_sub_model.h" -#include "pointers.h" + +#include "contact_sub_models.h" #include "utils.h" -#include "error.h" -#include "comm.h" using namespace LAMMPS_NS; +using namespace Contact; -namespace Contact{ - -SubModel::SubModel() +SubModel::SubModel() : + Pointers(lmp) { allocated = 0; size_history = 0; history_index = 0; allow_limit_damping = 1; beyond_contact = 0; + num_coeffs = 0; + + nondefault_history_transfer = 0; + transfer_history_factor = nullptr; } /* ---------------------------------------------------------------------- */ @@ -40,6 +42,7 @@ SubModel::SubModel() SubModel::~SubModel() { if (allocated) delete [] coeffs; + delete [] transfer_history_factor; } /* ---------------------------------------------------------------------- */ @@ -62,39 +65,6 @@ void SubModel::parse_coeffs(char **arg, int iarg) coeffs_to_local(); } -/* ---------------------------------------------------------------------- */ - -void SubModel::write_restart(FILE *fp) -{ - fwrite(&model_name.length(),sizeof(int),1,fp); - fwrite(model_name.data(),sizeof(char),model_name.length(),fp); - fwrite(&num_coeffs,sizeof(int),1,fp); - fwrite(coeffs,sizeof(int),num_coeffs,fp); -} - -/* ---------------------------------------------------------------------- */ - -void SubModel::read_restart(FILE *fp, int num_char) -{ - if (comm->me == 0) { - utils::sfread(FLERR,&num_coeffs,sizeof(int),1,fp,nullptr,error); - } - MPI_BCast(const_cast(model_name.data()), num_char, MPI_CHAR, world); - allocate_coeffs(); -} - -/* ---------------------------------------------------------------------- */ - -void SubModel::read_restart(FILE *fp) -{ - int num_char; - if (me == 0) { - utils::sfread(FLERR,&num_char,sizeof(int),1,fp,nullptr,error); - } - MPI_BCast(&num_char, 1, MPI_INT, 0, world); - read_restart(fp, num_char); -} - /* ---------------------------------------------------------------------- mixing of Young's modulus (E) ------------------------------------------------------------------------- */ @@ -115,7 +85,7 @@ double SubModel::mix_stiffnessG(double E1, double E2, double pois1, double pois2) { double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; - double factor2 = 2 * (2 - pois2) * (1 + pois2) / E2) + double factor2 = 2 * (2 - pois2) * (1 + pois2) / E2; return 1 / (factor1 + factor2); } @@ -127,6 +97,3 @@ double SubModel::mix_geom(double val1, double val2) { return sqrt(val1 * val2); } - - -} \ No newline at end of file diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index f659ef1504..7eca7f4152 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -11,44 +11,48 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef GRANULAR_SUB_MODEL_H_ -#define GRANULAR_SUB_MODEL_H_ +#ifndef CONTACT_SUB_MODEL_H_ +#define CONTACT_SUB_MODEL_H_ #include "contact.h" +#include "pointers.h" -using namespace LAMMPS_NS; +namespace LAMMPS_NS { +namespace Contact { -namespace Contact{ - -class SubModel : Pointers{ +class SubModel : protected Pointers { + public: SubModel(); virtual ~SubModel(); -public: + int num_coeffs; double *coeffs; - virtual double calculate_forces() = 0; void read_restart(); - virtual void parse_coeffs(char **, int); - void mix_coeff(SubModel*, SubModel*); - void write_restart(FILE*); - void read_restart(FILE*); - void read_restart(FILE*, int); - virtual void coeffs_to_local(); + void parse_coeffs(char **, int); + virtual void mix_coeffs(SubModel*, SubModel*) {}; + virtual void coeffs_to_local() {}; void allocate_coeffs(); std::string name; -private: - ContactModel &contact; - int allocated; + int size_history; + int nondefault_history_transfer; + double *transfer_history_factor; + int history_index; int beyond_contact; int allow_limit_damping; + ContactModel *contact; + + protected: + int allocated; + double mix_stiffnessE(double, double, double, double); double mix_stiffnessG(double, double, double, double); double mix_geom(double, double); }; -} +} // namespace Contact +} // namespace LAMMPS_NS -#endif /* GRANULAR_SUB_MODEL_H_ */ +#endif /* CONTACT_SUB_MODEL_H_ */ diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 9f092aaf29..45ed993eeb 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -11,15 +11,18 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "tangential_contact_models.h" -#include "math_const.h" +#include "contact_damping_models.h" +#include "contact_normal_models.h" +#include "contact_tangential_models.h" #include "contact.h" +#include "error.h" +#include "math_const.h" +#include "math_extra.h" -#include - +using namespace LAMMPS_NS; +using namespace Contact; using namespace MathConst; - -namespace Contact{ +using namespace MathExtra; /* ---------------------------------------------------------------------- Linear model with no history @@ -35,14 +38,15 @@ TangentialLinearNoHistory::TangentialLinearNoHistory() void TangentialLinearNoHistory::coeffs_to_local() { + k = 0.0; // No tangential stiffness with no history xt = coeffs[0]; mu = coeffs[1]; - damp = xt * contact.damping_model.damp; + damp = xt * contact->damping_model->damp; } /* ---------------------------------------------------------------------- */ -void TangentialLinearNoHistory::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void TangentialLinearNoHistory::mix_coeffs(TangentialModel* imodel, TangentialModel* jmodel) { coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); @@ -56,13 +60,13 @@ void TangentialLinearNoHistory::calculate_forces() double Fscrit, fsmag, Ft; // classic pair gran/hooke (no history) - Fscrit = mu * contact.normal_model.Fncrit - fsmag = damp * contact.vrel; - if (contact.vrel != 0.0) Ft = MIN(Fscrit, fsmag) / contact.vrel; + Fscrit = mu * contact->normal_model->Fncrit; + fsmag = damp * contact->vrel; + if (contact->vrel != 0.0) Ft = MIN(Fscrit, fsmag) / contact->vrel; else Ft = 0.0; Ft = -Ft; - scale3(Ft, contact.vtr, contact.fs); + scale3(Ft, contact->vtr, contact->fs); } /* ---------------------------------------------------------------------- @@ -79,15 +83,15 @@ TangentialLinearHistory::TangentialLinearHistory() void TangentialLinearHistory::coeffs_to_local() { - kt = coeffs[0]; + k = coeffs[0]; xt = coeffs[1]; mu = coeffs[2]; - damp = xt * contact.damping_model.damp; + damp = xt * contact->damping_model->damp; } /* ---------------------------------------------------------------------- */ -void TangentialLinearHistory::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void TangentialLinearHistory::mix_coeffs(TangentialModel* imodel, TangentialModel* jmodel) { coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); @@ -102,20 +106,20 @@ void TangentialLinearHistory::calculate_forces() double Fscrit, magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; int frame_update = 0; - Fscrit = contact.normal_model.Fncrit * mu; + Fscrit = contact->normal_model->Fncrit * mu; - double *history = & contact.history[history_index]; + double *history = & contact->history[history_index]; // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (contact.history_update) { - rsht = dot3(history, contact.nx); - frame_update = fabs(rsht) * kt > EPSILON * Fscrit; + if (contact->history_update) { + rsht = dot3(history, contact->nx); + frame_update = fabs(rsht) * k > EPSILON * Fscrit; if (frame_update) { shrmag = len3(history); // projection - scale3(rsht, contact.nx, history); + scale3(rsht, contact->nx, history); // also rescale to preserve magnitude prjmag = len3(history); if (prjmag > 0) temp_dbl = shrmag / prjmag; @@ -126,28 +130,28 @@ void TangentialLinearHistory::calculate_forces() // update history // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = kt * contact.dt; - scale3(temp_dbl, contact.vtr, temp_array); + temp_dbl = k * contact->dt; + scale3(temp_dbl, contact->vtr, temp_array); sub3(history, temp_array, history); } // tangential forces = history + tangential velocity damping temp_dbl = -damp; - scale3(temp_dbl, contact.vtr, contact.fs); + scale3(temp_dbl, contact->vtr, contact->fs); // rescale frictional displacements and forces if needed - magfs = len3(contact.fs); + magfs = len3(contact->fs); if (magfs > Fscrit) { shrmag = len3(history); if (shrmag != 0.0) { temp_dbl = Fscrit / magfs; - scale3(temp_dbl, contact.fs, history); - scale3(damp, contact.vtr, temp_array); + scale3(temp_dbl, contact->fs, history); + scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); temp_dbl = Fscrit / magfs; - scale3(temp_dbl, contact.fs); + scale3(temp_dbl, contact->fs); } else { - zero3(contact.fs); + zero3(contact->fs); } } } @@ -168,20 +172,22 @@ TangentialMindlin::TangentialMindlin() void TangentialMindlin::coeffs_to_local() { - kt = coeffs[0]; + k = coeffs[0]; xt = coeffs[1]; mu = coeffs[2]; - if (ke == -1) - kt = 8.0 * mix_stiffness(contact.normal_model.Emod, contact.normal_model.Emod, - contact.normal_model.poiss, contact.normal_model.poiss); + if (k == -1) { + if (!contact->normal_model->material_properties) + error->all(FLERR, "Must either specify tangential stiffness or material properties for normal model for the Mindlin tangential style"); + k = 8.0 * mix_stiffnessE(contact->normal_model->Emod, contact->normal_model->Emod, contact->normal_model->poiss, contact->normal_model->poiss); + } - damp = xt * contact.damping_model.damp; + damp = xt * contact->damping_model->damp; } /* ---------------------------------------------------------------------- */ -void TangentialMindlin::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void TangentialMindlin::mix_coeffs(TangentialModel* imodel, TangentialModel* jmodel) { if (imodel->coeffs[0] == -1 || imodel->coeffs[0] == -1) coeffs[0] = -1; else coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); @@ -198,22 +204,22 @@ void TangentialMindlin::calculate_forces() double temp_array[3]; int frame_update = 0; - double *history = & contact.history[history_index]; - Fscrit = contact.normal_model.Fncrit * mu; + double *history = & contact->history[history_index]; + Fscrit = contact->normal_model->Fncrit * mu; - k_scaled = k_tang * contact.area; + k_scaled = k * contact->area; if (mindlin_rescale) { // on unloading, rescale the shear displacements/force - if (contact.area < history[3]) { - temp_dbl = contact.area / history[3]; + if (contact->area < history[3]) { + temp_dbl = contact->area / history[3]; scale3(temp_dbl, history); } } // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (contact.history_update) { - rsht = dot3(history, contact.nx); + if (contact->history_update) { + rsht = dot3(history, contact->nx); if (mindlin_force) frame_update = fabs(rsht) > EPSILON * Fscrit; else @@ -222,7 +228,7 @@ void TangentialMindlin::calculate_forces() if (frame_update) { shrmag = len3(history); // projection - scale3(rsht, contact.nx, history); + scale3(rsht, contact->nx, history); // also rescale to preserve magnitude prjmag = len3(history); if (prjmag > 0) temp_dbl = shrmag / prjmag; @@ -234,42 +240,42 @@ void TangentialMindlin::calculate_forces() if (mindlin_force) { // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = -k_scaled * contact.dt; - scale3(temp_dbl, contact.vtr, temp_array); + temp_dbl = -k_scaled * contact->dt; + scale3(temp_dbl, contact->vtr, temp_array); } else { - scale3(contact.dt, contact.vtr, temp_array); + scale3(contact->dt, contact->vtr, temp_array); } add3(history, temp_array, history); - if (mindlin_rescale) history[3] = contact.area; + if (mindlin_rescale) history[3] = contact->area; } // tangential forces = history + tangential velocity damping temp_dbl = -damp; - scale3(temp_dbl, contact.vtr, contact.fs); + scale3(temp_dbl, contact->vtr, contact->fs); if (! mindlin_force) { scale3(k_scaled, history, temp_array); - add3(contact.fs, temp_array, contact.fs); + add3(contact->fs, temp_array, contact->fs); } // rescale frictional displacements and forces if needed - magfs = len3(contact.fs); + magfs = len3(contact->fs); if (magfs > Fscrit) { shrmag = len3(history); if (shrmag != 0.0) { temp_dbl = Fscrit / magfs; - scale3(temp_dbl, contact.fs, history); - scale3(damp, contact.vtr, temp_array); + scale3(temp_dbl, contact->fs, history); + scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); if (! mindlin_force) { temp_dbl = -1.0 / k_scaled; scale3(temp_dbl, history); } temp_dbl = Fscrit / magfs; - scale3(temp_dbl, contact.fs); + scale3(temp_dbl, contact->fs); } else { - zero3(contact.fs); + zero3(contact->fs); } } } @@ -278,7 +284,7 @@ void TangentialMindlin::calculate_forces() Mindlin force model ------------------------------------------------------------------------- */ -void TangentialMindlinForce::TangentialMindlinForce() +TangentialMindlinForce::TangentialMindlinForce() { num_coeffs = 3; size_history = 3; @@ -290,22 +296,32 @@ void TangentialMindlinForce::TangentialMindlinForce() Mindlin rescale model ------------------------------------------------------------------------- */ -void TangentialMindlinRescale::TangentialMindlinForce() +TangentialMindlinRescale::TangentialMindlinRescale() { num_coeffs = 3; size_history = 4; mindlin_force = 0; mindlin_rescale = 1; + + nondefault_history_transfer = 1; + transfer_history_factor = new double(size_history); + for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; + transfer_history_factor[3] = +1; } /* ---------------------------------------------------------------------- Mindlin rescale force model ------------------------------------------------------------------------- */ -void TangentialMindlinRescaleForce::TangentialMindlinForce() +TangentialMindlinRescaleForce::TangentialMindlinRescaleForce() { num_coeffs = 3; size_history = 4; mindlin_force = 1; mindlin_rescale = 1; + + nondefault_history_transfer = 1; + transfer_history_factor = new double(size_history); + for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; + transfer_history_factor[3] = +1; } diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index c0a5a727f0..f5d83a57f7 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -11,92 +11,84 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef TANGENTIAL_CONTACT_MODELS_H_ -#define TANGENTIAL_CONTACT_MODELS_H_ +#ifndef CONTACT_TANGENTIAL_MODELS_H_ +#define CONTACT_TANGENTIAL_MODELS_H_ -#include "contact.h"; -#include "sub_model.h" +#include "contact_sub_models.h" +namespace LAMMPS_NS { namespace Contact { -class TangentialModel:SubModel -{ -public: +class TangentialModel : public SubModel { + public: TangentialModel() {}; virtual ~TangentialModel() {}; - virtual double calculate_forces() = 0; - virtual void coeffs_to_local(); - virtual void mix_coeffs(TangentialModel*, TangentialModel*); + virtual void coeffs_to_local() {}; + virtual void mix_coeffs(TangentialModel*, TangentialModel*) {}; + virtual void calculate_forces() = 0; int rescale_flag; -private: - int beyond_contact; - int allow_limit_damping; + double k, damp, mu; // Used by Marshall twisting model }; /* ---------------------------------------------------------------------- */ -class TangentialLinearNoHistory:TangentialModel -{ -public: - TangentialLinearNoHistory() - virtual void coeffs_to_local(); - virtual void mix_coeffs(TangentialModel*, TangentialModel*); - double calculate_forces(); -private: - double xt, damp, mu; +class TangentialLinearNoHistory: public TangentialModel { + public: + TangentialLinearNoHistory(); + void coeffs_to_local(); + void mix_coeffs(TangentialModel*, TangentialModel*); + void calculate_forces(); + private: + double xt; }; /* ---------------------------------------------------------------------- */ -class TangentialLinearHistory:TangentialModel -{ -public: - TangentialLinearHistory() - virtual void coeffs_to_local(); - virtual void mix_coeffs(TangentialModel*, TangentialModel*); - double calculate_forces(); -private: - double kt, xt, damp, mu; +class TangentialLinearHistory: public TangentialModel { + public: + TangentialLinearHistory(); + void coeffs_to_local(); + void mix_coeffs(TangentialModel*, TangentialModel*); + void calculate_forces(); + private: + double xt; }; /* ---------------------------------------------------------------------- */ -class TangentialMindlin:TangentialModel -{ -public: +class TangentialMindlin: public TangentialModel { + public: TangentialMindlin(); void coeffs_to_local(); - void coeffs_to_local(TangentialModel*, TangentialModel*); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; + void mix_coeffs(TangentialModel*, TangentialModel*); + void calculate_forces(); + protected: int mindlin_rescale, mindlin_force; + double xt; }; /* ---------------------------------------------------------------------- */ -class TangentialMindlinForce:TangentialMindlin -{ -public: +class TangentialMindlinForce: public TangentialMindlin { + public: TangentialMindlinForce(); }; /* ---------------------------------------------------------------------- */ -class TangentialMindlinRescale:TangentialMindlin -{ -public: +class TangentialMindlinRescale: public TangentialMindlin { + public: TangentialMindlinRescale(); }; /* ---------------------------------------------------------------------- */ -class TangentialMindlinRescaleForce:TangentialMindlinRescale -{ -public: - TangentialMindlinForceRescale(); +class TangentialMindlinRescaleForce: public TangentialMindlin { + public: + TangentialMindlinRescaleForce(); }; -} -#endif /*TANGENTIAL_CONTACT_MODELS_H_ */ +} // namespace Contact +} // namespace LAMMPS_NS +#endif /*CONTACT_TANGENTIAL_MODELS_H_ */ diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 0e9e9115ac..04d89a5b88 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -11,206 +11,99 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "normal_contact_models.h" -#include "math_const.h" +#include "contact_normal_models.h" +#include "contact_tangential_models.h" +#include "contact_twisting_models.h" #include "contact.h" +#include "math_const.h" -#include - +using namespace LAMMPS_NS; +using namespace Contact; using namespace MathConst; -namespace Contact{ +/* ---------------------------------------------------------------------- + Marshall twisting model +------------------------------------------------------------------------- */ -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define ONETHIRD (1.0/3.0) // 1/3 -#define THREEQUARTERS 0.75 // 3/4 - -// ************************ -// Default behaviors where needed -// ************************ -void NormalModel::set_fncrit(){ - contact->Fncrit = fabs(contact->Fntot); -} - -void NormalModel::mix_coeffs(NormalModel* imodel, NormalModel* jmodel){ - for (int i = 0; i < num_coeffs; i++){ - coeffs[i] = sqrt(imodel->coeffs[i]*jmodel->coeffs[i]); - } -} - -//----------------------------------------- - -//****************** -// Hooke -//****************** -void Hooke::Hooke(ContactModel &c){ - contact = c; - num_coeffs = 2; - allocate_coeffs(); -} - -void Hooke::coeffs_to_local(){ - k_norm = coeffs[0]; - damp = coeffs[1]; -} - -double Hooke::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = k_norm * contact.area; - return contact.knfac * contact.delta; -} - - -//****************** -// Hertz -//****************** -void Hertz::Hertz(ContactModel &c, int mat_flag){ - contact = c; - material_prop_flag = mat_flag; - if (material_prop_flag){ - num_coeffs = 3; - } - else{ - num_coeffs = 2; - } - allocate_coeffs(); -} - -void Hertz::coeffs_to_local(){ - if (material_prop_flag){ - Emod = coeffs[0]; - poiss = coeffs[1]; - k_norm = 4/3*Emod; - } - else{ - k_norm = coeffs[0]; - } -} - -double Hertz::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - return contact.knfac * contact.delta; -} - -//****************** -// DMT -//****************** -void DMT::DMT(ContactModel &c){ - contact = c; - material_prop_flag = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -double DMT::calculate_forces(){ - contact.area = sqrt(contact.dR); - contact.knfac = contact.k_norm * contact.area; - double Fne = contact.knfac * contact.delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact.Reff; - Fne -= F_pulloff; - return Fne; -} - -void DMT::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2* F_pulloff); -} - -//****************** -// JKR -//****************** -void JKR::JKR(ContactModel &c){ - contact = c; - material_prop_flag = 1; - beyond_contact = 1; - num_coeffs = 4; - allocate_coeffs(); -} - -bool JKR::touch(int touch){ - double Escaled, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - Escaled = k_norm * THREEQUARTERS; - if (touch) { - R2 = contact.Reff * contact.Reff; - a = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = a * a / contact.Reff - 2 * sqrt(MY_PI * cohesion * a / Escaled); - dist_pulloff = contact.radsum - delta_pulloff; - touchflag = (contact.rsq < dist_pulloff * dist_pulloff); - } else { - touchflag = (rcontact.sq < contact.radsum * contact.radsum); - } - return touchflag; -} - -double JKR::calculate_forces(){ - double Escaled, R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3, a2, F_pulloff, Fne; - - Escaled = k_norm * THREEQUARTERS; - - R2 = Reff * Reff; - dR2 = dR * dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; - t1 = PI27SQ*t0; - t2 = 8 * dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); - a = INVROOT6 * (t6 + sqrt(sqrt3)); - a2 = a * a; - Fne = Escaled * a * a2 / Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * a)); - F_pulloff = 3 * MY_PI * cohesion * Reff; - - knfac = Escaled * a; - return Fne; -} - -void JKR::set_fncrit(){ - contact.Fncrit = fabs(contact.Fne + 2 * F_pulloff); -} - - - - -/* ---------------------------------------------------------------------- */ - -void ContactModel::twisting_marshall(double *history) +TwistingMarshall::TwistingMarshall() { - // Overwrite twist coefficients with derived values - k_twist = 0.5 * k_tang * a * a; // eq 32 of Marshall paper - gamma_twist = 0.5 * gamma_tang * a * a; - mu_twist = TWOTHIRDS * a * mu_tang; - - twisting_SDS(history); + num_coeffs = 0; + size_history = 3; } /* ---------------------------------------------------------------------- */ -void ContactModel::twisting_SDS(double *history) +double TwistingMarshall::calculate_forces() { double signtwist, Mtcrit; - if (history_update) { - history[twist_history_index] += magtwist * dt; + // Calculate twist coefficients from tangential model & contact geometry + // eq 32 of Marshall paper + double k = 0.5 * contact->tangential_model->k * contact->area * contact->area; + double damp = 0.5 * contact->tangential_model->damp * contact->area * contact->area; + double mu = TWOTHIRDS * contact->area * contact->tangential_model->mu; + + if (contact->history_update) { + contact->history[history_index] += contact->magtwist * contact->dt; } - magtortwist = -k_twist * history[twist_history_index] - gamma_twist*magtwist; // M_t torque (eq 30) - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist * Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - history[twist_history_index] = (Mtcrit * signtwist - gamma_twist * magtwist) / k_twist; - magtortwist = -Mtcrit * signtwist; // eq 34 + // M_t torque (eq 30) + contact->magtortwist = -k * contact->history[history_index] - damp * contact->magtwist; + signtwist = (contact->magtwist > 0) - (contact->magtwist < 0); + Mtcrit = mu * contact->normal_model->Fncrit; // critical torque (eq 44) + + if (fabs(contact->magtortwist) > Mtcrit) { + contact->history[history_index] = (Mtcrit * signtwist - damp * contact->magtwist) / k; + contact->magtortwist = -Mtcrit * signtwist; // eq 34 + } +} + +/* ---------------------------------------------------------------------- + SDS twisting model +------------------------------------------------------------------------- */ + +TwistingSDS::TwistingSDS() +{ + num_coeffs = 3; + size_history = 3; +} + +/* ---------------------------------------------------------------------- */ + +void TwistingSDS::coeffs_to_local() +{ + k = coeffs[0]; + mu = coeffs[1]; + damp = coeffs[2]; +} + +/* ---------------------------------------------------------------------- */ + +void TwistingSDS::mix_coeffs(TwistingModel* imodel, TwistingModel* jmodel) +{ + coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +double TwistingSDS::calculate_forces() +{ + double signtwist, Mtcrit; + + if (contact->history_update) { + contact->history[history_index] += contact->magtwist * contact->dt; + } + + // M_t torque (eq 30) + contact->magtortwist = -k * contact->history[history_index] - damp * contact->magtwist; + signtwist = (contact->magtwist > 0) - (contact->magtwist < 0); + Mtcrit = mu * contact->normal_model->Fncrit; // critical torque (eq 44) + + if (fabs(contact->magtortwist) > Mtcrit) { + contact->history[history_index] = (Mtcrit * signtwist - damp * contact->magtwist) / k; + contact->magtortwist = -Mtcrit * signtwist; // eq 34 } } diff --git a/src/GRANULAR/contact_twisting_models.h b/src/GRANULAR/contact_twisting_models.h index 1a2f1ddb7d..e689c8ed35 100644 --- a/src/GRANULAR/contact_twisting_models.h +++ b/src/GRANULAR/contact_twisting_models.h @@ -11,73 +11,44 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef NORMAL_CONTACT_MODELS_H_ -#define NORMAL_CONTACT_MODELS_H_ +#ifndef CONTACT_TWISTING_MODELS_H_ +#define CONTACT_TWISTING_MODELS_H_ -#include "contact.h"; -#include "sub_model.h" +#include "contact_sub_models.h" +namespace LAMMPS_NS { namespace Contact { -class NormalModel:SubModel{ -public: - NormalModel(){}; - virtual ~NormalModel(){}; - virtual bool check_contact(); - virtual void prep_contact(); - virtual void set_fncrit(); +class TwistingModel : public SubModel { + public: + TwistingModel() {}; + virtual ~TwistingModel() {}; + virtual void coeffs_to_local() {}; + virtual void mix_coeffs(TwistingModel*, TwistingModel*) {}; virtual double calculate_forces() = 0; - virtual void coeffs_to_local(); - virtual void mix_coeffs(NormalModel*, NormalModel*); //When mixing is needed - -private: - int beyond_contact = 0; - int allow_limit_damping = 1; - }; -class Hooke:NormalModel{ -public: - Hooke(ContactModel &c); - ~Hooke(){}; - void coeffs_to_local(); +/* ---------------------------------------------------------------------- */ + +class TwistingMarshall: public TwistingModel { + public: + TwistingMarshall(); double calculate_forces(); -private: - double k_norm, damp; }; -class Hertz:NormalModel{ -public: - Hertz(ContactModel&, int); - ~Hertz(){}; +/* ---------------------------------------------------------------------- */ + +class TwistingSDS: public TwistingModel { + public: + TwistingSDS(); void coeffs_to_local(); + void mix_coeffs(TwistingModel*, TwistingModel*); double calculate_forces(); -private: - double k_norm, damp, Emod, poiss; + private: + double k, mu, damp; }; -class DMT:NormalModel{ -public: - DMT(ContactModel &c); - ~DMT(){}; - void coeffs_to_local(); - void coeffs_to_local(NormalModel*, NormalModel*); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; -}; - -class JKR:NormalModel{ -public: - JKR(ContactModel &c); - ~JKR(){}; - void coeffs_to_local(); - double calculate_forces(); -private: - double k_norm, damp, Emod, poiss, coh; - -}; -} - -#endif /*NORMAL_CONTACT_MODELS_H_ */ +} // namespace Contact +} // namespace LAMMPS_NS +#endif /*CONTACT_TWISTING_MODELS_H_ */ diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 5816850ef2..e401f8cb84 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -23,14 +23,19 @@ #include "atom.h" #include "comm.h" #include "contact.h" +#include "contact_sub_models.h" +#include "contact_normal_models.h" +#include "contact_tangential_models.h" +#include "contact_damping_models.h" +#include "contact_rolling_models.h" +#include "contact_twisting_models.h" +#include "contact_heat_models.h" #include "error.h" #include "fix.h" #include "fix_dummy.h" #include "fix_neigh_history.h" #include "force.h" -#include "math_const.h" #include "math_extra.h" -#include "math_special.h" #include "memory.h" #include "modify.h" #include "neigh_list.h" @@ -38,14 +43,12 @@ #include "neighbor.h" #include "update.h" -#include #include #include using namespace LAMMPS_NS; -using namespace MathConst; -using namespace MathSpecial; using namespace Contact; +using namespace MathExtra; /* ---------------------------------------------------------------------- */ @@ -69,8 +72,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) maxrad_dynamic = nullptr; maxrad_frozen = nullptr; - history_transfer_factors = nullptr; - dt = update->dt; // set comm size needed by this Pair if used with fix rigid @@ -97,7 +98,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) PairGranular::~PairGranular() { delete[] svector; - delete[] history_transfer_factors; if (!fix_history) modify->delete_fix("NEIGH_HISTORY_GRANULAR_DUMMY"); else modify->delete_fix("NEIGH_HISTORY_GRANULAR"); @@ -121,7 +121,7 @@ void PairGranular::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double factor_lj,mi,mj,meff,delx,dely,delz; - double forces[3], torquesi[3], torquesj[3]; + double *forces, *torquesi, *torquesj; int *ilist,*jlist,*numneigh,**firstneigh; int *touch,**firsttouch; @@ -259,17 +259,17 @@ void PairGranular::compute(int eflag, int vflag) torquesj = models[itype][jtype]->torquesj; // apply forces & torques - MathExtra::scale3(factor_lj, forces); - MathExtra::add3(f[i], forces, f[i]); + scale3(factor_lj, forces); + add3(f[i], forces, f[i]); - MathExtra::scale3(factor_lj, torquesi); - MathExtra::add3(torque[i], torquesi, torque[i]); + scale3(factor_lj, torquesi); + add3(torque[i], torquesi, torque[i]); if (heat_flag) heatflux[i] += dq; if (force->newton_pair || j < nlocal) { - MathExtra::sub3(f[j], forces, f[j]); - MathExtra::scale3(factor_lj, torquesj); - MathExtra::add3(torque[j], torquesj, torque[j]); + sub3(f[j], forces, f[j]); + scale3(factor_lj, torquesj); + add3(torque[j], torquesj, torque[j]); if (heat_flag) heatflux[j] -= dq; } @@ -301,8 +301,7 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - - models = (ContactModel **) memory->srealloc(fix, n+1,n+1, "pair:contact_models"); + memory->create(models,n+1,n+1,"pair:contact_models"); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -349,26 +348,26 @@ void PairGranular::coeff(int narg, char **arg) //Parse mandatory normal and tangential specifications int iarg = 2; - vec_models.back().init(arg[iarg], Contact::NORMAL); - ncoeff = vec_models.back().normal_model.num_coeffs + vec_models.back().init_model(std::string(arg[iarg]), NORMAL); + ncoeff = vec_models.back().normal_model->num_coeffs; iarg += 1; if (iarg + ncoeff >= narg) error->all(FLERR,"Illegal pair_coeff command" "Insufficient arguments provided for normal model."); - vec_models.back().normal_model.parse_coeffs(arg, iarg); + vec_models.back().normal_model->parse_coeffs(arg, iarg); iarg += ncoeff; if (strcmp(arg[iarg], "tangential") == 0) { if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_coeff command, must specify " "tangential model after tangential keyword"); - vec_models.back().init(arg[iarg], Contact::TANGENTIAL); - ncoeff = vec_models.back().tangential_model.num_coeffs; + vec_models.back().init_model(std::string(arg[iarg]), TANGENTIAL); + ncoeff = vec_models.back().tangential_model->num_coeffs; iarg += 1; if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for tangential model."); - vec_models.back().tangential_model.parse_coeffs(arg, iarg); + vec_models.back().tangential_model->parse_coeffs(arg, iarg); iarg += ncoeff; } else{ error->all(FLERR, "Illegal pair_coeff command, 'tangential' keyword expected"); @@ -379,49 +378,49 @@ void PairGranular::coeff(int narg, char **arg) if (strcmp(arg[iarg], "damping") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init(arg[iarg], Contact::DAMPING); - ncoeff = vec_models.back().damping_model.num_coeffs; + vec_models.back().init_model(std::string(arg[iarg]), DAMPING); + ncoeff = vec_models.back().damping_model->num_coeffs; iarg += 1; if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for damping model."); - vec_models.back().damping_model.parse_coeffs(arg, iarg); + vec_models.back().damping_model->parse_coeffs(arg, iarg); iarg += ncoeff; } else if (strcmp(arg[iarg], "rolling") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init(arg[iarg], Contact::ROLLING); - ncoeff = vec_models.back().rolling_model.num_coeffs; + vec_models.back().init_model(std::string(arg[iarg]), ROLLING); + ncoeff = vec_models.back().rolling_model->num_coeffs; iarg += 1; if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for rolling model."); - vec_models.back().rolling_model.parse_coeffs(arg, iarg); + vec_models.back().rolling_model->parse_coeffs(arg, iarg); iarg += ncoeff; } else if (strcmp(arg[iarg], "twisting") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init(arg[iarg], Contact::TWISTING); - ncoeff = vec_models.back().twisting_model.num_coeffs; + vec_models.back().init_model(std::string(arg[iarg]), TWISTING); + ncoeff = vec_models.back().twisting_model->num_coeffs; iarg += 1; if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for twisting model."); - vec_models.back().twisting_model.parse_coeffs(arg, iarg); + vec_models.back().twisting_model->parse_coeffs(arg, iarg); iarg += ncoeff; } else if (strcmp(arg[iarg], "heat") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init(arg[iarg], Contact::HEAT); - ncoeff = vec_models.back().heat_model.num_coeffs; + vec_models.back().init_model(std::string(arg[iarg]), HEAT); + ncoeff = vec_models.back().heat_model->num_coeffs; iarg += 1; if (iarg + ncoeff >= narg) error->all(FLERR, "Illegal pair_coeff command" "Insufficient arguments provided for heat model."); - vec_models.back().heat_model.parse_coeffs(arg, iarg); + vec_models.back().heat_model->parse_coeffs(arg, iarg); iarg += ncoeff; heat_flag = 1; @@ -440,8 +439,8 @@ void PairGranular::coeff(int narg, char **arg) // Define default damping model if unspecified, takes no args if (!vec_models.back().damping_model) { - vec_models.back().init("viscoelastic", Contact::DAMPING); - vec_models.back().damping_model.parse_coeffs(arg, 0); + vec_models.back().init_model("viscoelastic", DAMPING); + vec_models.back().damping_model->parse_coeffs(arg, 0); } if (vec_models.back().limit_damping && !vec_models.back().normal_model->allow_limit_damping) @@ -475,38 +474,41 @@ void PairGranular::init_style() if (comm->ghost_velocity == 0) error->all(FLERR,"Pair granular requires ghost atoms store velocity"); - // allocate history + // allocate history and initialize models int size_normal_history = 0; + int size_damping_history = 0; int size_tangential_history = 0; int size_rolling_history = 0; int size_twisting_history = 0; for (int i = 1; i <= atom->ntypes; i++) { for (int j = i; j <= atom->ntypes; j++) { - if (models[i][j]->normal_model.history_flag || - models[i][j]->tangential_model.history_flag || - models[i][j]->rolling_model.history_flag || - models[i][j]->twisting_model.history_flag) use_history = 1; - - if (models[i][j]->nondefault_history_transfer) // ??? + if (models[i][j]->normal_model->size_history != 0 || + models[i][j]->damping_model->size_history != 0 || + models[i][j]->tangential_model->size_history != 0 || + models[i][j]->rolling_model->size_history != 0 || + models[i][j]->twisting_model->size_history != 0) use_history = 1; if (models[i][j]->normal_model->size_history > size_normal_history) - size_normal_history = models[i][j]->normal_model.size_history; + size_normal_history = models[i][j]->damping_model->size_history; + if (models[i][j]->damping_model->size_history > size_damping_history) + size_damping_history = models[i][j]->normal_model->size_history; if (models[i][j]->tangential_model->size_history > size_tangential_history) - size_tangential_history = models[i][j]->tangential_model.size_history; + size_tangential_history = models[i][j]->tangential_model->size_history; if (models[i][j]->rolling_model->size_history > size_rolling_history) - size_rolling_history = models[i][j]->rolling_model.size_history; + size_rolling_history = models[i][j]->rolling_model->size_history; if (models[i][j]->twisting_model->size_history > size_twisting_history) - size_twisting_history = models[i][j]->twisting_model.size_history; + size_twisting_history = models[i][j]->twisting_model->size_history; } } - size_history = size_normal_history + size_tangential_history + - size_rolling_history + size_twisting_history; + size_history = size_normal_history + size_damping_history + + size_tangential_history + size_rolling_history + size_twisting_history; - tangential_history_index = size_normal_history; - roll_history_index = size_normal_history + size_tangential_history; - twist_history_index = size_normal_history + size_tangential_history + size_rolling_history; + damping_history_index = size_normal_history; + tangential_history_index = size_normal_history + damping_history_index; + roll_history_index = size_normal_history + damping_history_index + size_tangential_history; + twist_history_index = size_normal_history + damping_history_index + size_tangential_history + size_rolling_history; if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY); else neighbor->add_request(this, NeighConst::REQ_SIZE); @@ -601,11 +603,11 @@ double PairGranular::init_one(int i, int j) double cutoff = 0.0; if (setflag[i][j] == 0) { - if ((models[i][i]->normal_model.name != models[j][j]->normal_model.name) || - (models[i][i]->damping_model.name != models[j][j]->damping_model.name) || - (models[i][i]->tangential_model.name != models[j][j]->tangential_model.name) || - (models[i][i]->rolling_model.name != models[j][j]->rolling_model.name) || - (models[i][i]->twisting_model.name != models[j][j]->twisting_model.name)) { + if ((models[i][i]->normal_model->name != models[j][j]->normal_model->name) || + (models[i][i]->damping_model->name != models[j][j]->damping_model->name) || + (models[i][i]->tangential_model->name != models[j][j]->tangential_model->name) || + (models[i][i]->rolling_model->name != models[j][j]->rolling_model->name) || + (models[i][i]->twisting_model->name != models[j][j]->twisting_model->name)) { error->all(FLERR,"Granular pair style functional forms are different, " "cannot mix coefficients for types {} and {}. \n" "This combination must be set explicitly via a " @@ -614,12 +616,12 @@ double PairGranular::init_one(int i, int j) vec_models.push_back(ContactModel()); models[i][j] = models[j][i] = & vec_models.back(); - vec_models.back().init(models[i][i]->normal_model.name, Contact::NORMAL); - vec_models.back().init(models[i][i]->tangential_model.name, Contact::TANGENTIAL); - vec_models.back().init(models[i][i]->damping_model.name, Contact::DAMPING); - vec_models.back().init(models[i][i]->rolling_model.name, Contact::ROLLING); - vec_models.back().init(models[i][i]->twisting_model.name, Contact::TWISTING); - vec_models.back().init(models[i][i]->heat_model.name, Contact::HEAT); + vec_models.back().init_model(models[i][i]->normal_model->name, NORMAL); + vec_models.back().init_model(models[i][i]->tangential_model->name, TANGENTIAL); + vec_models.back().init_model(models[i][i]->damping_model->name, DAMPING); + vec_models.back().init_model(models[i][i]->rolling_model->name, ROLLING); + vec_models.back().init_model(models[i][i]->twisting_model->name, TWISTING); + vec_models.back().init_model(models[i][i]->heat_model->name, HEAT); vec_models.back().mix_coeffs(models[i][i], models[j][j]); } @@ -675,10 +677,16 @@ double PairGranular::init_one(int i, int j) // Copy global options models[i][j]->dt = models[j][i]->dt = dt; - models[i][j]->normal_model.history_index = models[j][i]->normal_model.history_index = normal_history_index; - models[i][j]->tangential_model.history_index = models[j][i]->tangential_model.history_index = tangential_history_index; - models[i][j]->rolling_model.history_index = models[j][i]->rolling_model.history_index = rolling_history_index; - models[i][j]->twisting_model.history_index = models[j][i]->twisting_model.history_index = twisting_history_index; + models[i][j]->normal_model->history_index = models[j][i]->normal_model->history_index = normal_history_index; + models[i][j]->tangential_model->history_index = models[j][i]->tangential_model->history_index = tangential_history_index; + models[i][j]->rolling_model->history_index = models[j][i]->rolling_model->history_index = roll_history_index; + models[i][j]->twisting_model->history_index = models[j][i]->twisting_model->history_index = twist_history_index; + + models[i][j]->size_history = models[j][i]->size_history = size_history; + models[i][j]->init(); // Calculates cumulative properties of sub models + models[j][i]->init(); + + if (models[i][j]->nondefault_history_transfer) nondefault_history_transfer = 1; return cutoff; } @@ -718,7 +726,7 @@ void PairGranular::read_restart(FILE *fp) if (setflag[i][j]) { vec_models.push_back(ContactModel()); models[i][j] = & vec_models.back(); - models[i][j]->read_restart(); + models[i][j]->read_restart(fp); } } } @@ -729,6 +737,12 @@ void PairGranular::read_restart(FILE *fp) void PairGranular::reset_dt() { dt = update->dt; + + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = i; j <= atom->ntypes; j++) { + models[i][j]->dt = dt; + } + } } /* ---------------------------------------------------------------------- */ @@ -819,7 +833,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, history = &allhistory[size_history*neighprev]; } - double forces[3], torquesi[3], torquesj[3]; + double *forces, *torquesi, *torquesj; models[itype][jtype]->calculate_forces(); forces = models[itype][jtype]->forces; torquesi = models[itype][jtype]->torquesi; @@ -893,11 +907,16 @@ double PairGranular::memory_usage() only needed if any history entries i-j are not just negative of j-i entries ------------------------------------------------------------------------- */ -void PairGranular::transfer_history(double* source, double* target, int source_type, int target_type) +void PairGranular::transfer_history(double* source, double* target, int itype, int jtype) { - models[itype][jtype]->transfer_history(); - for (int i = 0; i < size_history; i++){ - target[i] = history_transfer_factors[i]*source[i]; + if (models[itype][jtype]->nondefault_history_transfer) { + for (int i = 0; i < size_history; i++) { + target[i] = models[itype][jtype]->transfer_history_factor[i] * source [i]; + } + } else { + for (int i = 0; i < size_history; i++) { + target[i] = -source[i]; + } } } diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index e018f9fe7c..1032cf6b7c 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -22,7 +22,7 @@ PairStyle(granular,PairGranular); #include "contact.h" #include "pair.h" -#include "vector.h" +#include namespace LAMMPS_NS { @@ -65,11 +65,10 @@ class PairGranular : public Pair { int nmax; // allocated size of mass_rigid void allocate(); - void transfer_history(double *, double *) override; + void transfer_history(double *, double *, int, int) override; private: int size_history; - int *history_transfer_factors; int heat_flag; // contact models @@ -81,6 +80,7 @@ class PairGranular : public Pair { // indices of history entries int normal_history_index; + int damping_history_index; int tangential_history_index; int roll_history_index; int twist_history_index; diff --git a/src/contact.h b/src/contact.h index 167f88e9de..96758771b4 100644 --- a/src/contact.h +++ b/src/contact.h @@ -14,78 +14,89 @@ #ifndef LMP_CONTACT_H #define LMP_CONTACT_H +#include "pointers.h" // IWYU pragma: export + +namespace LAMMPS_NS { namespace Contact { - enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; - enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; - enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; - enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; - enum {ROLL_NONE, ROLL_SDS}; +enum ModelType { + NORMAL = 0, + DAMPING = 1, + TANGENTIAL = 2, + ROLLING = 3, + TWISTING = 4, + HEAT = 5 +}; - #define PI27SQ 266.47931882941264802866 // 27*PI**2 - #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) - #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) - #define INVROOT6 0.40824829046386307274 // 1/sqrt(6) - #define FOURTHIRDS (4.0/3.0) // 4/3 - #define ONETHIRD (1.0/3.0) // 1/3 - #define THREEQUARTERS 0.75 // 3/4 +#define EPSILON 1e-10 - #define EPSILON 1e-10 +// forward declaration +class NormalModel; +class DampingModel; +class TangentialModel; +class RollingModel; +class TwistingModel; +class HeatModel; +class SubModel; - class ContactModel { - public: - ContactModel(); - void reset_contact(); - bool check_contact(); - void prep_contact(); - void calculate_forces(double *, double *, double *, double *); - double calculate_heat(); - double pulloff_distance(double, double); +class ContactModel : protected Pointers { + public: + ContactModel(); + ~ContactModel(); + void init(); + bool check_contact(); + void reset_contact(); + void prep_contact(); + void calculate_forces(); + double calculate_heat(); + double pulloff_distance(double, double); - int normal_model, damping_model, tangential_model; - int roll_model, twist_model; - int limit_damping; - double cutoff_type; - double Emod, poisson; // variables used in defining mixed interactions - double k_norm, gamma_norm, cohesion; // normal_coeffs - double k_tang, gamma_tang, mu_tang; // tangential_coeffs - wutang? - double k_roll, gamma_roll, mu_roll; // roll_coeffs - double k_twist, gamma_twist, mu_twist; // twist_coeffs - double conductivity; + void init_model(std::string, ModelType); - double radi, radj, meff, dt, Ti, Tj; - double *xi, *xj, *vi, *vj, *omegai, *omegaj; - int history_update, roll_history_index, twist_history_index; + void mix_coeffs(ContactModel*, ContactModel*); - double fs[3], fr[3], ft[3], magtortwist; + void write_restart(FILE *); + void read_restart(FILE *); - private: - double a, knfac, Fntot, Fncrit, Fscrit, Frcrit, damp_normal_prefactor; - double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; - double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; - double magtwist; - bool touch; + // Sub models + NormalModel *normal_model; + DampingModel *damping_model; + TangentialModel *tangential_model; + RollingModel *rolling_model; + TwistingModel *twisting_model; + HeatModel *heat_model; + SubModel *sub_models[6]; // Need to resize if we add more model flavors - int prep_flag, check_flag; - int mindlin_rescale, mindlin_force; + // Extra options + int beyond_contact, limit_damping, history_update; + double cutoff_type; - bool touch_JKR(int); - double normal_JKR(); - double normal_DMT(); - double normal_Hertz(); - double normal_Hooke(); - double normal_damping(); - void tangential_no_history(); - void tangential_history(double *); - void tangential_mindlin(double *); - void rolling(double *); - void twisting_marshall(double *); - void twisting_SDS(double *); + // History variables + int size_history, nondefault_history_transfer; + double *transfer_history_factor; + double *history; - }; + // Contact properties/output + double *forces, *torquesi, *torquesj; + + double radi, radj, meff, dt, Ti, Tj, area; + double Fntot, magtortwist; + + double *xi, *xj, *vi, *vj, *omegai, *omegaj; + double fs[3], fr[3], ft[3]; + + double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; + double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; + double magtwist; + bool touch; + + protected: + + int prep_flag, check_flag; + int nmodels; +}; } // namespace Contact +} // namespace LAMMPS_NS #endif diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 37d1b37946..975d93ff83 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -337,6 +337,7 @@ void FixNeighHistory::pre_exchange_newton() int *ilist,*jlist,*numneigh,**firstneigh; int *allflags; double *allvalues,*onevalues,*jvalues; + int *type = atom->type; // NOTE: all operations until very end are with // nlocal_neigh <= current nlocal and nall_neigh @@ -430,7 +431,7 @@ void FixNeighHistory::pre_exchange_newton() partner[j][m] = tag[i]; jvalues = &valuepartner[j][dnum*m]; if (pair->nondefault_history_transfer) - pair->transfer_history(onevalues,jvalues); + pair->transfer_history(onevalues,jvalues,type[i],type[j]); else for (n = 0; n < dnum; n++) jvalues[n] = -onevalues[n]; } } @@ -469,6 +470,7 @@ void FixNeighHistory::pre_exchange_no_newton() int *ilist,*jlist,*numneigh,**firstneigh; int *allflags; double *allvalues,*onevalues,*jvalues; + int *type = atom->type; // NOTE: all operations until very end are with nlocal_neigh <= current nlocal // because previous neigh list was built with nlocal_neigh @@ -544,7 +546,7 @@ void FixNeighHistory::pre_exchange_no_newton() partner[j][m] = tag[i]; jvalues = &valuepartner[j][dnum*m]; if (pair->nondefault_history_transfer) - pair->transfer_history(onevalues, jvalues); + pair->transfer_history(onevalues, jvalues,type[i],type[j]); else for (n = 0; n < dnum; n++) jvalues[n] = -onevalues[n]; } } diff --git a/src/pair.h b/src/pair.h index 4763a225d2..9e72f03d23 100644 --- a/src/pair.h +++ b/src/pair.h @@ -211,7 +211,7 @@ class Pair : protected Pointers { virtual void min_xf_pointers(int, double **, double **) {} virtual void min_xf_get(int) {} virtual void min_x_set(int) {} - virtual void transfer_history(double *, double *) {} + virtual void transfer_history(double *, double *, int, int) {} virtual double atom2cut(int) { return 0.0; } virtual double radii2cut(double, double) { return 0.0; } From df22b91ac35ebe4d7faf0cacb6009fc1b47583cd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 8 Aug 2022 08:01:48 -0600 Subject: [PATCH 15/57] Updating coeff parsing, first pass on fix wall/gran, misc fixes --- src/GRANULAR/contact.cpp | 114 +- src/GRANULAR/contact.h | 6 +- src/GRANULAR/contact_heat_models.cpp | 3 + src/GRANULAR/contact_normal_models.cpp | 11 + src/GRANULAR/contact_rolling_models.cpp | 6 +- src/GRANULAR/contact_sub_models.cpp | 8 +- src/GRANULAR/contact_sub_models.h | 2 +- src/GRANULAR/contact_tangential_models.cpp | 9 + src/GRANULAR/contact_twisting_models.cpp | 4 + src/GRANULAR/fix_wall_gran.cpp | 1357 +++----------------- src/GRANULAR/fix_wall_gran.h | 38 +- src/GRANULAR/fix_wall_gran_region.cpp | 167 +-- src/GRANULAR/pair_granular.cpp | 103 +- src/GRANULAR/pair_granular.h | 3 - src/contact.h | 6 +- 15 files changed, 477 insertions(+), 1360 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 4358f6df1c..7ce3d8c739 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -30,6 +30,7 @@ #include "contact_heat_models.h" #include "comm.h" #include "error.h" +#include "force.h" #include @@ -44,6 +45,7 @@ ContactModel::ContactModel() : beyond_contact = 0; nondefault_history_transfer = 0; cutoff_type = 0.0; + wall_flag = 0; nmodels = 5; reset_contact(); @@ -107,6 +109,8 @@ void ContactModel::init_model(std::string model_name, ModelType model_type) else if (model_name =="area") heat_model = new HeatArea(); else error->all(FLERR, "Heat model name not recognized"); sub_models[model_type] = heat_model; + } else { + error->all(FLERR, "Illegal model type"); } sub_models[model_type]->name.assign(model_name); @@ -116,14 +120,82 @@ void ContactModel::init_model(std::string model_name, ModelType model_type) /* ---------------------------------------------------------------------- */ +int ContactModel::init_classic_model(char **arg, int iarg, int narg) +{ + double kn, kt, gamman, gammat, xmu; + + if (iarg + 6 >= narg) + error->all(FLERR,"Insufficient arguments provided for classic gran model command"); + + kn = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + if (strcmp(arg[iarg + 2],"NULL") == 0) kt = kn * 2.0 / 7.0; + else kt = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + + gamman = utils::numeric(FLERR,arg[iarg + 3],false,lmp); + if (strcmp(arg[iarg + 4],"NULL") == 0) gammat = 0.5 * gamman; + else gammat = utils::numeric(FLERR,arg[iarg + 4],false,lmp); + + xmu = utils::numeric(FLERR,arg[iarg + 5],false,lmp); + int dampflag = utils::inumeric(FLERR,arg[iarg + 6],false,lmp); + if (dampflag == 0) gammat = 0.0; + + if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || + xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) + error->all(FLERR,"Illegal classic gran model command"); + + if (strcmp(arg[iarg],"hooke") == 0) { + init_model("hooke", NORMAL); + init_model("linear_nohistory", TANGENTIAL); + } else if (strcmp(arg[iarg],"hooke/history") == 0) { + init_model("hooke", NORMAL); + init_model("linear_history", TANGENTIAL); + } else if (strcmp(arg[iarg],"hertz/history") == 0) { + // convert Kn and Kt from pressure units to force/distance^2 if Hertzian + kn /= force->nktv2p; + kt /= force->nktv2p; + init_model("hertz", NORMAL); + init_model("mindlin", TANGENTIAL); // Dan is this right? + } else error->all(FLERR,"Invalid classic gran model"); + init_model("mass_velocity", DAMPING); + + // ensure additional models are undefined + rolling_model = nullptr; + twisting_model = nullptr; + heat_model = nullptr; + + // manually parse coeffs + normal_model->coeffs[0] = kn; + normal_model->coeffs[1] = gamman; + tangential_model->coeffs[0] = kt; + tangential_model->coeffs[1] = gammat; + tangential_model->coeffs[2] = xmu; + + normal_model->coeffs_to_local(); + tangential_model->coeffs_to_local(); + damping_model->coeffs_to_local(); + + iarg += 7; + return iarg ; +} + +/* ---------------------------------------------------------------------- */ + void ContactModel::init() { + if (!normal_model) error->all(FLERR, "Must specify normal contact model"); + if (!damping_model) error->all(FLERR, "Must specify damping contact model"); + if (!tangential_model) error->all(FLERR, "Must specify tangential contact model"); + int i, j, size_cumulative; + size_history = 0; for (i = 0; i < nmodels; i++) { - if (sub_models[i]->nondefault_history_transfer) - nondefault_history_transfer = 1; - if (sub_models[i]->beyond_contact) - beyond_contact = 1; + if (sub_models[i]) { + if (sub_models[i]->nondefault_history_transfer) + nondefault_history_transfer = 1; + if (sub_models[i]->beyond_contact) + beyond_contact = 1; + size_history += sub_models[i]->size_history; + } } transfer_history_factor = new double(size_history); @@ -134,13 +206,17 @@ void ContactModel::init() // Find which model controls this history value size_cumulative = 0; for (j = 0; j < nmodels; j++) { - if (size_cumulative + sub_models[j]->size_history > i) break; - size_cumulative += sub_models[j]->size_history; + if (sub_models[j]) { + if (size_cumulative + sub_models[j]->size_history > i) break; + size_cumulative += sub_models[j]->size_history; + } } // Check if model has nondefault transfers, if so copy its array - if (sub_models[j]->nondefault_history_transfer) { - transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; + if (j != nmodels) { + if (sub_models[j]->nondefault_history_transfer) { + transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; + } } } } @@ -151,7 +227,8 @@ void ContactModel::init() void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) { for (int i = 0; i < nmodels; i++) - sub_models[i]->mix_coeffs(c1->sub_models[i], c2->sub_models[i]); + if (sub_models[i]) + sub_models[i]->mix_coeffs(c1->sub_models[i], c2->sub_models[i]); limit_damping = MAX(c1->limit_damping, c2->limit_damping); cutoff_type = MAX(c1->cutoff_type, c2->cutoff_type); @@ -218,10 +295,6 @@ void ContactModel::read_restart(FILE *fp) void ContactModel::reset_contact() { - radi = radj = Fntot = magtortwist = 0.0; - xi = xj = vi = vj = omegai = omegaj = nullptr; - forces = torquesi = torquesj = history = nullptr; - prep_flag = check_flag = 0; touch = false; } @@ -232,10 +305,17 @@ bool ContactModel::check_contact() { check_flag = 1; - sub3(xi, xj, dx); - rsq = lensq3(dx); - radsum = radi + radj; - Reff = radi * radj / radsum; + if (wall_flag) { + rsq = lensq3(dx); + radsum = radi; + if (rwall == 0) Reff = radi; + else Reff = radi * rwall/(radi + rwall); + } else { + sub3(xi, xj, dx); + rsq = lensq3(dx); + radsum = radi + radj; + Reff = radi * radj / radsum; + } touch = normal_model->touch(); return touch; diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 96758771b4..bd04fe9ce1 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -52,7 +52,7 @@ class ContactModel : protected Pointers { double pulloff_distance(double, double); void init_model(std::string, ModelType); - + int init_classic_model(char **, int, int); void mix_coeffs(ContactModel*, ContactModel*); void write_restart(FILE *); @@ -68,7 +68,7 @@ class ContactModel : protected Pointers { SubModel *sub_models[6]; // Need to resize if we add more model flavors // Extra options - int beyond_contact, limit_damping, history_update; + int beyond_contact, limit_damping, history_update, wall_flag; double cutoff_type; // History variables @@ -79,7 +79,7 @@ class ContactModel : protected Pointers { // Contact properties/output double *forces, *torquesi, *torquesj; - double radi, radj, meff, dt, Ti, Tj, area; + double radi, radj, rwall, meff, dt, Ti, Tj, area; double Fntot, magtortwist; double *xi, *xj, *vi, *vj, *omegai, *omegaj; diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp index 29134b3e73..3793f774c2 100644 --- a/src/GRANULAR/contact_heat_models.cpp +++ b/src/GRANULAR/contact_heat_models.cpp @@ -13,6 +13,7 @@ #include "contact_heat_models.h" #include "contact.h" +#include "error.h" using namespace LAMMPS_NS; using namespace Contact; @@ -31,6 +32,8 @@ HeatArea::HeatArea() void HeatArea::coeffs_to_local() { conductivity = coeffs[0]; + + if (conductivity < 0.0) error->all(FLERR, "Illegal area heat model"); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index c11fddb1d7..6a6db39189 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -13,6 +13,7 @@ #include "contact_normal_models.h" #include "contact.h" +#include "error.h" #include "math_const.h" using namespace LAMMPS_NS; @@ -83,6 +84,8 @@ void NormalHooke::coeffs_to_local() { k = coeffs[0]; damp = coeffs[1]; + + if (k < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hooke normal model"); } /* ---------------------------------------------------------------------- */ @@ -124,6 +127,8 @@ void NormalHertz::coeffs_to_local() { k = coeffs[0]; damp = coeffs[1]; + + if (k < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz normal model"); } /* ---------------------------------------------------------------------- */ @@ -169,6 +174,8 @@ void NormalHertzMaterial::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; k = 4 / 3 * Emod; + + if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); } /* ---------------------------------------------------------------------- */ @@ -201,6 +208,8 @@ void NormalDMT::coeffs_to_local() poiss = coeffs[2]; cohesion = coeffs[3]; k = 4 / 3 * Emod; + + if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); } /* ---------------------------------------------------------------------- */ @@ -260,6 +269,8 @@ void NormalJKR::coeffs_to_local() cohesion = coeffs[3]; k = 4/3*Emod; Escaled = k * THREEQUARTERS; + + if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/GRANULAR/contact_rolling_models.cpp index 0c256b0fbf..8074b14141 100644 --- a/src/GRANULAR/contact_rolling_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -13,9 +13,10 @@ #include "contact_normal_models.h" #include "contact_rolling_models.h" +#include "contact.h" +#include "error.h" #include "math_const.h" #include "math_extra.h" -#include "contact.h" using namespace LAMMPS_NS; using namespace Contact; @@ -39,6 +40,9 @@ void RollingSDS::coeffs_to_local() k = coeffs[0]; mu = coeffs[1]; gamma = coeffs[2]; + + if (k < 0.0 || mu < 0.0 || gamma < 0.0) + error->all(FLERR, "Illegal SDS rolling model"); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index 2809204de7..a0bf99301d 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -18,6 +18,7 @@ */ #include "contact_sub_models.h" +#include "error.h" #include "utils.h" using namespace LAMMPS_NS; @@ -55,14 +56,19 @@ void SubModel::allocate_coeffs() /* ---------------------------------------------------------------------- */ -void SubModel::parse_coeffs(char **arg, int iarg) +int SubModel::parse_coeffs(char **arg, int iarg, int narg) { + if (iarg + num_coeffs >= narg) + error->all(FLERR, "Insufficient arguments provided for {} model", name); + for (int i = 0; i < num_coeffs; i++) { // A few parameters (eg.g kt for tangential mindlin) allow null if (strcmp(arg[iarg+i+1], "NULL") == 0) coeffs[i] = -1; else coeffs[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); } coeffs_to_local(); + + return iarg + num_coeffs; } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index 7eca7f4152..95da8d5cbf 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -28,7 +28,7 @@ class SubModel : protected Pointers { int num_coeffs; double *coeffs; void read_restart(); - void parse_coeffs(char **, int); + int parse_coeffs(char **, int, int); virtual void mix_coeffs(SubModel*, SubModel*) {}; virtual void coeffs_to_local() {}; void allocate_coeffs(); diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 45ed993eeb..4f25e96071 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -42,6 +42,9 @@ void TangentialLinearNoHistory::coeffs_to_local() xt = coeffs[0]; mu = coeffs[1]; damp = xt * contact->damping_model->damp; + + if (k < 0.0 || xt < 0.0 || mu < 0.0) + error->all(FLERR, "Illegal linear no history tangential model"); } /* ---------------------------------------------------------------------- */ @@ -87,6 +90,9 @@ void TangentialLinearHistory::coeffs_to_local() xt = coeffs[1]; mu = coeffs[2]; damp = xt * contact->damping_model->damp; + + if (k < 0.0 || xt < 0.0 || mu < 0.0) + error->all(FLERR, "Illegal linear tangential model"); } /* ---------------------------------------------------------------------- */ @@ -182,6 +188,9 @@ void TangentialMindlin::coeffs_to_local() k = 8.0 * mix_stiffnessE(contact->normal_model->Emod, contact->normal_model->Emod, contact->normal_model->poiss, contact->normal_model->poiss); } + if (k < 0.0 || xt < 0.0 || mu < 0.0) + error->all(FLERR, "Illegal Mindlin tangential model"); + damp = xt * contact->damping_model->damp; } diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 04d89a5b88..75a2414c21 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -15,6 +15,7 @@ #include "contact_tangential_models.h" #include "contact_twisting_models.h" #include "contact.h" +#include "error.h" #include "math_const.h" using namespace LAMMPS_NS; @@ -75,6 +76,9 @@ void TwistingSDS::coeffs_to_local() k = coeffs[0]; mu = coeffs[1]; damp = coeffs[2]; + + if (k < 0.0 || mu < 0.0 || damp < 0.0) + error->all(FLERR, "Illegal SDS twisting model"); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index da7af48e82..b4d94d62fe 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -20,10 +20,18 @@ #include "fix_wall_gran.h" #include "atom.h" +#include "contact.h" +#include "contact_sub_models.h" +#include "contact_normal_models.h" +#include "contact_tangential_models.h" +#include "contact_damping_models.h" +#include "contact_rolling_models.h" +#include "contact_twisting_models.h" +#include "contact_heat_models.h" #include "domain.h" #include "error.h" -#include "force.h" #include "math_const.h" +#include "math_extra.h" #include "memory.h" #include "modify.h" #include "neighbor.h" @@ -34,31 +42,17 @@ #include using namespace LAMMPS_NS; +using namespace Contact; using namespace FixConst; using namespace MathConst; - -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS 1.333333333333333 // 4/3 -#define THREEQUARTERS 0.75 // 3/4 -#define TWOPI 6.28318530717959 // 2*PI +using namespace MathExtra; #define BIG 1.0e20 -#define EPSILON 1e-10 // XYZ PLANE need to be 0,1,2 enum {NOSTYLE=-1,XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION}; - enum {NONE,CONSTANT,EQUAL}; -enum {DAMPING_NONE, VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NONE, TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; /* ---------------------------------------------------------------------- */ @@ -72,237 +66,70 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix wall/gran requires atom style sphere"); create_attribute = 1; - limit_damping = 0; // set interaction style // disable bonded/history option for now + model = new ContactModel(); + model->wall_flag = 1; - if (strcmp(arg[3],"hooke") == 0) pairstyle = HOOKE; - else if (strcmp(arg[3],"hooke/history") == 0) pairstyle = HOOKE_HISTORY; - else if (strcmp(arg[3],"hertz/history") == 0) pairstyle = HERTZ_HISTORY; - else if (strcmp(arg[3],"granular") == 0) pairstyle = GRANULAR; - else error->all(FLERR,"Invalid fix wall/gran interaction style"); - - use_history = restart_peratom = 1; - if (pairstyle == HOOKE) use_history = restart_peratom = 0; - tangential_history = roll_history = twist_history = 0; - normal_model = NORMAL_NONE; - tangential_model = TANGENTIAL_NONE; - damping_model = DAMPING_NONE; + if (strcmp(arg[3],"granular") == 0) classic_flag = 0; + else classic_flag = 1; + limit_damping = 0; + heat_flag = 0; + int Twall_defined = 0; // wall/particle coefficients int iarg; - if (pairstyle != GRANULAR) { - size_history = 3; - if (narg < 11) error->all(FLERR,"Illegal fix wall/gran command"); + if (classic_flag) { + iarg = 3; + iarg = model->init_classic_model(arg, iarg, narg); - kn = utils::numeric(FLERR,arg[4],false,lmp); - if (strcmp(arg[5],"NULL") == 0) kt = kn * 2.0/7.0; - else kt = utils::numeric(FLERR,arg[5],false,lmp); - - gamman = utils::numeric(FLERR,arg[6],false,lmp); - if (strcmp(arg[7],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = utils::numeric(FLERR,arg[7],false,lmp); - - xmu = utils::numeric(FLERR,arg[8],false,lmp); - int dampflag = utils::inumeric(FLERR,arg[9],false,lmp); - if (dampflag == 0) gammat = 0.0; - - if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || - xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) - error->all(FLERR,"Illegal fix wall/gran command"); - - // convert Kn and Kt from pressure units to force/distance^2 if Hertzian - - if (pairstyle == HERTZ_HISTORY) { - kn /= force->nktv2p; - kt /= force->nktv2p; - } - iarg = 10; - - if (strcmp(arg[iarg],"limit_damping") == 0) { - limit_damping = 1; - iarg += 1; + if (iarg < narg) { + if (strcmp(arg[iarg],"limit_damping") == 0) { + model->limit_damping = 1; + iarg += 1; + } } } else { - iarg = 4; - damping_model = VISCOELASTIC; - roll_model = twist_model = NONE; + iarg = 3; + model->init_model(std::string(arg[iarg]), NORMAL); + iarg += 1; + iarg = model->normal_model->parse_coeffs(arg, iarg, narg); + while (iarg < narg) { - if (strcmp(arg[iarg], "hooke") == 0) { - if (iarg + 2 >= narg) - error->all(FLERR,"Illegal fix wall/gran command, " - "not enough parameters provided for Hooke option"); - normal_model = NORMAL_HOOKE; - normal_coeffs[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); //kn - normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping - iarg += 3; - } else if (strcmp(arg[iarg], "hertz") == 0) { - int num_coeffs = 2; - if (iarg + num_coeffs >= narg) - error->all(FLERR,"Illegal fix wall/gran command, " - "not enough parameters provided for Hertz option"); - normal_model = NORMAL_HERTZ; - normal_coeffs[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); //kn - normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping - iarg += num_coeffs+1; - } else if (strcmp(arg[iarg], "hertz/material") == 0) { - int num_coeffs = 3; - if (iarg + num_coeffs >= narg) - error->all(FLERR,"Illegal fix wall/gran command, " - "not enough parameters provided for Hertz option"); - normal_model = HERTZ_MATERIAL; - Emod = utils::numeric(FLERR,arg[iarg+1],false,lmp); //E - normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping - poiss = utils::numeric(FLERR,arg[iarg+3],false,lmp); //Poisson's ratio - normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS; - normal_coeffs[2] = poiss; - iarg += num_coeffs+1; - } else if (strcmp(arg[iarg], "dmt") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal fix wall/gran command, " - "not enough parameters provided for Hertz option"); - normal_model = DMT; - Emod = utils::numeric(FLERR,arg[iarg+1],false,lmp); //E - normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping - poiss = utils::numeric(FLERR,arg[iarg+3],false,lmp); //Poisson's ratio - normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS; - normal_coeffs[2] = poiss; - normal_coeffs[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); //cohesion - iarg += 5; - } else if (strcmp(arg[iarg], "jkr") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal wall/gran command, " - "not enough parameters provided for JKR option"); - normal_model = JKR; - Emod = utils::numeric(FLERR,arg[iarg+1],false,lmp); //E - normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping - poiss = utils::numeric(FLERR,arg[iarg+3],false,lmp); //Poisson's ratio - normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS; - normal_coeffs[2] = poiss; - normal_coeffs[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); //cohesion - iarg += 5; - } else if (strcmp(arg[iarg], "damping") == 0) { - if (iarg+1 >= narg) - error->all(FLERR, "Illegal wall/gran command, " - "not enough parameters provided for damping model"); - if (strcmp(arg[iarg+1], "velocity") == 0) { - damping_model = VELOCITY; - iarg += 1; - } else if (strcmp(arg[iarg+1], "mass_velocity") == 0) { - damping_model = MASS_VELOCITY; - iarg += 1; - } else if (strcmp(arg[iarg+1], "viscoelastic") == 0) { - damping_model = VISCOELASTIC; - iarg += 1; - } else if (strcmp(arg[iarg+1], "tsuji") == 0) { - damping_model = TSUJI; - iarg += 1; - } else error->all(FLERR, "Illegal wall/gran command, " - "unrecognized damping model"); + if (strcmp(arg[iarg], "damping") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + model->init_model(std::string(arg[iarg]), DAMPING); iarg += 1; + iarg = model->damping_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "tangential") == 0) { if (iarg + 1 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "must specify tangential model after tangential keyword"); - if (strcmp(arg[iarg+1], "linear_nohistory") == 0) { - if (iarg + 3 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for tangential model"); - tangential_model = TANGENTIAL_NOHISTORY; - tangential_coeffs[0] = 0; - // gammat and friction coeff - tangential_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - tangential_coeffs[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - iarg += 4; - } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || - (strcmp(arg[iarg+1], "mindlin") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale") == 0) || - (strcmp(arg[iarg+1], "mindlin/force") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0)) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for tangential model"); - if (strcmp(arg[iarg+1], "linear_history") == 0) - tangential_model = TANGENTIAL_HISTORY; - else if (strcmp(arg[iarg+1], "mindlin") == 0) - tangential_model = TANGENTIAL_MINDLIN; - else if (strcmp(arg[iarg+1], "mindlin_rescale") == 0) - tangential_model = TANGENTIAL_MINDLIN_RESCALE; - else if (strcmp(arg[iarg+1], "mindlin/force") == 0) - tangential_model = TANGENTIAL_MINDLIN_FORCE; - else if (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0) - tangential_model = TANGENTIAL_MINDLIN_RESCALE_FORCE; - if ((tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_FORCE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) && - (strcmp(arg[iarg+2], "NULL") == 0)) { - if (normal_model == NORMAL_HERTZ || normal_model == NORMAL_HOOKE) { - error->all(FLERR, "NULL setting for Mindlin tangential " - "stiffness requires a normal contact model " - "that specifies material properties"); - } - tangential_coeffs[0] = Emod/4*(2-poiss)*(1+poiss); - } else { - tangential_coeffs[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //kt - } - tangential_history = 1; - // gammat and friction coeff - tangential_coeffs[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - tangential_coeffs[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "tangential model not recognized"); - } + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + model->init_model(std::string(arg[iarg]), TANGENTIAL); + iarg += 1; + iarg = model->tangential_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "rolling") == 0) { if (iarg + 1 >= narg) - error->all(FLERR, "Illegal wall/gran command, not enough parameters"); - if (strcmp(arg[iarg+1], "none") == 0) { - roll_model = ROLL_NONE; - iarg += 2; - } else if (strcmp(arg[iarg+1], "sds") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal wall/gran command, " - "not enough parameters provided for rolling model"); - roll_model = ROLL_SDS; - roll_history = 1; - // kR, gammaR, rolling friction coeff - roll_coeffs[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - roll_coeffs[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - roll_coeffs[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal wall/gran command, " - "rolling friction model not recognized"); - } + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + model->init_model(std::string(arg[iarg]), ROLLING); + iarg += 1; + iarg = model->rolling_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "twisting") == 0) { if (iarg + 1 >= narg) - error->all(FLERR, "Illegal wall/gran command, not enough parameters"); - if (strcmp(arg[iarg+1], "none") == 0) { - twist_model = TWIST_NONE; - iarg += 2; - } else if (strcmp(arg[iarg+1], "marshall") == 0) { - twist_model = TWIST_MARSHALL; - twist_history = 1; - iarg += 2; - } else if (strcmp(arg[iarg+1], "sds") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal wall/gran command, " - "not enough parameters provided for twist model"); - twist_model = TWIST_SDS; - twist_history = 1; - twist_coeffs[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //kt - twist_coeffs[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); //gammat - twist_coeffs[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); //friction coeff. - iarg += 5; - } else { - error->all(FLERR, "Illegal wall/gran command, " - "twisting friction model not recognized"); - } + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + model->init_model(std::string(arg[iarg]), TWISTING); + iarg += 1; + iarg = model->twisting_model->parse_coeffs(arg, iarg, narg); + } else if (strcmp(arg[iarg], "heat") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + model->init_model(std::string(arg[iarg]), HEAT); + iarg += 1; + iarg = model->heat_model->parse_coeffs(arg, iarg, narg); + heat_flag = 1; } else if (strcmp(arg[iarg], "xplane") == 0 || strcmp(arg[iarg], "yplane") == 0 || strcmp(arg[iarg], "zplane") == 0 || @@ -310,32 +137,35 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : strcmp(arg[iarg], "region") == 0) { break; } else if (strcmp(arg[iarg],"limit_damping") == 0) { - limit_damping = 1; + model->limit_damping = 1; iarg += 1; } else { error->all(FLERR, "Illegal fix wall/gran command"); } } - size_history = 3*tangential_history + 3*roll_history + twist_history; - //Unlike the pair style, the wall style does not have a 'touch' - //array. Hence, an additional entry in the history is used to - //determine if particles previously contacted for JKR cohesion purposes. - if (normal_model == JKR) size_history += 1; - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) size_history += 1; - - if (limit_damping && normal_model == JKR) - error->all(FLERR,"Illegal pair_coeff command, " - "cannot limit damping with JRK model"); - if (limit_damping && normal_model == DMT) - error->all(FLERR,"Illegal pair_coeff command, " - "Cannot limit damping with DMT model"); } + // Define default damping model if unspecified, takes no args + if (!model->damping_model) + model->init_model("viscoelastic", DAMPING); + + //Dan original code didn't require tangential? + if (!model->tangential_model) error->all(FLERR, "No tangential?"); + + if (model->limit_damping && !model->normal_model->allow_limit_damping) + error->all(FLERR,"Illegal pair_coeff command, " + "Cannot limit damping with specified normal contact model"); + + size_history = model->size_history; + if (size_history == 0) use_history = restart_peratom = 0; + else use_history = restart_peratom = 1; + // wallstyle args idregion = nullptr; + if (iarg >= narg) error->all(FLERR, "Illegal fix wall/gran command"); + if (strcmp(arg[iarg],"xplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = XPLANE; @@ -371,8 +201,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wallstyle = REGION; idregion = utils::strdup(arg[iarg+1]); iarg += 2; + } else if (strcmp(arg[iarg],"temperature") == 0) { + if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); + Twall = utils::numeric(FLERR,arg[iarg+1],false,lmp); + Twall_defined = 1; + iarg += 2; } else wallstyle = NOSTYLE; + if (heat_flag != Twall_defined) + error->all(FLERR, "To model conduction, must define both heat model and wall temperature"); + // optional args wiggle = 0; @@ -472,6 +310,8 @@ FixWallGran::~FixWallGran() atom->delete_callback(id,Atom::GROW); atom->delete_callback(id,Atom::RESTART); + delete model; + // delete local storage delete [] idregion; @@ -496,6 +336,7 @@ void FixWallGran::init() int i; dt = update->dt; + model->dt = dt; if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = (dynamic_cast( update->integrate))->nlevels; @@ -507,40 +348,26 @@ void FixWallGran::init() if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; - if(pairstyle == GRANULAR) { - tangential_history_index = 0; - if (roll_history) { - if (tangential_history) roll_history_index = 3; - else roll_history_index = 0; - } - if (twist_history) { - if (tangential_history) { - if (roll_history) twist_history_index = 6; - else twist_history_index = 3; - } - else{ - if (roll_history) twist_history_index = 3; - else twist_history_index = 0; - } - } - if (normal_model == JKR) { - tangential_history_index += 1; - roll_history_index += 1; - twist_history_index += 1; - } - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { - roll_history_index += 1; - twist_history_index += 1; - } + // Define history indices + int size_normal_history = model->normal_model->size_history; + int size_tangential_history = model->tangential_model->size_history; + int size_damping_history = model->damping_model->size_history; - if (damping_model == TSUJI) { - double cor = normal_coeffs[1]; - normal_coeffs[1] = 1.2728-4.2783*cor+11.087*pow(cor,2)-22.348*pow(cor,3)+ - 27.467*pow(cor,4)-18.022*pow(cor,5)+ - 4.8218*pow(cor,6); - } - } + int size_rolling_history = 0; + int size_twisting_history = 0; + if (model->rolling_model) size_rolling_history = model->rolling_model->size_history; + if (model->twisting_model) size_twisting_history = model->twisting_model->size_history; + + damping_history_index = size_normal_history; + tangential_history_index = damping_history_index + size_damping_history; + roll_history_index = tangential_history_index + size_tangential_history; + twist_history_index = roll_history_index + size_rolling_history; + + model->normal_model->history_index = 0; + model->damping_model->history_index = damping_history_index; + model->tangential_model->history_index = tangential_history_index; + if (model->rolling_model) model->rolling_model->history_index = roll_history_index; + if (model->twisting_model) model->twisting_model->history_index = twist_history_index; } /* ---------------------------------------------------------------------- */ @@ -561,8 +388,11 @@ void FixWallGran::setup(int vflag) void FixWallGran::post_force(int /*vflag*/) { int i,j; - double dx,dy,dz,del1,del2,delxy,delr,rsq,rwall,meff; + double dx,dy,dz,del1,del2,delxy,delr,rwall,meff; + double *forces, *torquesi, dq; double vwall[3]; + double w0[3] = {0.0}; + bool touchflag = false; // do not update history during setup @@ -622,6 +452,11 @@ void FixWallGran::post_force(int /*vflag*/) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; + double *temperature, *heatflux; + if (heat_flag) { + temperature = atom->temperature; + heatflux = atom->heatflux; + } int *mask = atom->mask; int nlocal = atom->nlocal; @@ -631,107 +466,105 @@ void FixWallGran::post_force(int /*vflag*/) clear_stored_contacts(); } + // Define constant wall properties (atom j) + model->radj = 0.0; + model->vj = vwall; + model->omegaj = w0; + if (heat_flag) model->Tj = Twall; + for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { + if (! mask[i] & groupbit) continue; - dx = dy = dz = 0.0; + dx = dy = dz = 0.0; - if (wallstyle == XPLANE) { - del1 = x[i][0] - wlo; - del2 = whi - x[i][0]; - if (del1 < del2) dx = del1; - else dx = -del2; - } else if (wallstyle == YPLANE) { - del1 = x[i][1] - wlo; - del2 = whi - x[i][1]; - if (del1 < del2) dy = del1; - else dy = -del2; - } else if (wallstyle == ZPLANE) { - del1 = x[i][2] - wlo; - del2 = whi - x[i][2]; - if (del1 < del2) dz = del1; - else dz = -del2; - } else if (wallstyle == ZCYLINDER) { - delxy = sqrt(x[i][0]*x[i][0] + x[i][1]*x[i][1]); - delr = cylradius - delxy; - if (delr > radius[i]) { - dz = cylradius; - rwall = 0.0; - } else { - dx = -delr/delxy * x[i][0]; - dy = -delr/delxy * x[i][1]; - // rwall = -2r_c if inside cylinder, 2r_c outside - rwall = (delxy < cylradius) ? -2*cylradius : 2*cylradius; - if (wshear && axis != 2) { - vwall[0] += vshear * x[i][1]/delxy; - vwall[1] += -vshear * x[i][0]/delxy; - vwall[2] = 0.0; - } + if (wallstyle == XPLANE) { + del1 = x[i][0] - wlo; + del2 = whi - x[i][0]; + if (del1 < del2) dx = del1; + else dx = -del2; + } else if (wallstyle == YPLANE) { + del1 = x[i][1] - wlo; + del2 = whi - x[i][1]; + if (del1 < del2) dy = del1; + else dy = -del2; + } else if (wallstyle == ZPLANE) { + del1 = x[i][2] - wlo; + del2 = whi - x[i][2]; + if (del1 < del2) dz = del1; + else dz = -del2; + } else if (wallstyle == ZCYLINDER) { + delxy = sqrt(x[i][0]*x[i][0] + x[i][1]*x[i][1]); + delr = cylradius - delxy; + if (delr > radius[i]) { + dz = cylradius; + rwall = 0.0; + } else { + dx = -delr/delxy * x[i][0]; + dy = -delr/delxy * x[i][1]; + // rwall = -2r_c if inside cylinder, 2r_c outside + rwall = (delxy < cylradius) ? -2*cylradius : 2*cylradius; + if (wshear && axis != 2) { + vwall[0] += vshear * x[i][1]/delxy; + vwall[1] += -vshear * x[i][0]/delxy; + vwall[2] = 0.0; } } + } - rsq = dx*dx + dy*dy + dz*dz; + // Reset model and copy initial geometric data + model->reset_contact(); + model->xi = x[i]; + model->dx[0] = dx; + model->dx[1] = dy; + model->dx[2] = dz; + model->radi = radius[i]; + model->rwall = rwall; - double rad; - if (pairstyle == GRANULAR && normal_model == JKR) { - rad = radius[i] + pulloff_distance(radius[i]); - } - else - rad = radius[i]; + touchflag = model->check_contact(); - if (rsq > rad*rad) { - if (use_history) - for (j = 0; j < size_history; j++) - history_one[i][j] = 0.0; - } - else { - if (pairstyle == GRANULAR && normal_model == JKR && use_history) { - if ((history_one[i][0] == 0) && (rsq > radius[i]*radius[i])) { - // Particles have not contacted yet, - // and are outside of contact distance - for (j = 0; j < size_history; j++) - history_one[i][j] = 0.0; - continue; - } - } + if (!touchflag) { + if (use_history) + for (j = 0; j < size_history; j++) + history_one[i][j] = 0.0; + } else { - // meff = effective mass of sphere - // if I is part of rigid body, use body mass + // meff = effective mass of sphere + // if I is part of rigid body, use body mass - meff = rmass[i]; - if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i]; + meff = rmass[i]; + if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i]; - // store contact info - if (peratom_flag) { - 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; - array_atom[i][7] = radius[i]; - } + // Copy additional information and prepare force calculations + model->meff = meff; + model->vi = v[i]; + model->omegai = omega[i]; + model->history_update = history_update; + if (use_history) model->history = history_one[i]; + if (heat_flag) model->Ti = temperature[i]; + model->prep_contact(); - // invoke sphere/wall interaction - double *contact; - if (peratom_flag) - contact = array_atom[i]; - else - contact = nullptr; + model->calculate_forces(); + if (heat_flag) dq = model->calculate_heat(); - if (pairstyle == HOOKE) - hooke(rsq,dx,dy,dz,vwall,v[i],f[i], - omega[i],torque[i],radius[i],meff, contact); - else if (pairstyle == HOOKE_HISTORY) - hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i], - omega[i],torque[i],radius[i],meff,history_one[i], - contact); - else if (pairstyle == HERTZ_HISTORY) - hertz_history(rsq,dx,dy,dz,vwall,rwall,v[i],f[i], - omega[i],torque[i],radius[i],meff,history_one[i], - contact); - else if (pairstyle == GRANULAR) - granular(rsq,dx,dy,dz,vwall,rwall,v[i],f[i], - omega[i],torque[i],radius[i],meff,history_one[i], - contact); + forces = model->forces; + torquesi = model->torquesi; + + // apply forces & torques + add3(f[i], forces, f[i]); + + add3(torque[i], torquesi, torque[i]); + if (heat_flag) heatflux[i] += dq; + + // store contact info + if (peratom_flag) { + array_atom[i][0] = 1.0; + array_atom[i][1] = forces[0]; + array_atom[i][2] = forces[1]; + array_atom[i][3] = forces[2]; + array_atom[i][4] = x[i][0] - dx; + array_atom[i][5] = x[i][1] - dy; + array_atom[i][6] = x[i][2] - dz; + array_atom[i][7] = radius[i]; } } } @@ -753,789 +586,6 @@ void FixWallGran::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == nlevels_respa-1) post_force(vflag); } -/* ---------------------------------------------------------------------- */ - -void FixWallGran::hooke(double rsq, double dx, double dy, double dz, - double *vwall, double *v, - double *f, double *omega, double *torque, - double radius, double meff, double* contact) -{ - double r,vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3,damp,ccel,vtr1,vtr2,vtr3,vrel; - double fn,fs,ft,fs1,fs2,fs3,fx,fy,fz,tor1,tor2,tor3,rinv,rsqinv; - - r = sqrt(rsq); - rinv = 1.0/r; - rsqinv = 1.0/rsq; - - // relative translational velocity - - vr1 = v[0] - vwall[0]; - vr2 = v[1] - vwall[1]; - vr3 = v[2] - vwall[2]; - - // normal component - - vnnr = vr1*dx + vr2*dy + vr3*dz; - vn1 = dx*vnnr * rsqinv; - vn2 = dy*vnnr * rsqinv; - vn3 = dz*vnnr * rsqinv; - - // tangential component - - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - - wr1 = radius*omega[0] * rinv; - wr2 = radius*omega[1] * rinv; - wr3 = radius*omega[2] * rinv; - - // normal forces = Hookian contact + normal velocity damping - - damp = meff*gamman*vnnr*rsqinv; - ccel = kn*(radius-r)*rinv - damp; - if (limit_damping && (ccel < 0.0)) ccel = 0.0; - - // relative velocities - - vtr1 = vt1 - (dz*wr2-dy*wr3); - vtr2 = vt2 - (dx*wr3-dz*wr1); - vtr3 = vt3 - (dy*wr1-dx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - // force normalization - - fn = xmu * fabs(ccel*r); - fs = meff*gammat*vrel; - if (vrel != 0.0) ft = MIN(fn,fs) / vrel; - else ft = 0.0; - - // tangential force due to tangential velocity damping - - fs1 = -ft*vtr1; - fs2 = -ft*vtr2; - fs3 = -ft*vtr3; - - // forces & torques - - fx = dx*ccel + fs1; - fy = dy*ccel + fs2; - fz = dz*ccel + fs3; - - if (peratom_flag) { - contact[1] = fx; - contact[2] = fy; - contact[3] = fz; - } - - f[0] += fx; - f[1] += fy; - f[2] += fz; - - tor1 = rinv * (dy*fs3 - dz*fs2); - tor2 = rinv * (dz*fs1 - dx*fs3); - tor3 = rinv * (dx*fs2 - dy*fs1); - torque[0] -= radius*tor1; - torque[1] -= radius*tor2; - torque[2] -= radius*tor3; -} - -/* ---------------------------------------------------------------------- */ - -void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz, - double *vwall, double *v, - double *f, double *omega, double *torque, - double radius, double meff, double *history, - double *contact) -{ - double r,vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3,damp,ccel,vtr1,vtr2,vtr3,vrel; - double fn,fs,fs1,fs2,fs3,fx,fy,fz,tor1,tor2,tor3; - double shrmag,rsht,rinv,rsqinv; - - r = sqrt(rsq); - rinv = 1.0/r; - rsqinv = 1.0/rsq; - - // relative translational velocity - - vr1 = v[0] - vwall[0]; - vr2 = v[1] - vwall[1]; - vr3 = v[2] - vwall[2]; - - // normal component - - vnnr = vr1*dx + vr2*dy + vr3*dz; - vn1 = dx*vnnr * rsqinv; - vn2 = dy*vnnr * rsqinv; - vn3 = dz*vnnr * rsqinv; - - // tangential component - - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - - wr1 = radius*omega[0] * rinv; - wr2 = radius*omega[1] * rinv; - wr3 = radius*omega[2] * rinv; - - // normal forces = Hookian contact + normal velocity damping - - damp = meff*gamman*vnnr*rsqinv; - ccel = kn*(radius-r)*rinv - damp; - if (limit_damping && (ccel < 0.0)) ccel = 0.0; - - // relative velocities - - vtr1 = vt1 - (dz*wr2-dy*wr3); - vtr2 = vt2 - (dx*wr3-dz*wr1); - vtr3 = vt3 - (dy*wr1-dx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - // shear history effects - - if (history_update) { - history[0] += vtr1*dt; - history[1] += vtr2*dt; - history[2] += vtr3*dt; - } - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - - // rotate shear displacements - - rsht = history[0]*dx + history[1]*dy + history[2]*dz; - rsht = rsht*rsqinv; - if (history_update) { - history[0] -= rsht*dx; - history[1] -= rsht*dy; - history[2] -= rsht*dz; - } - - // tangential forces = shear + tangential velocity damping - - fs1 = - (kt*history[0] + meff*gammat*vtr1); - fs2 = - (kt*history[1] + meff*gammat*vtr2); - fs3 = - (kt*history[2] + meff*gammat*vtr3); - - // rescale frictional displacements and forces if needed - - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - fn = xmu * fabs(ccel*r); - - if (fs > fn) { - if (shrmag != 0.0) { - history[0] = (fn/fs) * (history[0] + meff*gammat*vtr1/kt) - - meff*gammat*vtr1/kt; - history[1] = (fn/fs) * (history[1] + meff*gammat*vtr2/kt) - - meff*gammat*vtr2/kt; - history[2] = (fn/fs) * (history[2] + meff*gammat*vtr3/kt) - - meff*gammat*vtr3/kt; - fs1 *= fn/fs ; - fs2 *= fn/fs; - fs3 *= fn/fs; - } else fs1 = fs2 = fs3 = 0.0; - } - - // forces & torques - - fx = dx*ccel + fs1; - fy = dy*ccel + fs2; - fz = dz*ccel + fs3; - - f[0] += fx; - f[1] += fy; - f[2] += fz; - - if (peratom_flag) { - contact[1] = fx; - contact[2] = fy; - contact[3] = fz; - } - - tor1 = rinv * (dy*fs3 - dz*fs2); - tor2 = rinv * (dz*fs1 - dx*fs3); - tor3 = rinv * (dx*fs2 - dy*fs1); - torque[0] -= radius*tor1; - torque[1] -= radius*tor2; - torque[2] -= radius*tor3; -} - -/* ---------------------------------------------------------------------- */ - -void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, - double *vwall, double rwall, double *v, - double *f, double *omega, double *torque, - double radius, double meff, double *history, - double *contact) -{ - double r,vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3,damp,ccel,vtr1,vtr2,vtr3,vrel; - double fn,fs,fs1,fs2,fs3,fx,fy,fz,tor1,tor2,tor3; - double shrmag,rsht,polyhertz,rinv,rsqinv; - - r = sqrt(rsq); - rinv = 1.0/r; - rsqinv = 1.0/rsq; - - // relative translational velocity - - vr1 = v[0] - vwall[0]; - vr2 = v[1] - vwall[1]; - vr3 = v[2] - vwall[2]; - - // normal component - - vnnr = vr1*dx + vr2*dy + vr3*dz; - vn1 = dx*vnnr / rsq; - vn2 = dy*vnnr / rsq; - vn3 = dz*vnnr / rsq; - - // tangential component - - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - - wr1 = radius*omega[0] * rinv; - wr2 = radius*omega[1] * rinv; - wr3 = radius*omega[2] * rinv; - - // normal forces = Hertzian contact + normal velocity damping - // rwall = 0 is flat wall case - // rwall positive or negative is curved wall - // will break (as it should) if rwall is negative and - // its absolute value < radius of particle - - damp = meff*gamman*vnnr*rsqinv; - ccel = kn*(radius-r)*rinv - damp; - if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius); - else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); - ccel *= polyhertz; - if (limit_damping && (ccel < 0.0)) ccel = 0.0; - - // relative velocities - - vtr1 = vt1 - (dz*wr2-dy*wr3); - vtr2 = vt2 - (dx*wr3-dz*wr1); - vtr3 = vt3 - (dy*wr1-dx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - // shear history effects - - if (history_update) { - history[0] += vtr1*dt; - history[1] += vtr2*dt; - history[2] += vtr3*dt; - } - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - - // rotate history displacements - - rsht = history[0]*dx + history[1]*dy + history[2]*dz; - rsht = rsht*rsqinv; - if (history_update) { - history[0] -= rsht*dx; - history[1] -= rsht*dy; - history[2] -= rsht*dz; - } - - // tangential forces = shear + tangential velocity damping - - fs1 = -polyhertz * (kt*history[0] + meff*gammat*vtr1); - fs2 = -polyhertz * (kt*history[1] + meff*gammat*vtr2); - fs3 = -polyhertz * (kt*history[2] + meff*gammat*vtr3); - - // rescale frictional displacements and forces if needed - - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - fn = xmu * fabs(ccel*r); - - if (fs > fn) { - if (shrmag != 0.0) { - history[0] = (fn/fs) * (history[0] + meff*gammat*vtr1/kt) - - meff*gammat*vtr1/kt; - history[1] = (fn/fs) * (history[1] + meff*gammat*vtr2/kt) - - meff*gammat*vtr2/kt; - history[2] = (fn/fs) * (history[2] + meff*gammat*vtr3/kt) - - meff*gammat*vtr3/kt; - fs1 *= fn/fs ; - fs2 *= fn/fs; - fs3 *= fn/fs; - } else fs1 = fs2 = fs3 = 0.0; - } - - // forces & torques - - fx = dx*ccel + fs1; - fy = dy*ccel + fs2; - fz = dz*ccel + fs3; - - if (peratom_flag) { - contact[1] = fx; - contact[2] = fy; - contact[3] = fz; - } - - f[0] += fx; - f[1] += fy; - f[2] += fz; - - tor1 = rinv * (dy*fs3 - dz*fs2); - tor2 = rinv * (dz*fs1 - dx*fs3); - tor3 = rinv * (dx*fs2 - dy*fs1); - torque[0] -= radius*tor1; - torque[1] -= radius*tor2; - torque[2] -= radius*tor3; -} - -/* ---------------------------------------------------------------------- */ - -void FixWallGran::granular(double rsq, double dx, double dy, double dz, - double *vwall, double rwall, double *v, - double *f, double *omega, double *torque, - double radius, double meff, double *history, - double *contact) -{ - double fx,fy,fz,nx,ny,nz; - double r,rinv; - double Reff, delta, dR, dR2; - - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3; - double vtr1,vtr2,vtr3,vrel; - - double knfac, damp_normal, damp_normal_prefactor; - double k_tangential, damp_tangential; - double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; - double fs, fs1, fs2, fs3; - - double tor1,tor2,tor3; - double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; - - // for JKR - double R2, coh, F_pulloff, a, a2, E; - double t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3; - - // rolling - double k_roll, damp_roll; - double torroll1, torroll2, torroll3; - double rollmag, rolldotn, scalefac; - double fr, fr1, fr2, fr3; - - // twisting - double k_twist, damp_twist, mu_twist; - double signtwist, magtwist, magtortwist, Mtcrit; - double tortwist1, tortwist2, tortwist3; - - double shrmag,rsht,prjmag; - bool frameupdate; - - r = sqrt(rsq); - E = normal_coeffs[0]; - - if (rwall == 0) Reff = radius; - else Reff = radius*rwall/(radius+rwall); - - rinv = 1.0/r; - - nx = dx*rinv; - ny = dy*rinv; - nz = dz*rinv; - - // relative translational velocity - - vr1 = v[0] - vwall[0]; - vr2 = v[1] - vwall[1]; - vr3 = v[2] - vwall[2]; - - // normal component - - vnnr = vr1*nx + vr2*ny + vr3*nz; //v_R . n - vn1 = nx*vnnr; - vn2 = ny*vnnr; - vn3 = nz*vnnr; - - delta = radius - r; - dR = delta*Reff; - if (normal_model == JKR) { - history[0] = 1.0; - E *= THREEQUARTERS; - R2=Reff*Reff; - coh = normal_coeffs[3]; - dR2 = dR*dR; - t0 = coh*coh*R2*R2*E; - t1 = PI27SQ*t0; - t2 = 8*dR*dR2*E*E*E; - t3 = 4*dR2*E; - sqrt1 = MAX(0, t0*(t1+2*t2)); // in case sqrt(0) < 0 due to precision issues - t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); - t5 = t3/t4 + t4/E; - sqrt2 = MAX(0, 2*dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); - a = INVROOT6*(t6 + sqrt(sqrt3)); - a2 = a*a; - knfac = normal_coeffs[0]*a; - Fne = knfac*a2/Reff - TWOPI*a2*sqrt(4*coh*E/(MY_PI*a)); - } else { - knfac = E; //Hooke - a = sqrt(dR); - Fne = knfac*delta; - if (normal_model != NORMAL_HOOKE) { - Fne *= a; - knfac *= a; - } - if (normal_model == DMT) - Fne -= 4*MY_PI*normal_coeffs[3]*Reff; - } - - if (damping_model == VELOCITY) { - damp_normal = 1; - } else if (damping_model == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model == VISCOELASTIC) { - damp_normal = a*meff; - } else if (damping_model == TSUJI) { - damp_normal = sqrt(meff*knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = normal_coeffs[1]*damp_normal; - Fdamp = -damp_normal_prefactor*vnnr; - - Fntot = Fne + Fdamp; - if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; - - //**************************************** - // tangential force, including history effects - //**************************************** - - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - // tangential component - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - wr1 = radius*omega[0]; - wr2 = radius*omega[1]; - wr3 = radius*omega[2]; - - // relative tangential velocities - vtr1 = vt1 - (nz*wr2-ny*wr3); - vtr2 = vt2 - (nx*wr3-nz*wr1); - vtr3 = vt3 - (ny*wr1-nx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - if (normal_model == JKR) { - F_pulloff = 3*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } - else if (normal_model == DMT) { - F_pulloff = 4*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } - else{ - Fncrit = fabs(Fntot); - } - - //------------------------------ - // tangential forces - //------------------------------ - - k_tangential = tangential_coeffs[0]; - damp_tangential = tangential_coeffs[1]*damp_normal_prefactor; - Fscrit = tangential_coeffs[2] * Fncrit; - - int thist0 = tangential_history_index; - int thist1 = thist0 + 1; - int thist2 = thist1 + 1; - - if (tangential_history) { - if (tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_FORCE) { - k_tangential *= a; - } - else if (tangential_model == - TANGENTIAL_MINDLIN_RESCALE || - tangential_model == - TANGENTIAL_MINDLIN_RESCALE_FORCE){ - k_tangential *= a; - // on unloading, rescale the shear displacements/force - if (a < history[thist2+1]) { - double factor = a/history[thist2+1]; - history[thist0] *= factor; - history[thist1] *= factor; - history[thist2] *= factor; - } - } - - - // rotate and update displacements. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (history_update) { - rsht = history[thist0]*nx + history[thist1]*ny + history[thist2]*nz; - if (tangential_model == TANGENTIAL_MINDLIN_FORCE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - frameupdate = fabs(rsht) > EPSILON*Fscrit; - else - frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; - if (frameupdate) { - shrmag = sqrt(history[thist0]*history[thist0] + - history[thist1]*history[thist1] + - history[thist2]*history[thist2]); - // projection - history[thist0] -= rsht*nx; - history[thist1] -= rsht*ny; - history[thist2] -= rsht*nz; - - // also rescale to preserve magnitude - prjmag = sqrt(history[thist0]*history[thist0] + - history[thist1]*history[thist1] + history[thist2]*history[thist2]); - if (prjmag > 0) scalefac = shrmag/prjmag; - else scalefac = 0; - history[thist0] *= scalefac; - history[thist1] *= scalefac; - history[thist2] *= scalefac; - } - // update history - if (tangential_model == TANGENTIAL_HISTORY || - tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_RESCALE) { - history[thist0] += vtr1*dt; - history[thist1] += vtr2*dt; - history[thist2] += vtr3*dt; - } else{ - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - history[thist0] -= k_tangential*vtr1*dt; - history[thist1] -= k_tangential*vtr2*dt; - history[thist2] -= k_tangential*vtr3*dt; - } - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) - history[thist2+1] = a; - } - - // tangential forces = history + tangential velocity damping - if (tangential_model == TANGENTIAL_HISTORY || - tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_RESCALE) { - fs1 = -k_tangential*history[thist0] - damp_tangential*vtr1; - fs2 = -k_tangential*history[thist1] - damp_tangential*vtr2; - fs3 = -k_tangential*history[thist2] - damp_tangential*vtr3; - } else { - fs1 = history[thist0] - damp_tangential*vtr1; - fs2 = history[thist1] - damp_tangential*vtr2; - fs3 = history[thist2] - damp_tangential*vtr3; - } - - // rescale frictional displacements and forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - if (fs > Fscrit) { - shrmag = sqrt(history[thist0]*history[thist0] + - history[thist1]*history[thist1] + - history[thist2]*history[thist2]); - if (shrmag != 0.0) { - if (tangential_model == TANGENTIAL_HISTORY || - tangential_model == TANGENTIAL_MINDLIN || - tangential_model == - TANGENTIAL_MINDLIN_RESCALE) { - history[thist0] = -1.0/k_tangential*(Fscrit*fs1/fs + - damp_tangential*vtr1); - history[thist1] = -1.0/k_tangential*(Fscrit*fs2/fs + - damp_tangential*vtr2); - history[thist2] = -1.0/k_tangential*(Fscrit*fs3/fs + - damp_tangential*vtr3); - } else { - history[thist0] = Fscrit*fs1/fs + damp_tangential*vtr1; - history[thist1] = Fscrit*fs2/fs + damp_tangential*vtr2; - history[thist2] = Fscrit*fs3/fs + damp_tangential*vtr3; - } - fs1 *= Fscrit/fs; - fs2 *= Fscrit/fs; - fs3 *= Fscrit/fs; - } else fs1 = fs2 = fs3 = 0.0; - } - } else { // classic pair gran/hooke (no history) - fs = damp_tangential*vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; - else Ft = 0.0; - fs1 = -Ft*vtr1; - fs2 = -Ft*vtr2; - fs3 = -Ft*vtr3; - } - - //**************************************** - // rolling resistance - //**************************************** - - if (roll_model != ROLL_NONE || twist_model != TWIST_NONE) { - relrot1 = omega[0]; - relrot2 = omega[1]; - relrot3 = omega[2]; - } - if (roll_model != ROLL_NONE) { - // rolling velocity, - // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // This is different from the Marshall papers, - // which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - vrl1 = Reff*(relrot2*nz - relrot3*ny); //- 0.5*((radj-radi)/radsum)*vtr1; - vrl2 = Reff*(relrot3*nx - relrot1*nz); //- 0.5*((radj-radi)/radsum)*vtr2; - vrl3 = Reff*(relrot1*ny - relrot2*nx); //- 0.5*((radj-radi)/radsum)*vtr3; - - int rhist0 = roll_history_index; - int rhist1 = rhist0 + 1; - int rhist2 = rhist1 + 1; - - k_roll = roll_coeffs[0]; - damp_roll = roll_coeffs[1]; - Frcrit = roll_coeffs[2] * Fncrit; - - if (history_update) { - rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; - frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; - if (frameupdate) { // rotate into tangential plane - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - // projection - history[rhist0] -= rolldotn*nx; - history[rhist1] -= rolldotn*ny; - history[rhist2] -= rolldotn*nz; - - // also rescale to preserve magnitude - prjmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - - if (prjmag > 0) scalefac = rollmag/prjmag; - else scalefac = 0; - history[rhist0] *= scalefac; - history[rhist1] *= scalefac; - history[rhist2] *= scalefac; - } - history[rhist0] += vrl1*dt; - history[rhist1] += vrl2*dt; - history[rhist2] += vrl3*dt; - } - - fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; - fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; - fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; - - // rescale frictional displacements and forces if needed - fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); - if (fr > Frcrit) { - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - if (rollmag != 0.0) { - history[rhist0] = -1.0/k_roll*(Frcrit*fr1/fr + damp_roll*vrl1); - history[rhist1] = -1.0/k_roll*(Frcrit*fr2/fr + damp_roll*vrl2); - history[rhist2] = -1.0/k_roll*(Frcrit*fr3/fr + damp_roll*vrl3); - fr1 *= Frcrit/fr; - fr2 *= Frcrit/fr; - fr3 *= Frcrit/fr; - } else fr1 = fr2 = fr3 = 0.0; - } - } - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model != TWIST_NONE) { - magtwist = relrot1*nx + relrot2*ny + relrot3*nz; //Omega_T (eq 29 of Marshall) - if (twist_model == TWIST_MARSHALL) { - k_twist = 0.5*k_tangential*a*a;; // eq 32 of Marshall paper - damp_twist = 0.5*damp_tangential*a*a; - mu_twist = TWOTHIRDS*a*tangential_coeffs[2]; - } - else{ - k_twist = twist_coeffs[0]; - damp_twist = twist_coeffs[1]; - mu_twist = twist_coeffs[2]; - } - if (history_update) { - history[twist_history_index] += magtwist*dt; - } - // M_t torque (eq 30) - magtortwist = -k_twist*history[twist_history_index] - damp_twist*magtwist; - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - history[twist_history_index] = 1.0/k_twist*(Mtcrit*signtwist - - damp_twist*magtwist); - magtortwist = -Mtcrit * signtwist; // eq 34 - } - } - - // apply forces & torques - - fx = nx*Fntot + fs1; - fy = ny*Fntot + fs2; - fz = nz*Fntot + fs3; - - if (peratom_flag) { - contact[1] = fx; - contact[2] = fy; - contact[3] = fz; - } - - f[0] += fx; - f[1] += fy; - f[2] += fz; - - tor1 = ny*fs3 - nz*fs2; - tor2 = nz*fs1 - nx*fs3; - tor3 = nx*fs2 - ny*fs1; - - torque[0] -= radius*tor1; - torque[1] -= radius*tor2; - torque[2] -= radius*tor3; - - if (twist_model != TWIST_NONE) { - tortwist1 = magtortwist * nx; - tortwist2 = magtortwist * ny; - tortwist3 = magtortwist * nz; - - torque[0] += tortwist1; - torque[1] += tortwist2; - torque[2] += tortwist3; - } - - if (roll_model != ROLL_NONE) { - torroll1 = Reff*(ny*fr3 - nz*fr2); //n cross fr - torroll2 = Reff*(nz*fr1 - nx*fr3); - torroll3 = Reff*(nx*fr2 - ny*fr1); - - torque[0] += torroll1; - torque[1] += torroll2; - torque[2] += torroll3; - } -} - /* ---------------------------------------------------------------------- memory usage of local atom-based arrays ------------------------------------------------------------------------- */ @@ -1692,14 +742,3 @@ void FixWallGran::reset_dt() { dt = update->dt; } - -double FixWallGran::pulloff_distance(double radius) -{ - double coh, E, a, dist; - coh = normal_coeffs[3]; - E = normal_coeffs[0]*THREEQUARTERS; - a = cbrt(9*MY_PI*coh*radius/(4*E)); - dist = a*a/radius - 2*sqrt(MY_PI*coh*a/E); - return dist; -} - diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 8c69be6e16..d0202d65e8 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -20,15 +20,13 @@ FixStyle(wall/gran,FixWallGran); #ifndef LMP_FIX_WALL_GRAN_H #define LMP_FIX_WALL_GRAN_H +#include "contact.h" #include "fix.h" namespace LAMMPS_NS { class FixWallGran : public Fix { public: - enum { HOOKE, HOOKE_HISTORY, HERTZ_HISTORY, GRANULAR }; - enum { NORMAL_NONE, NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR }; - FixWallGran(class LAMMPS *, int, char **); ~FixWallGran() override; int setmask() override; @@ -49,54 +47,32 @@ class FixWallGran : public Fix { int maxsize_restart() override; void reset_dt() override; - void hooke(double, double, double, double, double *, double *, double *, double *, double *, - double, double, double *); - void hooke_history(double, double, double, double, double *, double *, double *, double *, - double *, double, double, double *, double *); - void hertz_history(double, double, double, double, double *, double, double *, double *, double *, - double *, double, double, double *, double *); - void granular(double, double, double, double, double *, double, double *, double *, double *, - double *, double, double, double *, double *); - - double pulloff_distance(double); - protected: int wallstyle, wiggle, wshear, axis; - int pairstyle, nlevels_respa; + int classic_flag, nlevels_respa; bigint time_origin; - double kn, kt, gamman, gammat, xmu; // for granular model choices - int normal_model, damping_model; - int tangential_model, roll_model, twist_model; - int limit_damping; - - // history flags - int normal_history, tangential_history, roll_history, twist_history; + Contact::ContactModel *model; // indices of history entries int normal_history_index; + int damping_history_index; int tangential_history_index; int roll_history_index; int twist_history_index; - // material coefficients - double Emod, poiss, Gmod; - - // contact model coefficients - double normal_coeffs[4]; - double tangential_coeffs[3]; - double roll_coeffs[3]; - double twist_coeffs[3]; - double lo, hi, cylradius; double amplitude, period, omega, vshear; double dt; + double Twall; char *idregion; int use_history; // if particle/wall interaction stores history int history_update; // flag for whether shear history is updated int size_history; // # of shear history values per contact + int heat_flag; + int limit_damping; // shear history for single contact per particle diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 6509c88a0b..c288abf92e 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -23,6 +23,7 @@ #include "error.h" #include "memory.h" #include "neighbor.h" +#include "math_extra.h" #include "region.h" #include "update.h" @@ -30,6 +31,7 @@ using namespace LAMMPS_NS; using namespace FixConst; +using namespace MathExtra; /* ---------------------------------------------------------------------- */ @@ -117,8 +119,11 @@ void FixWallGranRegion::init() void FixWallGranRegion::post_force(int /*vflag*/) { int i, m, nc, iwall; - double dx, dy, dz, rsq, meff; + double dx, dy, dz, meff; + double *forces, *torquesi, dq, rwall; double vwall[3]; + double w0[3] = {0.0}; + bool touchflag = false; // do not update shear history during setup @@ -158,7 +163,11 @@ void FixWallGranRegion::post_force(int /*vflag*/) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; - + double *temperature, *heatflux; + if (heat_flag) { + temperature = atom->temperature; + heatflux = atom->heatflux; + } int *mask = atom->mask; int nlocal = atom->nlocal; @@ -172,95 +181,105 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (peratom_flag) { clear_stored_contacts(); } + // Define constant wall properties (atom j) + model->radj = 0.0; + model->omegaj = w0; + if (heat_flag) model->Tj = Twall; + for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - if (!region->match(x[i][0], x[i][1], x[i][2])) continue; + if (! mask[i] & groupbit) continue; + if (!region->match(x[i][0], x[i][1], x[i][2]))continue; - if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) { - nc = region->surface(x[i][0], x[i][1], x[i][2], radius[i] + pulloff_distance(radius[i])); - } else { - nc = region->surface(x[i][0], x[i][1], x[i][2], radius[i]); + nc = region->surface(x[i][0], x[i][1], x[i][2], model->pulloff_distance(radius[i], 0.0)); + if (nc > tmax) error->one(FLERR, "Too many wallgran/region contacts for one particle"); + + // shear history maintenance + // update ncontact,walls,shear2many for particle I + // to reflect new and persistent shear historyvalues + // also set c2r[] = indices into region->contact[]for each of N contacts + // process zero or one contact here, otherwiseinvoke update_contacts() + + if (use_history) { + if (nc == 0) { + ncontact[i] = 0; + continue; } - if (nc > tmax) error->one(FLERR, "Too many wall/gran/region contacts for one particle"); + if (nc == 1) { + c2r[0] = 0; + iwall = region->contact[0].iwall; + if (ncontact[i] == 0) { + ncontact[i] = 1; + walls[i][0] = iwall; + for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; + } else if (ncontact[i] > 1 || iwall != walls[i][0]) + update_contacts(i, nc); + } else + update_contacts(i, nc); + } - // shear history maintenance - // update ncontact,walls,shear2many for particle I - // to reflect new and persistent shear history values - // also set c2r[] = indices into region->contact[] for each of N contacts - // process zero or one contact here, otherwise invoke update_contacts() + // process current contacts + for (int ic = 0; ic < nc; ic++) { - if (use_history) { - if (nc == 0) { - ncontact[i] = 0; + // Reset model and copy initial geometric data + model->reset_contact(); + model->xi = x[i]; + model->dx[0] = region->contact[ic].delx; + model->dx[1] = region->contact[ic].dely; + model->dx[2] = region->contact[ic].delz; + model->radi = radius[i]; + model->rwall = rwall; + + touchflag = model->check_contact(); + + + if (model->beyond_contact) { + if (history_many[i][c2r[ic]][0] == 0.0 && model->rsq > model->radsum * model->radsum) { + for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; continue; } - if (nc == 1) { - c2r[0] = 0; - iwall = region->contact[0].iwall; - if (ncontact[i] == 0) { - ncontact[i] = 1; - walls[i][0] = iwall; - for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; - } else if (ncontact[i] > 1 || iwall != walls[i][0]) - update_contacts(i, nc); - } else - update_contacts(i, nc); - } + } // Dan: not quite sure about this - // process current contacts - for (int ic = 0; ic < nc; ic++) { - // rsq = squared contact distance - // xc = contact point + if (regiondynamic) region->velocity_contact(vwall, x[i], ic); + model->vj = vwall; - rsq = region->contact[ic].r * region->contact[ic].r; + // meff = effective mass of sphere + // if I is part of rigid body, use body mass - if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) { - if (history_many[i][c2r[ic]][0] == 0.0 && rsq > radius[i] * radius[i]) { - for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; - continue; - } - } + meff = rmass[i]; + if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i]; - dx = region->contact[ic].delx; - dy = region->contact[ic].dely; - dz = region->contact[ic].delz; + // Copy additional information and prepare force calculations + model->meff = meff; + model->vi = v[i]; + model->omegai = omega[i]; + model->history_update = history_update; + if (use_history) model->history = history_one[i]; + if (heat_flag) model->Ti = temperature[i]; + model->prep_contact(); - if (regiondynamic) region->velocity_contact(vwall, x[i], ic); + model->calculate_forces(); + if (heat_flag) dq = model->calculate_heat(); - // meff = effective mass of sphere - // if I is part of rigid body, use body mass + forces = model->forces; + torquesi = model->torquesi; - meff = rmass[i]; - if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i]; + // apply forces & torques + add3(f[i], forces, f[i]); - // store contact info - if (peratom_flag) { - 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; - array_atom[i][7] = radius[i]; - } + add3(torque[i], torquesi, torque[i]); + if (heat_flag) heatflux[i] += dq; - // invoke sphere/wall interaction - double *contact; - if (peratom_flag) - contact = array_atom[i]; - else - contact = nullptr; - - if (pairstyle == FixWallGran::HOOKE) - hooke(rsq, dx, dy, dz, vwall, v[i], f[i], omega[i], torque[i], radius[i], meff, contact); - else if (pairstyle == FixWallGran::HOOKE_HISTORY) - hooke_history(rsq, dx, dy, dz, vwall, v[i], f[i], omega[i], torque[i], radius[i], meff, - history_many[i][c2r[ic]], contact); - else if (pairstyle == FixWallGran::HERTZ_HISTORY) - hertz_history(rsq, dx, dy, dz, vwall, region->contact[ic].radius, v[i], f[i], omega[i], - torque[i], radius[i], meff, history_many[i][c2r[ic]], contact); - else if (pairstyle == FixWallGran::GRANULAR) - granular(rsq, dx, dy, dz, vwall, region->contact[ic].radius, v[i], f[i], omega[i], - torque[i], radius[i], meff, history_many[i][c2r[ic]], contact); + // store contact info + if (peratom_flag) { + array_atom[i][0] = 1.0; + array_atom[i][1] = forces[0]; + array_atom[i][2] = forces[1]; + array_atom[i][3] = forces[2]; + array_atom[i][4] = x[i][0] - dx; + array_atom[i][5] = x[i][1] - dy; + array_atom[i][6] = x[i][2] - dz; + array_atom[i][7] = radius[i]; } } } diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index e401f8cb84..9b1a036928 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -121,14 +121,14 @@ void PairGranular::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double factor_lj,mi,mj,meff,delx,dely,delz; - double *forces, *torquesi, *torquesj; + double *forces, *torquesi, *torquesj, dq; int *ilist,*jlist,*numneigh,**firstneigh; int *touch,**firsttouch; double *history,*allhistory,**firsthistory; bool touchflag = false; - const bool historyupdate = update->setupflag == 0; + const bool history_update = update->setupflag == 0; ev_init(eflag,vflag); @@ -163,7 +163,7 @@ void PairGranular::compute(int eflag, int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; double *special_lj = force->special_lj; - double *heatflux, *temperature, dq; + double *heatflux, *temperature; if (heat_flag) { heatflux = atom->heatflux; temperature = atom->temperature; @@ -234,14 +234,13 @@ void PairGranular::compute(int eflag, int vflag) models[itype][jtype]->vj = v[j]; models[itype][jtype]->omegai = omega[i]; models[itype][jtype]->omegaj = omega[j]; - models[itype][jtype]->history_update = historyupdate; - models[itype][jtype]->history = history; - models[itype][jtype]->prep_contact(); - + models[itype][jtype]->history_update = history_update; + if (use_history) models[itype][jtype]->history = history; if (heat_flag) { models[itype][jtype]->Ti = temperature[i]; models[itype][jtype]->Tj = temperature[j]; } + models[itype][jtype]->prep_contact(); if (models[itype][jtype]->beyond_contact) touch[jj] = 1; @@ -320,9 +319,6 @@ void PairGranular::settings(int narg, char **arg) } else { cutoff_global = -1; // will be set based on particle sizes, model choice } - - normal_history = tangential_history = 0; - roll_history = twist_history = 0; } /* ---------------------------------------------------------------------- @@ -332,7 +328,6 @@ void PairGranular::settings(int narg, char **arg) void PairGranular::coeff(int narg, char **arg) { double cutoff_one = -1; - int ncoeff; if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients"); @@ -349,26 +344,16 @@ void PairGranular::coeff(int narg, char **arg) //Parse mandatory normal and tangential specifications int iarg = 2; vec_models.back().init_model(std::string(arg[iarg]), NORMAL); - ncoeff = vec_models.back().normal_model->num_coeffs; iarg += 1; - if (iarg + ncoeff >= narg) - error->all(FLERR,"Illegal pair_coeff command" - "Insufficient arguments provided for normal model."); - vec_models.back().normal_model->parse_coeffs(arg, iarg); - iarg += ncoeff; + iarg = vec_models.back().normal_model->parse_coeffs(arg, iarg, narg); if (strcmp(arg[iarg], "tangential") == 0) { if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_coeff command, must specify " "tangential model after tangential keyword"); vec_models.back().init_model(std::string(arg[iarg]), TANGENTIAL); - ncoeff = vec_models.back().tangential_model->num_coeffs; iarg += 1; - if (iarg + ncoeff >= narg) - error->all(FLERR, "Illegal pair_coeff command" - "Insufficient arguments provided for tangential model."); - vec_models.back().tangential_model->parse_coeffs(arg, iarg); - iarg += ncoeff; + iarg = vec_models.back().tangential_model->parse_coeffs(arg, iarg, narg); } else{ error->all(FLERR, "Illegal pair_coeff command, 'tangential' keyword expected"); } @@ -379,51 +364,27 @@ void PairGranular::coeff(int narg, char **arg) if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); vec_models.back().init_model(std::string(arg[iarg]), DAMPING); - ncoeff = vec_models.back().damping_model->num_coeffs; iarg += 1; - if (iarg + ncoeff >= narg) - error->all(FLERR, "Illegal pair_coeff command" - "Insufficient arguments provided for damping model."); - vec_models.back().damping_model->parse_coeffs(arg, iarg); - iarg += ncoeff; - + iarg = vec_models.back().damping_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "rolling") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); vec_models.back().init_model(std::string(arg[iarg]), ROLLING); - ncoeff = vec_models.back().rolling_model->num_coeffs; iarg += 1; - if (iarg + ncoeff >= narg) - error->all(FLERR, "Illegal pair_coeff command" - "Insufficient arguments provided for rolling model."); - vec_models.back().rolling_model->parse_coeffs(arg, iarg); - iarg += ncoeff; - + iarg = vec_models.back().rolling_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "twisting") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); vec_models.back().init_model(std::string(arg[iarg]), TWISTING); - ncoeff = vec_models.back().twisting_model->num_coeffs; iarg += 1; - if (iarg + ncoeff >= narg) - error->all(FLERR, "Illegal pair_coeff command" - "Insufficient arguments provided for twisting model."); - vec_models.back().twisting_model->parse_coeffs(arg, iarg); - iarg += ncoeff; - + iarg = vec_models.back().twisting_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "heat") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); vec_models.back().init_model(std::string(arg[iarg]), HEAT); - ncoeff = vec_models.back().heat_model->num_coeffs; iarg += 1; - if (iarg + ncoeff >= narg) - error->all(FLERR, "Illegal pair_coeff command" - "Insufficient arguments provided for heat model."); - vec_models.back().heat_model->parse_coeffs(arg, iarg); - iarg += ncoeff; + iarg = vec_models.back().heat_model->parse_coeffs(arg, iarg, narg); heat_flag = 1; - } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); @@ -437,11 +398,9 @@ void PairGranular::coeff(int narg, char **arg) } else error->all(FLERR, "Illegal pair_coeff command"); } - // Define default damping model if unspecified, takes no args - if (!vec_models.back().damping_model) { + // Define default damping model if unspecified, has no coeffs + if (!vec_models.back().damping_model) vec_models.back().init_model("viscoelastic", DAMPING); - vec_models.back().damping_model->parse_coeffs(arg, 0); - } if (vec_models.back().limit_damping && !vec_models.back().normal_model->allow_limit_damping) error->all(FLERR,"Illegal pair_coeff command, " @@ -483,11 +442,7 @@ void PairGranular::init_style() int size_twisting_history = 0; for (int i = 1; i <= atom->ntypes; i++) { for (int j = i; j <= atom->ntypes; j++) { - if (models[i][j]->normal_model->size_history != 0 || - models[i][j]->damping_model->size_history != 0 || - models[i][j]->tangential_model->size_history != 0 || - models[i][j]->rolling_model->size_history != 0 || - models[i][j]->twisting_model->size_history != 0) use_history = 1; + if (models[i][j]->size_history != 0) use_history = 1; if (models[i][j]->normal_model->size_history > size_normal_history) size_normal_history = models[i][j]->damping_model->size_history; @@ -495,10 +450,12 @@ void PairGranular::init_style() size_damping_history = models[i][j]->normal_model->size_history; if (models[i][j]->tangential_model->size_history > size_tangential_history) size_tangential_history = models[i][j]->tangential_model->size_history; - if (models[i][j]->rolling_model->size_history > size_rolling_history) - size_rolling_history = models[i][j]->rolling_model->size_history; - if (models[i][j]->twisting_model->size_history > size_twisting_history) - size_twisting_history = models[i][j]->twisting_model->size_history; + if (models[i][j]->rolling_model) + if (models[i][j]->rolling_model->size_history > size_rolling_history) + size_rolling_history = models[i][j]->rolling_model->size_history; + if (models[i][j]->twisting_model) + if (models[i][j]->twisting_model->size_history > size_twisting_history) + size_twisting_history = models[i][j]->twisting_model->size_history; } } @@ -506,9 +463,21 @@ void PairGranular::init_style() size_tangential_history + size_rolling_history + size_twisting_history; damping_history_index = size_normal_history; - tangential_history_index = size_normal_history + damping_history_index; - roll_history_index = size_normal_history + damping_history_index + size_tangential_history; - twist_history_index = size_normal_history + damping_history_index + size_tangential_history + size_rolling_history; + tangential_history_index = damping_history_index + size_damping_history; + roll_history_index = tangential_history_index + size_tangential_history; + twist_history_index = roll_history_index + size_rolling_history; + + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = i; j <= atom->ntypes; j++) { + models[i][j]->normal_model->history_index = 0; + models[i][j]->damping_model->history_index = damping_history_index; + models[i][j]->tangential_model->history_index = tangential_history_index; + if (models[i][j]->rolling_model) + models[i][j]->rolling_model->history_index = roll_history_index; + if (models[i][j]->twisting_model) + models[i][j]->twisting_model->history_index = twist_history_index; + } + } if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY); else neighbor->add_request(this, NeighConst::REQ_SIZE); diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 1032cf6b7c..68b83d3686 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -75,9 +75,6 @@ class PairGranular : public Pair { std::vector vec_models; Contact::ContactModel ***models; - // history flags - int normal_history, tangential_history, roll_history, twist_history; - // indices of history entries int normal_history_index; int damping_history_index; diff --git a/src/contact.h b/src/contact.h index 96758771b4..bd04fe9ce1 100644 --- a/src/contact.h +++ b/src/contact.h @@ -52,7 +52,7 @@ class ContactModel : protected Pointers { double pulloff_distance(double, double); void init_model(std::string, ModelType); - + int init_classic_model(char **, int, int); void mix_coeffs(ContactModel*, ContactModel*); void write_restart(FILE *); @@ -68,7 +68,7 @@ class ContactModel : protected Pointers { SubModel *sub_models[6]; // Need to resize if we add more model flavors // Extra options - int beyond_contact, limit_damping, history_update; + int beyond_contact, limit_damping, history_update, wall_flag; double cutoff_type; // History variables @@ -79,7 +79,7 @@ class ContactModel : protected Pointers { // Contact properties/output double *forces, *torquesi, *torquesj; - double radi, radj, meff, dt, Ti, Tj, area; + double radi, radj, rwall, meff, dt, Ti, Tj, area; double Fntot, magtortwist; double *xi, *xj, *vi, *vj, *omegai, *omegaj; From 12c1923511e802b3b531e34b24fcf386f187dab5 Mon Sep 17 00:00:00 2001 From: Joel Thomas Clemmer Date: Fri, 12 Aug 2022 17:36:53 -0600 Subject: [PATCH 16/57] Updating mixing --- src/GRANULAR/contact_normal_models.cpp | 14 ++++++-------- src/GRANULAR/contact_normal_models.h | 2 +- src/GRANULAR/contact_tangential_models.cpp | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index 6a6db39189..514ed1338a 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -144,7 +144,6 @@ void NormalHertz::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) double NormalHertz::calculate_forces() { - contact->area = sqrt(contact->dR); Fne = knfac * contact->delta; return Fne; } @@ -173,7 +172,7 @@ void NormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - k = 4 / 3 * Emod; + k = 4 / 3 * mix_stiffnessE(Emod, Emod, poiss, poiss); if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); } @@ -182,7 +181,7 @@ void NormalHertzMaterial::coeffs_to_local() void NormalHertzMaterial::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); coeffs_to_local(); @@ -207,7 +206,7 @@ void NormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k = 4 / 3 * Emod; + k = 4 / 3 * mix_stiffnessE(Emod, Emod, poiss, poiss); if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); } @@ -216,7 +215,7 @@ void NormalDMT::coeffs_to_local() void NormalDMT::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); @@ -267,8 +266,7 @@ void NormalJKR::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k = 4/3*Emod; - Escaled = k * THREEQUARTERS; + Escaled = mix_stiffnessE(Emod, Emod, poiss, poiss); //Dan, not sure why these coefficients are mixed in the regular pair style if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); } @@ -277,7 +275,7 @@ void NormalJKR::coeffs_to_local() void NormalJKR::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index 74e2800eaa..080e019d4d 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -108,7 +108,7 @@ class NormalJKR: public NormalModel { void set_knfac(); void set_fncrit(); private: - double k, cohesion; + double cohesion; double Escaled, F_pulloff; }; diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 4f25e96071..89817ba00c 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -185,7 +185,7 @@ void TangentialMindlin::coeffs_to_local() if (k == -1) { if (!contact->normal_model->material_properties) error->all(FLERR, "Must either specify tangential stiffness or material properties for normal model for the Mindlin tangential style"); - k = 8.0 * mix_stiffnessE(contact->normal_model->Emod, contact->normal_model->Emod, contact->normal_model->poiss, contact->normal_model->poiss); + k = 8.0 * mix_stiffnessG(contact->normal_model->Emod, contact->normal_model->Emod, contact->normal_model->poiss, contact->normal_model->poiss); } if (k < 0.0 || xt < 0.0 || mu < 0.0) From 92c10cc2103d1a80ab03b8cfc4de154b84077d87 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 24 Aug 2022 12:19:27 -0600 Subject: [PATCH 17/57] Fixing memory issues, passing lmp ptr to submodels, and other misc fixes/changes --- doc/src/pair_granular.rst | 2 +- src/GRANULAR/contact.cpp | 124 +++++---- src/GRANULAR/contact.h | 16 +- src/GRANULAR/contact_damping_models.cpp | 24 +- src/GRANULAR/contact_damping_models.h | 20 +- src/GRANULAR/contact_heat_models.cpp | 8 +- src/GRANULAR/contact_heat_models.h | 8 +- src/GRANULAR/contact_normal_models.cpp | 57 ++-- src/GRANULAR/contact_normal_models.h | 32 ++- src/GRANULAR/contact_rolling_models.cpp | 8 +- src/GRANULAR/contact_rolling_models.h | 8 +- src/GRANULAR/contact_sub_models.cpp | 14 +- src/GRANULAR/contact_sub_models.h | 5 +- src/GRANULAR/contact_tangential_models.cpp | 33 ++- src/GRANULAR/contact_tangential_models.h | 48 ++-- src/GRANULAR/contact_twisting_models.cpp | 14 +- src/GRANULAR/contact_twisting_models.h | 12 +- src/GRANULAR/fix_pour.cpp | 1 + src/GRANULAR/fix_wall_gran.cpp | 161 ++++++------ src/GRANULAR/fix_wall_gran.h | 7 - src/GRANULAR/fix_wall_gran_region.cpp | 34 ++- src/GRANULAR/pair_granular.cpp | 287 ++++++++++----------- src/GRANULAR/pair_granular.h | 9 +- src/contact.h | 16 +- 24 files changed, 511 insertions(+), 437 deletions(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index c14d94a77a..d630b18a3a 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -659,7 +659,7 @@ is equivalent to *pair gran/hooke 1000.0 NULL 50.0 50.0 0.4 1*\ . The second example is equivalent to *pair gran/hooke/history 1000.0 500.0 50.0 50.0 0.4 1*\ . The third example is equivalent to -*pair gran/hertz/history 1000.0 500.0 50.0 50.0 0.4 1*\ . +*pair gran/hertz/history 1000.0 500.0 50.0 50.0 0.4 1 limit_damping*\ . ---------- diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 7ce3d8c739..a59eca9374 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -18,9 +18,6 @@ */ #include "contact.h" -#include "pointers.h" -#include "math_const.h" -#include "math_extra.h" #include "contact_sub_models.h" #include "contact_normal_models.h" #include "contact_tangential_models.h" @@ -31,33 +28,48 @@ #include "comm.h" #include "error.h" #include "force.h" +#include "math_extra.h" #include +using namespace LAMMPS_NS; +using namespace Contact; using namespace MathExtra; -using namespace LAMMPS_NS::MathConst; -using namespace LAMMPS_NS::Contact; -ContactModel::ContactModel() : - Pointers(lmp) +ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) { limit_damping = 0; beyond_contact = 0; nondefault_history_transfer = 0; - cutoff_type = 0.0; - wall_flag = 0; - nmodels = 5; + nmodels = 6; + + wall_type = NONE; reset_contact(); + normal_model = nullptr; + damping_model = nullptr; + tangential_model = nullptr; + rolling_model = nullptr; + twisting_model = nullptr; + heat_model = nullptr; + for (int i = 0; i < nmodels; i++) sub_models[i] = nullptr; + transfer_history_factor = nullptr; } /* ---------------------------------------------------------------------- */ ContactModel::~ContactModel() { - delete[] transfer_history_factor; + delete [] transfer_history_factor; + + delete normal_model; + delete damping_model; + delete tangential_model; + delete rolling_model; + delete twisting_model; + delete heat_model; } /* ---------------------------------------------------------------------- */ @@ -65,52 +77,52 @@ ContactModel::~ContactModel() void ContactModel::init_model(std::string model_name, ModelType model_type) { if (model_type == NORMAL) { - if (model_name == "hooke") normal_model = new NormalHooke(); - else if (model_name == "hertz") normal_model = new NormalHertz(); - else if (model_name == "hertz/material") normal_model = new NormalHertzMaterial(); - else if (model_name == "dmt") normal_model = new NormalDMT(); - else if (model_name == "jkr") normal_model = new NormalJKR(); - else error->all(FLERR, "Normal model name not recognized"); + if (model_name == "hooke") normal_model = new NormalHooke(lmp); + else if (model_name == "hertz") normal_model = new NormalHertz(lmp); + else if (model_name == "hertz/material") normal_model = new NormalHertzMaterial(lmp); + else if (model_name == "dmt") normal_model = new NormalDMT(lmp); + else if (model_name == "jkr") normal_model = new NormalJKR(lmp); + else error->all(FLERR, "Normal model name {} not recognized", model_name); sub_models[model_type] = normal_model; } else if (model_type == TANGENTIAL) { - if (model_name =="linear_nohistory") tangential_model = new TangentialLinearNoHistory(); - else if (model_name =="linear_history") tangential_model = new TangentialLinearHistory(); - else if (model_name =="mindlin") tangential_model = new TangentialMindlin(); - else if (model_name =="mindlin/force") tangential_model = new TangentialMindlinForce(); - else if (model_name =="mindlin_rescale") tangential_model = new TangentialMindlinRescale(); - else if (model_name =="mindlin_rescale/force") tangential_model = new TangentialMindlinRescaleForce(); - else error->all(FLERR, "Tangential model name not recognized"); + if (model_name == "linear_nohistory") tangential_model = new TangentialLinearNoHistory(lmp); + else if (model_name == "linear_history") tangential_model = new TangentialLinearHistory(lmp); + else if (model_name == "mindlin") tangential_model = new TangentialMindlin(lmp); + else if (model_name == "mindlin/force") tangential_model = new TangentialMindlinForce(lmp); + else if (model_name == "mindlin_rescale") tangential_model = new TangentialMindlinRescale(lmp); + else if (model_name == "mindlin_rescale/force") tangential_model = new TangentialMindlinRescaleForce(lmp); + else error->all(FLERR, "Tangential model name {} not recognized", model_name); sub_models[model_type] = tangential_model; } else if (model_type == DAMPING) { - if (model_name =="velocity") damping_model = new DampingVelocity(); - else if (model_name =="mass_velocity") damping_model = new DampingMassVelocity(); - else if (model_name =="viscoelastic") damping_model = new DampingViscoelastic(); - else if (model_name =="tsuji") damping_model = new DampingTsuji(); - else error->all(FLERR, "Damping model name not recognized"); + if (model_name == "velocity") damping_model = new DampingVelocity(lmp); + else if (model_name == "mass_velocity") damping_model = new DampingMassVelocity(lmp); + else if (model_name == "viscoelastic") damping_model = new DampingViscoelastic(lmp); + else if (model_name == "tsuji") damping_model = new DampingTsuji(lmp); + else error->all(FLERR, "Damping model name {} not recognized", model_name); sub_models[model_type] = damping_model; } else if (model_type == ROLLING) { - if (model_name =="none") delete rolling_model; - else if (model_name =="sds") rolling_model = new RollingSDS(); - else error->all(FLERR, "Rolling model name not recognized"); + if (model_name == "none") delete rolling_model; + else if (model_name == "sds") rolling_model = new RollingSDS(lmp); + else error->all(FLERR, "Rolling model name {} not recognized", model_name); sub_models[model_type] = rolling_model; } else if (model_type == TWISTING) { - if (model_name =="none") delete twisting_model; - else if (model_name =="sds") twisting_model = new TwistingSDS(); - else if (model_name =="marshall") twisting_model = new TwistingMarshall(); - else error->all(FLERR, "Twisting model name not recognized"); + if (model_name == "none") delete twisting_model; + else if (model_name == "sds") twisting_model = new TwistingSDS(lmp); + else if (model_name == "marshall") twisting_model = new TwistingMarshall(lmp); + else error->all(FLERR, "Twisting model name {} not recognized", model_name); sub_models[model_type] = twisting_model; } else if (model_type == HEAT) { - if (model_name =="none") delete heat_model; - else if (model_name =="area") heat_model = new HeatArea(); - else error->all(FLERR, "Heat model name not recognized"); + if (model_name == "none") delete heat_model; + else if (model_name == "area") heat_model = new HeatArea(lmp); + else error->all(FLERR, "Heat model name not {} recognized", model_name); sub_models[model_type] = heat_model; } else { - error->all(FLERR, "Illegal model type"); + error->all(FLERR, "Illegal model type {}", model_type); } sub_models[model_type]->name.assign(model_name); @@ -198,10 +210,9 @@ void ContactModel::init() } } - transfer_history_factor = new double(size_history); - for (i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; - if (nondefault_history_transfer) { + transfer_history_factor = new double[size_history]; + for (i = 0; i < size_history; i++) { // Find which model controls this history value size_cumulative = 0; @@ -216,10 +227,15 @@ void ContactModel::init() if (j != nmodels) { if (sub_models[j]->nondefault_history_transfer) { transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; + } else { + transfer_history_factor[i] = -1; } } } } + + for (i = 0; i < nmodels; i++) + if (sub_models[i]) sub_models[i]->init(); } /* ---------------------------------------------------------------------- */ @@ -231,7 +247,6 @@ void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) sub_models[i]->mix_coeffs(c1->sub_models[i], c2->sub_models[i]); limit_damping = MAX(c1->limit_damping, c2->limit_damping); - cutoff_type = MAX(c1->cutoff_type, c2->cutoff_type); } /* ---------------------------------------------------------------------- */ @@ -301,15 +316,22 @@ void ContactModel::reset_contact() /* ---------------------------------------------------------------------- */ -bool ContactModel::check_contact() +bool ContactModel::check_contact(double rtemp) { check_flag = 1; - if (wall_flag) { + if (wall_type == RWALL) { + // Used by fix_wall_gran.cpp rsq = lensq3(dx); radsum = radi; - if (rwall == 0) Reff = radi; - else Reff = radi * rwall/(radi + rwall); + if (rtemp == 0) Reff = radi; + else Reff = radi * rtemp/(radi + rtemp); + } else if (wall_type == RDUPLICATE) { + // Used by fix_wall_gran_region.cpp + rsq = rtemp * rtemp; + radsum = radi + radi; + if (rtemp == 0) Reff = radi; + else Reff = radi * rtemp/(radi + rtemp); } else { sub3(xi, xj, dx); rsq = lensq3(dx); @@ -389,17 +411,17 @@ void ContactModel::calculate_forces() //********************************************** // calculate forces //********************************************** - + forces[0] = 0.0; double Fne, Fdamp; area = normal_model->calculate_area(); + normal_model->set_knfac(); Fne = normal_model->calculate_forces(); - normal_model->set_knfac(); // Needed for damping Fdamp = damping_model->calculate_forces(); + Fntot = Fne + Fdamp; normal_model->set_fncrit(); // Needed for tangential, rolling, twisting - Fntot = Fne + Fdamp; if (limit_damping && Fntot < 0.0) Fntot = 0.0; tangential_model->calculate_forces(); diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index bd04fe9ce1..4c38657ed7 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -26,6 +26,12 @@ enum ModelType { ROLLING = 3, TWISTING = 4, HEAT = 5 +}; // Relative order matters since some derive coeffs from others + +enum WallType { + NONE = 0, + RWALL = 1, + RDUPLICATE = 2 }; #define EPSILON 1e-10 @@ -41,10 +47,10 @@ class SubModel; class ContactModel : protected Pointers { public: - ContactModel(); + ContactModel(class LAMMPS *); ~ContactModel(); void init(); - bool check_contact(); + bool check_contact(double = 0); void reset_contact(); void prep_contact(); void calculate_forces(); @@ -68,8 +74,8 @@ class ContactModel : protected Pointers { SubModel *sub_models[6]; // Need to resize if we add more model flavors // Extra options - int beyond_contact, limit_damping, history_update, wall_flag; - double cutoff_type; + int beyond_contact, limit_damping, history_update; + WallType wall_type; // History variables int size_history, nondefault_history_transfer; @@ -77,7 +83,7 @@ class ContactModel : protected Pointers { double *history; // Contact properties/output - double *forces, *torquesi, *torquesj; + double forces[3], torquesi[3], torquesj[3]; double radi, radj, rwall, meff, dt, Ti, Tj, area; double Fntot, magtortwist; diff --git a/src/GRANULAR/contact_damping_models.cpp b/src/GRANULAR/contact_damping_models.cpp index 7a79c6946c..8d44746683 100644 --- a/src/GRANULAR/contact_damping_models.cpp +++ b/src/GRANULAR/contact_damping_models.cpp @@ -24,7 +24,11 @@ using namespace MathSpecial; Default damping model ------------------------------------------------------------------------- */ -void DampingModel::coeffs_to_local() +DampingModel::DampingModel(LAMMPS *lmp) : SubModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + +void DampingModel::init() { damp = contact->normal_model->damp; } @@ -33,6 +37,10 @@ void DampingModel::coeffs_to_local() Velocity damping ------------------------------------------------------------------------- */ +DampingVelocity::DampingVelocity(LAMMPS *lmp) : DampingModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + double DampingVelocity::calculate_forces() { return -damp * contact->vnnr; @@ -42,6 +50,10 @@ double DampingVelocity::calculate_forces() Mass velocity damping ------------------------------------------------------------------------- */ +DampingMassVelocity::DampingMassVelocity(LAMMPS *lmp) : DampingModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + double DampingMassVelocity::calculate_forces() { return -damp * contact->meff * contact->vnnr; @@ -51,6 +63,10 @@ double DampingMassVelocity::calculate_forces() Default, viscoelastic damping ------------------------------------------------------------------------- */ +DampingViscoelastic::DampingViscoelastic(LAMMPS *lmp) : DampingModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + double DampingViscoelastic::calculate_forces() { return -damp * contact->meff * contact->area * contact->vnnr; @@ -60,7 +76,11 @@ double DampingViscoelastic::calculate_forces() Tsuji damping ------------------------------------------------------------------------- */ -void DampingTsuji::coeffs_to_local() +DampingTsuji::DampingTsuji(LAMMPS *lmp) : DampingModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + +void DampingTsuji::init() { double tmp = contact->normal_model->damp; damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); diff --git a/src/GRANULAR/contact_damping_models.h b/src/GRANULAR/contact_damping_models.h index 440ab36369..70294edc6a 100644 --- a/src/GRANULAR/contact_damping_models.h +++ b/src/GRANULAR/contact_damping_models.h @@ -15,46 +15,52 @@ #define CONTACT_DAMPING_MODELS_H_ #include "contact_sub_models.h" +#include "pointers.h" namespace LAMMPS_NS { namespace Contact { class DampingModel : public SubModel { public: - DampingModel() {}; + DampingModel(class LAMMPS *); ~DampingModel() {}; - virtual void coeffs_to_local(); + virtual void coeffs_to_local() {}; virtual void mix_coeffs(DampingModel*, DampingModel*) {}; + virtual void init(); virtual double calculate_forces() = 0; double damp; }; /* ---------------------------------------------------------------------- */ -class DampingVelocity: public DampingModel { +class DampingVelocity : public DampingModel { public: + DampingVelocity(class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class DampingMassVelocity: public DampingModel { +class DampingMassVelocity : public DampingModel { public: + DampingMassVelocity(class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class DampingViscoelastic: public DampingModel { +class DampingViscoelastic : public DampingModel { public: + DampingViscoelastic(class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class DampingTsuji: public DampingModel { +class DampingTsuji : public DampingModel { public: - void coeffs_to_local(); + DampingTsuji(class LAMMPS *); + void init(); double calculate_forces(); }; diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp index 3793f774c2..d25955b1c2 100644 --- a/src/GRANULAR/contact_heat_models.cpp +++ b/src/GRANULAR/contact_heat_models.cpp @@ -18,11 +18,17 @@ using namespace LAMMPS_NS; using namespace Contact; +/* ---------------------------------------------------------------------- + Default heat conduction +------------------------------------------------------------------------- */ + +HeatModel::HeatModel(LAMMPS *lmp) : SubModel(lmp) {} + /* ---------------------------------------------------------------------- Area-based heat conduction ------------------------------------------------------------------------- */ -HeatArea::HeatArea() +HeatArea::HeatArea(LAMMPS *lmp) : HeatModel(lmp) { num_coeffs = 1; } diff --git a/src/GRANULAR/contact_heat_models.h b/src/GRANULAR/contact_heat_models.h index 469a53cb13..b3104e9f3a 100644 --- a/src/GRANULAR/contact_heat_models.h +++ b/src/GRANULAR/contact_heat_models.h @@ -21,7 +21,7 @@ namespace Contact { class HeatModel : public SubModel { public: - HeatModel() {}; + HeatModel(class LAMMPS *); ~HeatModel() {}; virtual void coeffs_to_local() {}; virtual void mix_coeffs(HeatModel*, HeatModel*) {}; @@ -30,13 +30,13 @@ class HeatModel : public SubModel { /* ---------------------------------------------------------------------- */ -class HeatArea: public HeatModel { +class HeatArea : public HeatModel { public: - HeatArea(); + HeatArea(class LAMMPS *); void coeffs_to_local(); void mix_coeffs(HeatModel*, HeatModel*); double calculate_heat(); - private: + protected: double conductivity; }; diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index 6a6db39189..f4d4848833 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -32,7 +32,7 @@ using namespace MathConst; Default normal model ------------------------------------------------------------------------- */ -NormalModel::NormalModel() +NormalModel::NormalModel(LAMMPS *lmp) : SubModel(lmp) { material_properties = 0; } @@ -72,10 +72,9 @@ void NormalModel::set_fncrit() Hookean normal force ------------------------------------------------------------------------- */ -NormalHooke::NormalHooke() +NormalHooke::NormalHooke(LAMMPS *lmp) : NormalModel(lmp) { num_coeffs = 2; - allocate_coeffs(); } /* ---------------------------------------------------------------------- */ @@ -116,7 +115,7 @@ void NormalHooke::set_knfac() Hertzian normal force ------------------------------------------------------------------------- */ -NormalHertz::NormalHertz() +NormalHertz::NormalHertz(LAMMPS *lmp) : NormalModel(lmp) { num_coeffs = 2; } @@ -160,7 +159,7 @@ void NormalHertz::set_knfac() Hertzian normal force with material properties ------------------------------------------------------------------------- */ -NormalHertzMaterial::NormalHertzMaterial() +NormalHertzMaterial::NormalHertzMaterial(LAMMPS *lmp) : NormalHertz(lmp) { material_properties = 1; num_coeffs = 3; @@ -173,7 +172,7 @@ void NormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - k = 4 / 3 * Emod; + k = FOURTHIRDS * Emod; if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); } @@ -192,7 +191,7 @@ void NormalHertzMaterial::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) DMT normal force ------------------------------------------------------------------------- */ -NormalDMT::NormalDMT() +NormalDMT::NormalDMT(LAMMPS *lmp) : NormalModel(lmp) { allow_limit_damping = 0; material_properties = 1; @@ -207,7 +206,7 @@ void NormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k = 4 / 3 * Emod; + k = FOURTHIRDS * Emod; if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); } @@ -228,7 +227,7 @@ void NormalDMT::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) double NormalDMT::calculate_forces() { Fne = knfac * contact->delta; - F_pulloff = 4 * MathConst::MY_PI * cohesion * contact->Reff; + F_pulloff = 4.0 * MathConst::MY_PI * cohesion * contact->Reff; Fne -= F_pulloff; return Fne; } @@ -244,14 +243,14 @@ void NormalDMT::set_knfac() void NormalDMT::set_fncrit() { - Fncrit = fabs(Fne + 2 * F_pulloff); + Fncrit = fabs(Fne + 2.0 * F_pulloff); } /* ---------------------------------------------------------------------- JKR normal force ------------------------------------------------------------------------- */ -NormalJKR::NormalJKR() +NormalJKR::NormalJKR(LAMMPS *lmp) : NormalModel(lmp) { allow_limit_damping = 0; material_properties = 1; @@ -267,7 +266,7 @@ void NormalJKR::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k = 4/3*Emod; + k = FOURTHIRDS * Emod; Escaled = k * THREEQUARTERS; if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); @@ -291,11 +290,15 @@ bool NormalJKR::touch() double area_at_pulloff, R2, delta_pulloff, dist_pulloff; bool touchflag; - R2 = contact->Reff * contact->Reff; - area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4 * Escaled)); - delta_pulloff = area_at_pulloff * area_at_pulloff / contact->Reff - 2 * sqrt(MY_PI * cohesion * area_at_pulloff /Escaled); - dist_pulloff = contact->radsum - delta_pulloff; - touchflag = (contact->rsq < dist_pulloff * dist_pulloff); + if (contact->touch) { + R2 = contact->Reff * contact->Reff; + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4.0 * Escaled)); + delta_pulloff = area_at_pulloff * area_at_pulloff / contact->Reff - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff /Escaled); + dist_pulloff = contact->radsum - delta_pulloff; + touchflag = contact->rsq < (dist_pulloff * dist_pulloff); + } else { + touchflag = contact->rsq < (contact->radsum * contact->radsum); + } return touchflag; } @@ -311,8 +314,8 @@ double NormalJKR::pulloff_distance(double radi, double radj) Reff_tmp = radi * radj / (radi + radj); // May not be defined if (Reff_tmp <= 0) return 0; - area_at_pulloff = cbrt(9 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4 * Escaled)); - return area_at_pulloff * area_at_pulloff / Reff_tmp - 2 * sqrt(MY_PI * cohesion * area_at_pulloff / Escaled); + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4.0 * Escaled)); + return area_at_pulloff * area_at_pulloff / Reff_tmp - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Escaled); } /* ---------------------------------------------------------------------- */ @@ -326,16 +329,16 @@ double NormalJKR::calculate_area() dR2 = contact->dR * contact->dR; t0 = cohesion * cohesion * R2 * R2 * Escaled; t1 = PI27SQ * t0; - t2 = 8 * contact->dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4 * dR2 * Escaled; + t2 = 8.0 * contact->dR * dR2 * Escaled * Escaled * Escaled; + t3 = 4.0 * dR2 * Escaled; // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2 * t2)); + sqrt1 = MAX(0, t0 * (t1 + 2.0 * t2)); t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); t5 = t3 / t4 + t4 / Escaled; - sqrt2 = MAX(0, 2 * contact->dR + t5); + sqrt2 = MAX(0, 2.0 * contact->dR + t5); t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4 * contact->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + sqrt3 = MAX(0, 4.0 * contact->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); return INVROOT6 * (t6 + sqrt(sqrt3)); } @@ -347,8 +350,8 @@ double NormalJKR::calculate_forces() double a2; a2 = contact->area * contact->area; - Fne = Escaled * contact->area * a2 / contact->Reff - MY_2PI * a2 * sqrt(4 * cohesion * Escaled / (MY_PI * contact->area)); - F_pulloff = 3 * MY_PI * cohesion * contact->Reff; + Fne = Escaled * contact->area * a2 / contact->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Escaled / (MY_PI * contact->area)); + F_pulloff = 3.0 * MY_PI * cohesion * contact->Reff; return Fne; } @@ -364,5 +367,5 @@ void NormalJKR::set_knfac() void NormalJKR::set_fncrit() { - Fncrit = fabs(Fne + 2 * F_pulloff); + Fncrit = fabs(Fne + 2.0 * F_pulloff); } diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index 74e2800eaa..ec604d04ba 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -21,7 +21,7 @@ namespace Contact { class NormalModel : public SubModel { public: - NormalModel(); + NormalModel(class LAMMPS *); ~NormalModel() {}; virtual void coeffs_to_local() {}; virtual void mix_coeffs(NormalModel*, NormalModel*) {}; @@ -39,65 +39,63 @@ class NormalModel : public SubModel { /* ---------------------------------------------------------------------- */ -class NormalHooke: public NormalModel { +class NormalHooke : public NormalModel { public: - NormalHooke(); + NormalHooke(class LAMMPS *); ~NormalHooke() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); void set_knfac(); - private: + protected: double k; }; /* ---------------------------------------------------------------------- */ -class NormalHertz: public NormalModel { +class NormalHertz : public NormalModel { public: - NormalHertz(); + NormalHertz(class LAMMPS *); ~NormalHertz() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); void set_knfac(); - private: + protected: double k; }; /* ---------------------------------------------------------------------- */ -class NormalHertzMaterial: public NormalHertz { +class NormalHertzMaterial : public NormalHertz { public: - NormalHertzMaterial(); + NormalHertzMaterial(class LAMMPS *); ~NormalHertzMaterial() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); - private: - double k; }; /* ---------------------------------------------------------------------- */ -class NormalDMT: public NormalModel { +class NormalDMT : public NormalModel { public: - NormalDMT(); + NormalDMT(class LAMMPS *); ~NormalDMT() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); double calculate_forces(); void set_knfac(); void set_fncrit(); - private: + protected: double k, cohesion; double F_pulloff; }; /* ---------------------------------------------------------------------- */ -class NormalJKR: public NormalModel { +class NormalJKR : public NormalModel { public: - NormalJKR(); + NormalJKR(class LAMMPS *); ~NormalJKR() {}; void coeffs_to_local(); void mix_coeffs(NormalModel*, NormalModel*); @@ -107,7 +105,7 @@ class NormalJKR: public NormalModel { double calculate_forces(); void set_knfac(); void set_fncrit(); - private: + protected: double k, cohesion; double Escaled, F_pulloff; }; diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/GRANULAR/contact_rolling_models.cpp index 8074b14141..cc8e3e471e 100644 --- a/src/GRANULAR/contact_rolling_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -23,11 +23,17 @@ using namespace Contact; using namespace MathConst; using namespace MathExtra; +/* ---------------------------------------------------------------------- + Default rolling friction model +------------------------------------------------------------------------- */ + +RollingModel::RollingModel(LAMMPS *lmp) : SubModel(lmp) {} + /* ---------------------------------------------------------------------- SDS rolling friction model ------------------------------------------------------------------------- */ -RollingSDS::RollingSDS() +RollingSDS::RollingSDS(LAMMPS *lmp) : RollingModel(lmp) { num_coeffs = 3; size_history = 3; diff --git a/src/GRANULAR/contact_rolling_models.h b/src/GRANULAR/contact_rolling_models.h index 1cd23e1d5d..e81d22301c 100644 --- a/src/GRANULAR/contact_rolling_models.h +++ b/src/GRANULAR/contact_rolling_models.h @@ -21,7 +21,7 @@ namespace Contact { class RollingModel : public SubModel { public: - RollingModel() {}; + RollingModel(class LAMMPS *); ~RollingModel() {}; virtual void coeffs_to_local() {}; virtual void mix_coeffs(RollingModel*, RollingModel*) {}; @@ -30,13 +30,13 @@ class RollingModel : public SubModel { /* ---------------------------------------------------------------------- */ -class RollingSDS: public RollingModel { +class RollingSDS : public RollingModel { public: - RollingSDS(); + RollingSDS(class LAMMPS *); void coeffs_to_local(); void mix_coeffs(RollingModel*, RollingModel*); double calculate_forces(); - private: + protected: double k, mu, gamma; }; diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index a0bf99301d..8aafc0f2b5 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -24,8 +24,11 @@ using namespace LAMMPS_NS; using namespace Contact; -SubModel::SubModel() : - Pointers(lmp) +/* ---------------------------------------------------------------------- + Parent class for all types of contact forces +------------------------------------------------------------------------- */ + +SubModel::SubModel(LAMMPS *lmp) : Pointers(lmp) { allocated = 0; size_history = 0; @@ -58,13 +61,12 @@ void SubModel::allocate_coeffs() int SubModel::parse_coeffs(char **arg, int iarg, int narg) { - if (iarg + num_coeffs >= narg) + if (iarg + num_coeffs > narg) error->all(FLERR, "Insufficient arguments provided for {} model", name); - for (int i = 0; i < num_coeffs; i++) { // A few parameters (eg.g kt for tangential mindlin) allow null - if (strcmp(arg[iarg+i+1], "NULL") == 0) coeffs[i] = -1; - else coeffs[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); + if (strcmp(arg[iarg+i], "NULL") == 0) coeffs[i] = -1; + else coeffs[i] = utils::numeric(FLERR,arg[iarg+i],false,lmp); } coeffs_to_local(); diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index 95da8d5cbf..67e9c79e35 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -15,14 +15,14 @@ #define CONTACT_SUB_MODEL_H_ #include "contact.h" -#include "pointers.h" +#include "pointers.h" // IWYU pragma: export namespace LAMMPS_NS { namespace Contact { class SubModel : protected Pointers { public: - SubModel(); + SubModel(class LAMMPS *); virtual ~SubModel(); int num_coeffs; @@ -31,6 +31,7 @@ class SubModel : protected Pointers { int parse_coeffs(char **, int, int); virtual void mix_coeffs(SubModel*, SubModel*) {}; virtual void coeffs_to_local() {}; + virtual void init() {}; // called after all other submodel coeffs defined void allocate_coeffs(); std::string name; diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 4f25e96071..c73328ff10 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -24,11 +24,24 @@ using namespace Contact; using namespace MathConst; using namespace MathExtra; +/* ---------------------------------------------------------------------- + Default model +------------------------------------------------------------------------- */ + +TangentialModel::TangentialModel(LAMMPS *lmp) : SubModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + +void TangentialModel::init() +{ + damp = xt * contact->damping_model->damp; +} + /* ---------------------------------------------------------------------- Linear model with no history ------------------------------------------------------------------------- */ -TangentialLinearNoHistory::TangentialLinearNoHistory() +TangentialLinearNoHistory::TangentialLinearNoHistory(LAMMPS *lmp) : TangentialModel(lmp) { num_coeffs = 2; size_history = 3; @@ -41,7 +54,6 @@ void TangentialLinearNoHistory::coeffs_to_local() k = 0.0; // No tangential stiffness with no history xt = coeffs[0]; mu = coeffs[1]; - damp = xt * contact->damping_model->damp; if (k < 0.0 || xt < 0.0 || mu < 0.0) error->all(FLERR, "Illegal linear no history tangential model"); @@ -76,7 +88,7 @@ void TangentialLinearNoHistory::calculate_forces() Linear model with history ------------------------------------------------------------------------- */ -TangentialLinearHistory::TangentialLinearHistory() +TangentialLinearHistory::TangentialLinearHistory(LAMMPS *lmp) : TangentialModel(lmp) { num_coeffs = 3; size_history = 3; @@ -89,7 +101,6 @@ void TangentialLinearHistory::coeffs_to_local() k = coeffs[0]; xt = coeffs[1]; mu = coeffs[2]; - damp = xt * contact->damping_model->damp; if (k < 0.0 || xt < 0.0 || mu < 0.0) error->all(FLERR, "Illegal linear tangential model"); @@ -166,7 +177,7 @@ void TangentialLinearHistory::calculate_forces() Mindlin model ------------------------------------------------------------------------- */ -TangentialMindlin::TangentialMindlin() +TangentialMindlin::TangentialMindlin(LAMMPS *lmp) : TangentialModel(lmp) { num_coeffs = 3; size_history = 3; @@ -190,8 +201,6 @@ void TangentialMindlin::coeffs_to_local() if (k < 0.0 || xt < 0.0 || mu < 0.0) error->all(FLERR, "Illegal Mindlin tangential model"); - - damp = xt * contact->damping_model->damp; } /* ---------------------------------------------------------------------- */ @@ -293,7 +302,7 @@ void TangentialMindlin::calculate_forces() Mindlin force model ------------------------------------------------------------------------- */ -TangentialMindlinForce::TangentialMindlinForce() +TangentialMindlinForce::TangentialMindlinForce(LAMMPS *lmp) : TangentialMindlin(lmp) { num_coeffs = 3; size_history = 3; @@ -305,7 +314,7 @@ TangentialMindlinForce::TangentialMindlinForce() Mindlin rescale model ------------------------------------------------------------------------- */ -TangentialMindlinRescale::TangentialMindlinRescale() +TangentialMindlinRescale::TangentialMindlinRescale(LAMMPS *lmp) : TangentialMindlin(lmp) { num_coeffs = 3; size_history = 4; @@ -313,7 +322,7 @@ TangentialMindlinRescale::TangentialMindlinRescale() mindlin_rescale = 1; nondefault_history_transfer = 1; - transfer_history_factor = new double(size_history); + transfer_history_factor = new double[size_history]; for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; transfer_history_factor[3] = +1; } @@ -322,7 +331,7 @@ TangentialMindlinRescale::TangentialMindlinRescale() Mindlin rescale force model ------------------------------------------------------------------------- */ -TangentialMindlinRescaleForce::TangentialMindlinRescaleForce() +TangentialMindlinRescaleForce::TangentialMindlinRescaleForce(LAMMPS *lmp) : TangentialMindlin(lmp) { num_coeffs = 3; size_history = 4; @@ -330,7 +339,7 @@ TangentialMindlinRescaleForce::TangentialMindlinRescaleForce() mindlin_rescale = 1; nondefault_history_transfer = 1; - transfer_history_factor = new double(size_history); + transfer_history_factor = new double[size_history]; for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; transfer_history_factor[3] = +1; } diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index f5d83a57f7..4e2c85f678 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -21,71 +21,69 @@ namespace Contact { class TangentialModel : public SubModel { public: - TangentialModel() {}; + TangentialModel(class LAMMPS *); virtual ~TangentialModel() {}; virtual void coeffs_to_local() {}; virtual void mix_coeffs(TangentialModel*, TangentialModel*) {}; virtual void calculate_forces() = 0; + void init(); int rescale_flag; double k, damp, mu; // Used by Marshall twisting model -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialLinearNoHistory: public TangentialModel { - public: - TangentialLinearNoHistory(); - void coeffs_to_local(); - void mix_coeffs(TangentialModel*, TangentialModel*); - void calculate_forces(); - private: + protected: double xt; }; /* ---------------------------------------------------------------------- */ -class TangentialLinearHistory: public TangentialModel { +class TangentialLinearNoHistory : public TangentialModel { public: - TangentialLinearHistory(); + TangentialLinearNoHistory(class LAMMPS *); void coeffs_to_local(); void mix_coeffs(TangentialModel*, TangentialModel*); void calculate_forces(); - private: - double xt; }; /* ---------------------------------------------------------------------- */ -class TangentialMindlin: public TangentialModel { +class TangentialLinearHistory : public TangentialModel { public: - TangentialMindlin(); + TangentialLinearHistory(class LAMMPS *); + void coeffs_to_local(); + void mix_coeffs(TangentialModel*, TangentialModel*); + void calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class TangentialMindlin : public TangentialModel { + public: + TangentialMindlin(class LAMMPS *); void coeffs_to_local(); void mix_coeffs(TangentialModel*, TangentialModel*); void calculate_forces(); protected: int mindlin_rescale, mindlin_force; - double xt; }; /* ---------------------------------------------------------------------- */ -class TangentialMindlinForce: public TangentialMindlin { +class TangentialMindlinForce : public TangentialMindlin { public: - TangentialMindlinForce(); + TangentialMindlinForce(class LAMMPS *); }; /* ---------------------------------------------------------------------- */ -class TangentialMindlinRescale: public TangentialMindlin { +class TangentialMindlinRescale : public TangentialMindlin { public: - TangentialMindlinRescale(); + TangentialMindlinRescale(class LAMMPS *); }; /* ---------------------------------------------------------------------- */ -class TangentialMindlinRescaleForce: public TangentialMindlin { +class TangentialMindlinRescaleForce : public TangentialMindlin { public: - TangentialMindlinRescaleForce(); + TangentialMindlinRescaleForce(class LAMMPS *); }; } // namespace Contact diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 75a2414c21..089b4c686e 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -22,11 +22,21 @@ using namespace LAMMPS_NS; using namespace Contact; using namespace MathConst; +/* ---------------------------------------------------------------------- + Default twisting model +------------------------------------------------------------------------- */ + +TwistingModel::TwistingModel(LAMMPS *lmp) : SubModel(lmp) +{ + num_coeffs = 0; + size_history = 3; +} + /* ---------------------------------------------------------------------- Marshall twisting model ------------------------------------------------------------------------- */ -TwistingMarshall::TwistingMarshall() +TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) { num_coeffs = 0; size_history = 3; @@ -63,7 +73,7 @@ double TwistingMarshall::calculate_forces() SDS twisting model ------------------------------------------------------------------------- */ -TwistingSDS::TwistingSDS() +TwistingSDS::TwistingSDS(LAMMPS *lmp) : TwistingModel(lmp) { num_coeffs = 3; size_history = 3; diff --git a/src/GRANULAR/contact_twisting_models.h b/src/GRANULAR/contact_twisting_models.h index e689c8ed35..5bcdc6b2a3 100644 --- a/src/GRANULAR/contact_twisting_models.h +++ b/src/GRANULAR/contact_twisting_models.h @@ -21,7 +21,7 @@ namespace Contact { class TwistingModel : public SubModel { public: - TwistingModel() {}; + TwistingModel(class LAMMPS *); virtual ~TwistingModel() {}; virtual void coeffs_to_local() {}; virtual void mix_coeffs(TwistingModel*, TwistingModel*) {}; @@ -30,21 +30,21 @@ class TwistingModel : public SubModel { /* ---------------------------------------------------------------------- */ -class TwistingMarshall: public TwistingModel { +class TwistingMarshall : public TwistingModel { public: - TwistingMarshall(); + TwistingMarshall(class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class TwistingSDS: public TwistingModel { +class TwistingSDS : public TwistingModel { public: - TwistingSDS(); + TwistingSDS(class LAMMPS *); void coeffs_to_local(); void mix_coeffs(TwistingModel*, TwistingModel*); double calculate_forces(); - private: + protected: double k, mu, damp; }; diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 7a8bf630df..9cb71272f0 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -270,6 +270,7 @@ FixPour::~FixPour() delete[] molfrac; delete[] idrigid; delete[] idshake; + delete[] idregion; delete[] radius_poly; delete[] frac_poly; memory->destroy(coords); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index b4d94d62fe..208ff10bdd 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -38,7 +38,6 @@ #include "respa.h" #include "update.h" -#include #include using namespace LAMMPS_NS; @@ -69,8 +68,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // set interaction style // disable bonded/history option for now - model = new ContactModel(); - model->wall_flag = 1; + model = new ContactModel(lmp); + model->wall_type = RWALL; if (strcmp(arg[3],"granular") == 0) classic_flag = 0; else classic_flag = 1; @@ -82,7 +81,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : int iarg; if (classic_flag) { - iarg = 3; + iarg = 4; iarg = model->init_classic_model(arg, iarg, narg); if (iarg < narg) { @@ -93,40 +92,46 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } } else { - iarg = 3; - model->init_model(std::string(arg[iarg]), NORMAL); - iarg += 1; + iarg = 4; + model->init_model(std::string(arg[iarg++]), NORMAL); iarg = model->normal_model->parse_coeffs(arg, iarg, narg); while (iarg < narg) { if (strcmp(arg[iarg], "damping") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - model->init_model(std::string(arg[iarg]), DAMPING); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal fix wall/gran command, must specify " + "damping model after damping keyword"); + model->init_model(std::string(arg[iarg++]), DAMPING); iarg = model->damping_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "tangential") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - model->init_model(std::string(arg[iarg]), TANGENTIAL); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal fix wall/gran command, must specify " + "tangential model after tangential keyword"); + model->init_model(std::string(arg[iarg++]), TANGENTIAL); iarg = model->tangential_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "rolling") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - model->init_model(std::string(arg[iarg]), ROLLING); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal fix wall/gran command, must specify " + "rolling model after rolling keyword"); + model->init_model(std::string(arg[iarg++]), ROLLING); iarg = model->rolling_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "twisting") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - model->init_model(std::string(arg[iarg]), TWISTING); + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal fix wall/gran command, must specify " + "twisting model after twisting keyword"); + model->init_model(std::string(arg[iarg++]), TWISTING); iarg += 1; iarg = model->twisting_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "heat") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - model->init_model(std::string(arg[iarg]), HEAT); + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal fix wall/gran command, must specify " + "heat model after heat keyword"); + model->init_model(std::string(arg[iarg++]), HEAT); iarg += 1; iarg = model->heat_model->parse_coeffs(arg, iarg, narg); heat_flag = 1; @@ -156,7 +161,10 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with specified normal contact model"); + model->init(); + size_history = model->size_history; + if (model->beyond_contact) size_history += 1; //Need to track if particle is touching if (size_history == 0) use_history = restart_peratom = 0; else use_history = restart_peratom = 1; @@ -349,25 +357,16 @@ void FixWallGran::init() if (i < modify->nfix) fix_rigid = modify->fix[i]; // Define history indices - int size_normal_history = model->normal_model->size_history; - int size_tangential_history = model->tangential_model->size_history; - int size_damping_history = model->damping_model->size_history; - int size_rolling_history = 0; - int size_twisting_history = 0; - if (model->rolling_model) size_rolling_history = model->rolling_model->size_history; - if (model->twisting_model) size_twisting_history = model->twisting_model->size_history; + int next_index = 0; + if (model->beyond_contact) next_index = 1; - damping_history_index = size_normal_history; - tangential_history_index = damping_history_index + size_damping_history; - roll_history_index = tangential_history_index + size_tangential_history; - twist_history_index = roll_history_index + size_rolling_history; - - model->normal_model->history_index = 0; - model->damping_model->history_index = damping_history_index; - model->tangential_model->history_index = tangential_history_index; - if (model->rolling_model) model->rolling_model->history_index = roll_history_index; - if (model->twisting_model) model->twisting_model->history_index = twist_history_index; + for (i = 0; i < 6; i++) { + if (model->sub_models[i]) { + model->sub_models[i]->history_index = next_index; + next_index += model->sub_models[i]->size_history; + } + } } /* ---------------------------------------------------------------------- */ @@ -513,59 +512,61 @@ void FixWallGran::post_force(int /*vflag*/) // Reset model and copy initial geometric data model->reset_contact(); - model->xi = x[i]; model->dx[0] = dx; model->dx[1] = dy; model->dx[2] = dz; model->radi = radius[i]; - model->rwall = rwall; + if (model->beyond_contact) model->touch = history_one[i][0]; - touchflag = model->check_contact(); + touchflag = model->check_contact(rwall); if (!touchflag) { if (use_history) for (j = 0; j < size_history; j++) history_one[i][j] = 0.0; - } else { + continue; + } // Dan: I tried to simplify this logic, not sure it's 100% correct - // meff = effective mass of sphere - // if I is part of rigid body, use body mass + if (model->beyond_contact) + history_one[i][0] = 1; - meff = rmass[i]; - if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i]; + // meff = effective mass of sphere + // if I is part of rigid body, use body mass - // Copy additional information and prepare force calculations - model->meff = meff; - model->vi = v[i]; - model->omegai = omega[i]; - model->history_update = history_update; - if (use_history) model->history = history_one[i]; - if (heat_flag) model->Ti = temperature[i]; - model->prep_contact(); + meff = rmass[i]; + if (fix_rigid && mass_rigid[i] > 0.0) meff = mass_rigid[i]; - model->calculate_forces(); - if (heat_flag) dq = model->calculate_heat(); + // Copy additional information and prepare force calculations + model->meff = meff; + model->vi = v[i]; + model->omegai = omega[i]; + model->history_update = history_update; + if (use_history) model->history = history_one[i]; + if (heat_flag) model->Ti = temperature[i]; + model->prep_contact(); - forces = model->forces; - torquesi = model->torquesi; + model->calculate_forces(); + if (heat_flag) dq = model->calculate_heat(); - // apply forces & torques - add3(f[i], forces, f[i]); + forces = model->forces; + torquesi = model->torquesi; - add3(torque[i], torquesi, torque[i]); - if (heat_flag) heatflux[i] += dq; + // apply forces & torques + add3(f[i], forces, f[i]); - // store contact info - if (peratom_flag) { - array_atom[i][0] = 1.0; - array_atom[i][1] = forces[0]; - array_atom[i][2] = forces[1]; - array_atom[i][3] = forces[2]; - array_atom[i][4] = x[i][0] - dx; - array_atom[i][5] = x[i][1] - dy; - array_atom[i][6] = x[i][2] - dz; - array_atom[i][7] = radius[i]; - } + add3(torque[i], torquesi, torque[i]); + if (heat_flag) heatflux[i] += dq; + + // store contact info + if (peratom_flag) { + array_atom[i][0] = 1.0; + array_atom[i][1] = forces[0]; + array_atom[i][2] = forces[1]; + array_atom[i][3] = forces[2]; + array_atom[i][4] = x[i][0] - dx; + array_atom[i][5] = x[i][1] - dy; + array_atom[i][6] = x[i][2] - dz; + array_atom[i][7] = radius[i]; } } } @@ -583,7 +584,7 @@ void FixWallGran::clear_stored_contacts() { void FixWallGran::post_force_respa(int vflag, int ilevel, int /*iloop*/) { - if (ilevel == nlevels_respa-1) post_force(vflag); + if (ilevel == nlevels_respa - 1) post_force(vflag); } /* ---------------------------------------------------------------------- @@ -594,10 +595,10 @@ double FixWallGran::memory_usage() { int nmax = atom->nmax; double bytes = 0.0; - if (use_history) bytes += (double)nmax*size_history * sizeof(double); // shear history + if (use_history) bytes += (double)nmax * size_history * sizeof(double); // shear history if (fix_rigid) bytes += (double)nmax * sizeof(int); // mass_rigid // store contacts - if (peratom_flag) bytes += (double)nmax*size_peratom_cols*sizeof(double); + if (peratom_flag) bytes += (double)nmax * size_peratom_cols * sizeof(double); return bytes; } diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index d0202d65e8..b61ac24d54 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -55,13 +55,6 @@ class FixWallGran : public Fix { // for granular model choices Contact::ContactModel *model; - // indices of history entries - int normal_history_index; - int damping_history_index; - int tangential_history_index; - int roll_history_index; - int twist_history_index; - double lo, hi, cylradius; double amplitude, period, omega, vshear; double dt; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index c288abf92e..59ad15c02d 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -18,6 +18,7 @@ #include "fix_wall_gran_region.h" #include "atom.h" +#include "contact.h" #include "comm.h" #include "domain.h" #include "error.h" @@ -30,6 +31,7 @@ #include using namespace LAMMPS_NS; +using namespace Contact; using namespace FixConst; using namespace MathExtra; @@ -48,6 +50,8 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : tmax = region->tmax; c2r = new int[tmax]; + model->wall_type = RDUPLICATE; + // re-allocate atom-based arrays with nshear // do not register with Atom class, since parent class did that @@ -120,7 +124,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) { int i, m, nc, iwall; double dx, dy, dz, meff; - double *forces, *torquesi, dq, rwall; + double *forces, *torquesi, dq; double vwall[3]; double w0[3] = {0.0}; bool touchflag = false; @@ -179,7 +183,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) region->set_velocity(); } - if (peratom_flag) { clear_stored_contacts(); } + if (peratom_flag) clear_stored_contacts(); // Define constant wall properties (atom j) model->radj = 0.0; @@ -188,7 +192,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) for (i = 0; i < nlocal; i++) { if (! mask[i] & groupbit) continue; - if (!region->match(x[i][0], x[i][1], x[i][2]))continue; + if (! region->match(x[i][0], x[i][1], x[i][2])) continue; nc = region->surface(x[i][0], x[i][1], x[i][2], model->pulloff_distance(radius[i], 0.0)); if (nc > tmax) error->one(FLERR, "Too many wallgran/region contacts for one particle"); @@ -221,24 +225,25 @@ void FixWallGranRegion::post_force(int /*vflag*/) for (int ic = 0; ic < nc; ic++) { // Reset model and copy initial geometric data + // A bit unncessary since region->contact[ic] stores r model->reset_contact(); - model->xi = x[i]; model->dx[0] = region->contact[ic].delx; model->dx[1] = region->contact[ic].dely; model->dx[2] = region->contact[ic].delz; model->radi = radius[i]; - model->rwall = rwall; + if (model->beyond_contact) model->touch = history_many[i][c2r[ic]][0]; - touchflag = model->check_contact(); + touchflag = model->check_contact(region->contact[ic].r); + if (!touchflag) { + if (use_history) + for (m = 0; m < size_history; m++) + history_many[i][c2r[ic]][m] = 0.0; + continue; + } - if (model->beyond_contact) { - if (history_many[i][c2r[ic]][0] == 0.0 && model->rsq > model->radsum * model->radsum) { - for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; - continue; - } - } // Dan: not quite sure about this - + if (model->beyond_contact) + history_many[i][c2r[ic]][0] = 1; if (regiondynamic) region->velocity_contact(vwall, x[i], ic); model->vj = vwall; @@ -254,7 +259,8 @@ void FixWallGranRegion::post_force(int /*vflag*/) model->vi = v[i]; model->omegai = omega[i]; model->history_update = history_update; - if (use_history) model->history = history_one[i]; + + if (use_history) model->history = history_many[i][c2r[ic]]; if (heat_flag) model->Ti = temperature[i]; model->prep_contact(); diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 9b1a036928..0c228a2936 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -81,9 +81,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) use_history = 0; beyond_contact = 0; nondefault_history_transfer = 0; - tangential_history_index = 0; - roll_history_index = 0; - twist_history_index = 0; heat_flag = 0; // create dummy fix as placeholder for FixNeighHistory @@ -105,6 +102,7 @@ PairGranular::~PairGranular() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); + memory->destroy(cutoff_type); delete [] onerad_dynamic; delete [] onerad_frozen; @@ -119,7 +117,7 @@ PairGranular::~PairGranular() void PairGranular::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype; + int i,j,k,ii,jj,inum,jnum,itype,jtype; double factor_lj,mi,mj,meff,delx,dely,delz; double *forces, *torquesi, *torquesj, dq; @@ -203,6 +201,7 @@ void PairGranular::compute(int eflag, int vflag) models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; models[itype][jtype]->radj = radius[j]; + models[itype][jtype]->touch = touch[jj]; touchflag = models[itype][jtype]->check_contact(); @@ -211,74 +210,77 @@ void PairGranular::compute(int eflag, int vflag) if (use_history) { touch[jj] = 0; history = &allhistory[size_history*jj]; - for (int k = 0; k < size_history; k++) history[k] = 0.0; + for (k = 0; k < size_history; k++) history[k] = 0.0; } - } else { + continue; + } - // meff = effective mass of pair of particles - // if I or J part of rigid body, use body mass - // if I or J is frozen, meff is other particle - mi = rmass[i]; - mj = rmass[j]; - if (fix_rigid) { - if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; - if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; - } - meff = mi * mj / (mi + mj); - if (mask[i] & freeze_group_bit) meff = mj; - if (mask[j] & freeze_group_bit) meff = mi; + if (use_history) { + touch[jj] = 1; + history = &allhistory[size_history*jj]; + } - // Copy additional information and prepare force calculations - models[itype][jtype]->meff = meff; - models[itype][jtype]->vi = v[i]; - models[itype][jtype]->vj = v[j]; - models[itype][jtype]->omegai = omega[i]; - models[itype][jtype]->omegaj = omega[j]; - models[itype][jtype]->history_update = history_update; - if (use_history) models[itype][jtype]->history = history; - if (heat_flag) { - models[itype][jtype]->Ti = temperature[i]; - models[itype][jtype]->Tj = temperature[j]; - } - models[itype][jtype]->prep_contact(); + // meff = effective mass of pair of particles + // if I or J part of rigid body, use body mass + // if I or J is frozen, meff is other particle + mi = rmass[i]; + mj = rmass[j]; + if (fix_rigid) { + if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; + if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; + } + meff = mi * mj / (mi + mj); + if (mask[i] & freeze_group_bit) meff = mj; + if (mask[j] & freeze_group_bit) meff = mi; - if (models[itype][jtype]->beyond_contact) touch[jj] = 1; + // Copy additional information and prepare force calculations + models[itype][jtype]->meff = meff; + models[itype][jtype]->vi = v[i]; + models[itype][jtype]->vj = v[j]; + models[itype][jtype]->omegai = omega[i]; + models[itype][jtype]->omegaj = omega[j]; + models[itype][jtype]->history_update = history_update; + if (use_history) models[itype][jtype]->history = history; + if (heat_flag) { + models[itype][jtype]->Ti = temperature[i]; + models[itype][jtype]->Tj = temperature[j]; + } + models[itype][jtype]->prep_contact(); - // if any history is needed - if (use_history) { - touch[jj] = 1; - history = &allhistory[size_history*jj]; - } + // if any history is needed + if (use_history) { + touch[jj] = 1; + history = &allhistory[size_history*jj]; + } - models[itype][jtype]->calculate_forces(); - if (heat_flag) dq = models[itype][jtype]->calculate_heat(); + models[itype][jtype]->calculate_forces(); + if (heat_flag) dq = models[itype][jtype]->calculate_heat(); - forces = models[itype][jtype]->forces; - torquesi = models[itype][jtype]->torquesi; - torquesj = models[itype][jtype]->torquesj; + forces = models[itype][jtype]->forces; + torquesi = models[itype][jtype]->torquesi; + torquesj = models[itype][jtype]->torquesj; - // apply forces & torques - scale3(factor_lj, forces); - add3(f[i], forces, f[i]); + // apply forces & torques + scale3(factor_lj, forces); + add3(f[i], forces, f[i]); - scale3(factor_lj, torquesi); - add3(torque[i], torquesi, torque[i]); - if (heat_flag) heatflux[i] += dq; + scale3(factor_lj, torquesi); + add3(torque[i], torquesi, torque[i]); + if (heat_flag) heatflux[i] += dq; - if (force->newton_pair || j < nlocal) { - sub3(f[j], forces, f[j]); - scale3(factor_lj, torquesj); - add3(torque[j], torquesj, torque[j]); - if (heat_flag) heatflux[j] -= dq; - } + if (force->newton_pair || j < nlocal) { + sub3(f[j], forces, f[j]); + scale3(factor_lj, torquesj); + add3(torque[j], torquesj, torque[j]); + if (heat_flag) heatflux[j] -= dq; + } - if (evflag) { - delx = x[i][0] - x[j][0]; - dely = x[i][1] - x[j][1]; - delz = x[i][2] - x[j][2]; - ev_tally_xyz(i,j,nlocal,force->newton_pair, - 0.0,0.0,forces[0],forces[1],forces[2],delx,dely,delz); - } + if (evflag) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + ev_tally_xyz(i,j,nlocal,force->newton_pair, + 0.0,0.0,forces[0],forces[1],forces[2],delx,dely,delz); } } } @@ -293,6 +295,9 @@ void PairGranular::allocate() allocated = 1; int n = atom->ntypes; + // Reserve enough memory for vector to avoid reallocation/changing pointers + vec_models.reserve(atom->ntypes * atom->ntypes); + memory->create(setflag,n+1,n+1,"pair:setflag"); for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) @@ -300,7 +305,7 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - memory->create(models,n+1,n+1,"pair:contact_models"); + models.resize(n+1, std::vector (n+1, nullptr)); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -338,64 +343,68 @@ void PairGranular::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - // Create new model stored in vector - vec_models.push_back(ContactModel()); + // Construct new model within vector + vec_models.emplace_back(lmp); //Parse mandatory normal and tangential specifications int iarg = 2; - vec_models.back().init_model(std::string(arg[iarg]), NORMAL); - iarg += 1; + vec_models.back().init_model(std::string(arg[iarg++]), NORMAL); iarg = vec_models.back().normal_model->parse_coeffs(arg, iarg, narg); - if (strcmp(arg[iarg], "tangential") == 0) { - if (iarg + 1 >= narg) + if (strcmp(arg[iarg++], "tangential") == 0) { + if (iarg >= narg) error->all(FLERR,"Illegal pair_coeff command, must specify " "tangential model after tangential keyword"); - vec_models.back().init_model(std::string(arg[iarg]), TANGENTIAL); - iarg += 1; + vec_models.back().init_model(std::string(arg[iarg++]), TANGENTIAL); iarg = vec_models.back().tangential_model->parse_coeffs(arg, iarg, narg); } else{ error->all(FLERR, "Illegal pair_coeff command, 'tangential' keyword expected"); } //Parse optional arguments + while (iarg < narg) { if (strcmp(arg[iarg], "damping") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init_model(std::string(arg[iarg]), DAMPING); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal pair_coeff command, must specify " + "damping model after damping keyword"); + vec_models.back().init_model(std::string(arg[iarg++]), DAMPING); iarg = vec_models.back().damping_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "rolling") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init_model(std::string(arg[iarg]), ROLLING); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal pair_coeff command, must specify " + "rolling model after rolling keyword"); + vec_models.back().init_model(std::string(arg[iarg++]), ROLLING); iarg = vec_models.back().rolling_model->parse_coeffs(arg, iarg, narg); + } else if (strcmp(arg[iarg], "twisting") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init_model(std::string(arg[iarg]), TWISTING); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal pair_coeff command, must specify " + "twisting model after twisting keyword"); + vec_models.back().init_model(std::string(arg[iarg++]), TWISTING); iarg = vec_models.back().twisting_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "heat") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().init_model(std::string(arg[iarg]), HEAT); - iarg += 1; + iarg++; + if (iarg >= narg) + error->all(FLERR, "Illegal pair_coeff command, must specify " + "heat model after heat keyword"); + vec_models.back().init_model(std::string(arg[iarg++]), HEAT); iarg = vec_models.back().heat_model->parse_coeffs(arg, iarg, narg); heat_flag = 1; } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - vec_models.back().cutoff_type = utils::numeric(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "Illegal pair_coeff command, not enough parameters for cutoff keyword"); + cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "limit_damping") == 0) { vec_models.back().limit_damping = 1; iarg += 1; - } else error->all(FLERR, "Illegal pair_coeff command"); + } else error->all(FLERR, "Illegal pair_coeff command {}", arg[iarg]); } // Define default damping model if unspecified, has no coeffs @@ -410,6 +419,7 @@ void PairGranular::coeff(int narg, char **arg) for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { models[i][j] = & vec_models.back(); + cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; setflag[i][j] = 1; count++; } @@ -434,48 +444,30 @@ void PairGranular::init_style() error->all(FLERR,"Pair granular requires ghost atoms store velocity"); // allocate history and initialize models + int size_max[6] = {0,0,0,0,0,0}; - int size_normal_history = 0; - int size_damping_history = 0; - int size_tangential_history = 0; - int size_rolling_history = 0; - int size_twisting_history = 0; - for (int i = 1; i <= atom->ntypes; i++) { - for (int j = i; j <= atom->ntypes; j++) { - if (models[i][j]->size_history != 0) use_history = 1; + for (auto &model : vec_models) { + model.init(); + if (model.size_history != 0) use_history = 1; - if (models[i][j]->normal_model->size_history > size_normal_history) - size_normal_history = models[i][j]->damping_model->size_history; - if (models[i][j]->damping_model->size_history > size_damping_history) - size_damping_history = models[i][j]->normal_model->size_history; - if (models[i][j]->tangential_model->size_history > size_tangential_history) - size_tangential_history = models[i][j]->tangential_model->size_history; - if (models[i][j]->rolling_model) - if (models[i][j]->rolling_model->size_history > size_rolling_history) - size_rolling_history = models[i][j]->rolling_model->size_history; - if (models[i][j]->twisting_model) - if (models[i][j]->twisting_model->size_history > size_twisting_history) - size_twisting_history = models[i][j]->twisting_model->size_history; - } + for (i = 0; i < 6; i++) + if (model.sub_models[i]) + if (model.sub_models[i]->size_history > size_max[i]) + size_max[i] = model.sub_models[i]->size_history; + + if (model.nondefault_history_transfer) nondefault_history_transfer = 1; } - size_history = size_normal_history + size_damping_history + - size_tangential_history + size_rolling_history + size_twisting_history; + size_history = 0; + for (i = 0; i < 6; i++) size_history += size_max[i]; - damping_history_index = size_normal_history; - tangential_history_index = damping_history_index + size_damping_history; - roll_history_index = tangential_history_index + size_tangential_history; - twist_history_index = roll_history_index + size_rolling_history; - - for (int i = 1; i <= atom->ntypes; i++) { - for (int j = i; j <= atom->ntypes; j++) { - models[i][j]->normal_model->history_index = 0; - models[i][j]->damping_model->history_index = damping_history_index; - models[i][j]->tangential_model->history_index = tangential_history_index; - if (models[i][j]->rolling_model) - models[i][j]->rolling_model->history_index = roll_history_index; - if (models[i][j]->twisting_model) - models[i][j]->twisting_model->history_index = twist_history_index; + for (auto &model : vec_models) { + int next_index = 0; + for (i = 0; i < 6; i++) { + if (model.sub_models[i]) { + model.sub_models[i]->history_index = next_index; + next_index += size_max[i]; + } } } @@ -490,9 +482,7 @@ void PairGranular::init_style() if (use_history && fix_history == nullptr) { fix_history = dynamic_cast( modify->replace_fix("NEIGH_HISTORY_GRANULAR_DUMMY", - "NEIGH_HISTORY_GRANULAR" - " all NEIGH_HISTORY " - + std::to_string(size_history),1)); + "NEIGH_HISTORY_GRANULAR all NEIGH_HISTORY " + std::to_string(size_history),1)); fix_history->pair = this; } @@ -583,7 +573,7 @@ double PairGranular::init_one(int i, int j) "pair_coeff command",i,j); } - vec_models.push_back(ContactModel()); + vec_models.push_back(ContactModel(lmp)); models[i][j] = models[j][i] = & vec_models.back(); vec_models.back().init_model(models[i][i]->normal_model->name, NORMAL); vec_models.back().init_model(models[i][i]->tangential_model->name, TANGENTIAL); @@ -593,6 +583,10 @@ double PairGranular::init_one(int i, int j) vec_models.back().init_model(models[i][i]->heat_model->name, HEAT); vec_models.back().mix_coeffs(models[i][i], models[j][j]); + vec_models.back().init(); // Calculates cumulative properties of sub models + + for (int k = 0; k < 6; k++) + vec_models.back().sub_models[k]->history_index = models[i][i]->sub_models[k]->history_index; } // Check if heat model is defined for all type combinations @@ -608,7 +602,7 @@ double PairGranular::init_one(int i, int j) // we assign cutoff = max(cut[i][j]) for i,j such that cut[i][j] > 0.0. double pulloff; - if (models[i][j]->cutoff_type < 0 && cutoff_global < 0) { + if (cutoff_type[i][j] < 0 && cutoff_global < 0) { if (((maxrad_dynamic[i] > 0.0) && (maxrad_dynamic[j] > 0.0)) || ((maxrad_dynamic[i] > 0.0) && (maxrad_frozen[j] > 0.0)) || // radius info about both i and j exist @@ -626,7 +620,6 @@ double PairGranular::init_one(int i, int j) cutoff = MAX(cutoff,maxrad_dynamic[i] + maxrad_frozen[j] + pulloff); } } else { - // radius info about either i or j does not exist // (i.e. not present and not about to get poured; // set to largest value to not interfere with neighbor list) @@ -638,25 +631,15 @@ double PairGranular::init_one(int i, int j) } cutoff = cutmax; } - } else if (models[i][j]->cutoff_type > 0) { - cutoff = models[i][j]->cutoff_type; + } else if (cutoff_type[i][j] > 0) { + cutoff = cutoff_type[i][j]; } else if (cutoff_global > 0) { cutoff = cutoff_global; } // Copy global options - models[i][j]->dt = models[j][i]->dt = dt; - models[i][j]->normal_model->history_index = models[j][i]->normal_model->history_index = normal_history_index; - models[i][j]->tangential_model->history_index = models[j][i]->tangential_model->history_index = tangential_history_index; - models[i][j]->rolling_model->history_index = models[j][i]->rolling_model->history_index = roll_history_index; - models[i][j]->twisting_model->history_index = models[j][i]->twisting_model->history_index = twist_history_index; - - models[i][j]->size_history = models[j][i]->size_history = size_history; - models[i][j]->init(); // Calculates cumulative properties of sub models - models[j][i]->init(); - - if (models[i][j]->nondefault_history_transfer) nondefault_history_transfer = 1; - + models[i][j]->dt = dt; + models[j][i] = models[i][j]; return cutoff; } @@ -671,9 +654,8 @@ void PairGranular::write_restart(FILE *fp) for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { - if (comm->me == 0){ - models[i][j]->write_restart(fp); - } + fwrite(&cutoff_type[i][j],sizeof(double),1,fp); + models[i][j]->write_restart(fp); } } } @@ -693,9 +675,14 @@ void PairGranular::read_restart(FILE *fp) if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - vec_models.push_back(ContactModel()); + if (me == 0) + utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); + MPI_Bcast(&cutoff_type[i][j],1,MPI_DOUBLE,0,world); + + vec_models.push_back(ContactModel(lmp)); models[i][j] = & vec_models.back(); models[i][j]->read_restart(fp); + models[i][j]->init(); } } } diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 68b83d3686..ae85748488 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -73,14 +73,7 @@ class PairGranular : public Pair { // contact models std::vector vec_models; - Contact::ContactModel ***models; - - // indices of history entries - int normal_history_index; - int damping_history_index; - int tangential_history_index; - int roll_history_index; - int twist_history_index; + std::vector > models; // optional user-specified global cutoff, per-type user-specified cutoffs double **cutoff_type; diff --git a/src/contact.h b/src/contact.h index bd04fe9ce1..4c38657ed7 100644 --- a/src/contact.h +++ b/src/contact.h @@ -26,6 +26,12 @@ enum ModelType { ROLLING = 3, TWISTING = 4, HEAT = 5 +}; // Relative order matters since some derive coeffs from others + +enum WallType { + NONE = 0, + RWALL = 1, + RDUPLICATE = 2 }; #define EPSILON 1e-10 @@ -41,10 +47,10 @@ class SubModel; class ContactModel : protected Pointers { public: - ContactModel(); + ContactModel(class LAMMPS *); ~ContactModel(); void init(); - bool check_contact(); + bool check_contact(double = 0); void reset_contact(); void prep_contact(); void calculate_forces(); @@ -68,8 +74,8 @@ class ContactModel : protected Pointers { SubModel *sub_models[6]; // Need to resize if we add more model flavors // Extra options - int beyond_contact, limit_damping, history_update, wall_flag; - double cutoff_type; + int beyond_contact, limit_damping, history_update; + WallType wall_type; // History variables int size_history, nondefault_history_transfer; @@ -77,7 +83,7 @@ class ContactModel : protected Pointers { double *history; // Contact properties/output - double *forces, *torquesi, *torquesj; + double forces[3], torquesi[3], torquesj[3]; double radi, radj, rwall, meff, dt, Ti, Tj, area; double Fntot, magtortwist; From 1cd18d2b371b98d814523f1620eeb545235783e8 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 24 Aug 2022 14:47:10 -0600 Subject: [PATCH 18/57] Replacing # of models with macro, may revise... --- src/GRANULAR/contact.cpp | 2 +- src/GRANULAR/contact.h | 9 +++++---- src/GRANULAR/contact_normal_models.cpp | 16 ++++------------ src/GRANULAR/fix_wall_gran.cpp | 2 +- src/GRANULAR/pair_granular.cpp | 10 +++++----- src/contact.h | 9 +++++---- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index a59eca9374..c181d64f45 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -41,7 +41,7 @@ ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) limit_damping = 0; beyond_contact = 0; nondefault_history_transfer = 0; - nmodels = 6; + nmodels = NMODELS; wall_type = NONE; diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 4c38657ed7..5fbb8a8489 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -19,6 +19,9 @@ namespace LAMMPS_NS { namespace Contact { +#define EPSILON 1e-10 +#define NMODELS 6 + enum ModelType { NORMAL = 0, DAMPING = 1, @@ -34,8 +37,6 @@ enum WallType { RDUPLICATE = 2 }; -#define EPSILON 1e-10 - // forward declaration class NormalModel; class DampingModel; @@ -71,7 +72,7 @@ class ContactModel : protected Pointers { RollingModel *rolling_model; TwistingModel *twisting_model; HeatModel *heat_model; - SubModel *sub_models[6]; // Need to resize if we add more model flavors + SubModel *sub_models[NMODELS]; // Need to resize if we add more model flavors // Extra options int beyond_contact, limit_damping, history_update; @@ -95,11 +96,11 @@ class ContactModel : protected Pointers { double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; double magtwist; bool touch; + int nmodels; protected: int prep_flag, check_flag; - int nmodels; }; } // namespace Contact diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index 6c31cf2c70..d0dc19b14f 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -180,7 +180,7 @@ void NormalHertzMaterial::coeffs_to_local() void NormalHertzMaterial::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) { - coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0],imodel->coeffs[2], jmodel->coeffs[2]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); coeffs_to_local(); @@ -205,11 +205,7 @@ void NormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; -<<<<<<< HEAD - k = FOURTHIRDS * Emod; -======= - k = 4 / 3 * mix_stiffnessE(Emod, Emod, poiss, poiss); ->>>>>>> 12c1923511e802b3b531e34b24fcf386f187dab5 + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); } @@ -218,7 +214,7 @@ void NormalDMT::coeffs_to_local() void NormalDMT::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) { - coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0],imodel->coeffs[2], jmodel->coeffs[2]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); @@ -269,12 +265,8 @@ void NormalJKR::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; -<<<<<<< HEAD k = FOURTHIRDS * Emod; - Escaled = k * THREEQUARTERS; -======= Escaled = mix_stiffnessE(Emod, Emod, poiss, poiss); //Dan, not sure why these coefficients are mixed in the regular pair style ->>>>>>> 12c1923511e802b3b531e34b24fcf386f187dab5 if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); } @@ -283,7 +275,7 @@ void NormalJKR::coeffs_to_local() void NormalJKR::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) { - coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0],imodel->coeffs[2], jmodel->coeffs[2]); coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 208ff10bdd..c1640c6fdf 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -361,7 +361,7 @@ void FixWallGran::init() int next_index = 0; if (model->beyond_contact) next_index = 1; - for (i = 0; i < 6; i++) { + for (i = 0; i < NMODELS; i++) { if (model->sub_models[i]) { model->sub_models[i]->history_index = next_index; next_index += model->sub_models[i]->size_history; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 0c228a2936..b3c587af8b 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -444,13 +444,13 @@ void PairGranular::init_style() error->all(FLERR,"Pair granular requires ghost atoms store velocity"); // allocate history and initialize models - int size_max[6] = {0,0,0,0,0,0}; + int size_max[NMODELS] = {0}; for (auto &model : vec_models) { model.init(); if (model.size_history != 0) use_history = 1; - for (i = 0; i < 6; i++) + for (i = 0; i < NMODELS; i++) if (model.sub_models[i]) if (model.sub_models[i]->size_history > size_max[i]) size_max[i] = model.sub_models[i]->size_history; @@ -459,11 +459,11 @@ void PairGranular::init_style() } size_history = 0; - for (i = 0; i < 6; i++) size_history += size_max[i]; + for (i = 0; i < NMODELS; i++) size_history += size_max[i]; for (auto &model : vec_models) { int next_index = 0; - for (i = 0; i < 6; i++) { + for (i = 0; i < NMODELS; i++) { if (model.sub_models[i]) { model.sub_models[i]->history_index = next_index; next_index += size_max[i]; @@ -585,7 +585,7 @@ double PairGranular::init_one(int i, int j) vec_models.back().mix_coeffs(models[i][i], models[j][j]); vec_models.back().init(); // Calculates cumulative properties of sub models - for (int k = 0; k < 6; k++) + for (int k = 0; k < NMODELS; k++) vec_models.back().sub_models[k]->history_index = models[i][i]->sub_models[k]->history_index; } diff --git a/src/contact.h b/src/contact.h index 4c38657ed7..5fbb8a8489 100644 --- a/src/contact.h +++ b/src/contact.h @@ -19,6 +19,9 @@ namespace LAMMPS_NS { namespace Contact { +#define EPSILON 1e-10 +#define NMODELS 6 + enum ModelType { NORMAL = 0, DAMPING = 1, @@ -34,8 +37,6 @@ enum WallType { RDUPLICATE = 2 }; -#define EPSILON 1e-10 - // forward declaration class NormalModel; class DampingModel; @@ -71,7 +72,7 @@ class ContactModel : protected Pointers { RollingModel *rolling_model; TwistingModel *twisting_model; HeatModel *heat_model; - SubModel *sub_models[6]; // Need to resize if we add more model flavors + SubModel *sub_models[NMODELS]; // Need to resize if we add more model flavors // Extra options int beyond_contact, limit_damping, history_update; @@ -95,11 +96,11 @@ class ContactModel : protected Pointers { double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; double magtwist; bool touch; + int nmodels; protected: int prep_flag, check_flag; - int nmodels; }; } // namespace Contact From 3df0abd081e61d801eaa1997076d6b253c0a2c20 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 9 Sep 2022 14:13:52 -0600 Subject: [PATCH 19/57] Debugging restarts --- src/GRANULAR/contact.cpp | 16 ++++++++-------- src/GRANULAR/pair_granular.cpp | 32 +++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index c181d64f45..a5a6042347 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -225,17 +225,18 @@ void ContactModel::init() // Check if model has nondefault transfers, if so copy its array if (j != nmodels) { - if (sub_models[j]->nondefault_history_transfer) { - transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; - } else { - transfer_history_factor[i] = -1; + transfer_history_factor[i] = -1; + if (sub_models[j]) { + if (sub_models[j]->nondefault_history_transfer) { + transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; + } } } } } for (i = 0; i < nmodels; i++) - if (sub_models[i]) sub_models[i]->init(); + if (sub_models[i]) sub_models[i]->init(); } /* ---------------------------------------------------------------------- */ @@ -263,7 +264,7 @@ void ContactModel::write_restart(FILE *fp) fwrite(&num_char, sizeof(int), 1, fp); fwrite(sub_models[i]->name.data(), sizeof(char), num_char, fp); fwrite(&num_coeffs, sizeof(int), 1, fp); - fwrite(sub_models[i]->coeffs, sizeof(int), num_coeffs, fp); + fwrite(sub_models[i]->coeffs, sizeof(double), num_coeffs, fp); } else { fwrite(&num_char, sizeof(int), 1, fp); } @@ -297,10 +298,9 @@ void ContactModel::read_restart(FILE *fp) MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); if (comm->me == 0) { - utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(int), num_coeff, fp, nullptr, error); + utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(double), num_coeff, fp, nullptr, error); } MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); - sub_models[i]->coeffs_to_local(); } } diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index b3c587af8b..44b81bbc87 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -435,7 +435,6 @@ void PairGranular::coeff(int narg, char **arg) void PairGranular::init_style() { int i; - // error and warning checks if (!atom->radius_flag || !atom->rmass_flag) @@ -649,13 +648,18 @@ double PairGranular::init_one(int i, int j) void PairGranular::write_restart(FILE *fp) { - int i,j; + int i,j,index; + int nmodels = vec_models.size(); + fwrite(&nmodels,sizeof(int),1,fp); + for (auto &model : vec_models) model.write_restart(fp); + for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { fwrite(&cutoff_type[i][j],sizeof(double),1,fp); - models[i][j]->write_restart(fp); + index = models[i][j] - &vec_models[0]; + fwrite(&index,sizeof(int),1,fp); // save index of model } } } @@ -668,21 +672,31 @@ void PairGranular::write_restart(FILE *fp) void PairGranular::read_restart(FILE *fp) { allocate(); - int i,j; + int i,j,index,nmodels; int me = comm->me; + + if (me == 0) utils::sfread(FLERR,&nmodels,sizeof(int),1,fp,nullptr,error); + MPI_Bcast(&nmodels,1,MPI_INT,0,world); + + for (i = 0; i < nmodels; i++) { + vec_models.push_back(ContactModel(lmp)); + vec_models.back().read_restart(fp); + vec_models.back().init(); + } + for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) + if (me == 0) { utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&index,sizeof(int),1,fp,nullptr,error); + } MPI_Bcast(&cutoff_type[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&index,1,MPI_INT,0,world); - vec_models.push_back(ContactModel(lmp)); - models[i][j] = & vec_models.back(); - models[i][j]->read_restart(fp); - models[i][j]->init(); + models[i][j] = & vec_models[index]; } } } From 6a6291827f32dc89f75870f978a661e2843c7b46 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 9 Sep 2022 15:11:24 -0600 Subject: [PATCH 20/57] Simplifying mixing coeffs, other misc clean ups --- src/GRANULAR/contact.cpp | 19 +++++----- src/GRANULAR/contact.h | 5 ++- src/GRANULAR/contact_damping_models.h | 4 +-- src/GRANULAR/contact_heat_models.cpp | 4 +-- src/GRANULAR/contact_heat_models.h | 7 ++-- src/GRANULAR/contact_normal_models.cpp | 40 +++++++++++----------- src/GRANULAR/contact_normal_models.h | 33 +++++++++--------- src/GRANULAR/contact_rolling_models.cpp | 8 ++--- src/GRANULAR/contact_rolling_models.h | 7 ++-- src/GRANULAR/contact_sub_models.h | 7 ++-- src/GRANULAR/contact_tangential_models.cpp | 24 ++++++------- src/GRANULAR/contact_tangential_models.h | 16 ++++----- src/GRANULAR/contact_twisting_models.cpp | 8 ++--- src/GRANULAR/contact_twisting_models.h | 7 ++-- src/GRANULAR/fix_wall_gran.cpp | 2 +- src/GRANULAR/pair_granular.cpp | 10 +++--- src/contact.h | 5 ++- 17 files changed, 104 insertions(+), 102 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index a5a6042347..488e175227 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -41,7 +41,6 @@ ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) limit_damping = 0; beyond_contact = 0; nondefault_history_transfer = 0; - nmodels = NMODELS; wall_type = NONE; @@ -54,7 +53,7 @@ ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) twisting_model = nullptr; heat_model = nullptr; - for (int i = 0; i < nmodels; i++) sub_models[i] = nullptr; + for (int i = 0; i < NSUBMODELS; i++) sub_models[i] = nullptr; transfer_history_factor = nullptr; } @@ -200,7 +199,7 @@ void ContactModel::init() int i, j, size_cumulative; size_history = 0; - for (i = 0; i < nmodels; i++) { + for (i = 0; i < NSUBMODELS; i++) { if (sub_models[i]) { if (sub_models[i]->nondefault_history_transfer) nondefault_history_transfer = 1; @@ -216,7 +215,7 @@ void ContactModel::init() for (i = 0; i < size_history; i++) { // Find which model controls this history value size_cumulative = 0; - for (j = 0; j < nmodels; j++) { + for (j = 0; j < NSUBMODELS; j++) { if (sub_models[j]) { if (size_cumulative + sub_models[j]->size_history > i) break; size_cumulative += sub_models[j]->size_history; @@ -224,7 +223,7 @@ void ContactModel::init() } // Check if model has nondefault transfers, if so copy its array - if (j != nmodels) { + if (j != NSUBMODELS) { transfer_history_factor[i] = -1; if (sub_models[j]) { if (sub_models[j]->nondefault_history_transfer) { @@ -235,7 +234,7 @@ void ContactModel::init() } } - for (i = 0; i < nmodels; i++) + for (i = 0; i < NSUBMODELS; i++) if (sub_models[i]) sub_models[i]->init(); } @@ -243,9 +242,9 @@ void ContactModel::init() void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) { - for (int i = 0; i < nmodels; i++) + for (int i = 0; i < NSUBMODELS; i++) if (sub_models[i]) - sub_models[i]->mix_coeffs(c1->sub_models[i], c2->sub_models[i]); + sub_models[i]->mix_coeffs(c1->sub_models[i]->coeffs, c2->sub_models[i]->coeffs); limit_damping = MAX(c1->limit_damping, c2->limit_damping); } @@ -256,7 +255,7 @@ void ContactModel::write_restart(FILE *fp) { int num_char, num_coeffs; - for (int i = 0; i < nmodels; i++) { + for (int i = 0; i < NSUBMODELS; i++) { num_char = -1; if (sub_models[i]) { num_char = sub_models[i]->name.length(); @@ -277,7 +276,7 @@ void ContactModel::read_restart(FILE *fp) { int num_char, num_coeff; - for (int i = 0; i < nmodels; i++) { + for (int i = 0; i < NSUBMODELS; i++) { if (comm->me == 0) utils::sfread(FLERR, &num_char, sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&num_char, 1, MPI_INT, 0, world); diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 5fbb8a8489..535ec4461e 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { namespace Contact { #define EPSILON 1e-10 -#define NMODELS 6 +#define NSUBMODELS 6 enum ModelType { NORMAL = 0, @@ -72,7 +72,7 @@ class ContactModel : protected Pointers { RollingModel *rolling_model; TwistingModel *twisting_model; HeatModel *heat_model; - SubModel *sub_models[NMODELS]; // Need to resize if we add more model flavors + SubModel *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors // Extra options int beyond_contact, limit_damping, history_update; @@ -96,7 +96,6 @@ class ContactModel : protected Pointers { double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; double magtwist; bool touch; - int nmodels; protected: diff --git a/src/GRANULAR/contact_damping_models.h b/src/GRANULAR/contact_damping_models.h index 70294edc6a..b1e1b795e0 100644 --- a/src/GRANULAR/contact_damping_models.h +++ b/src/GRANULAR/contact_damping_models.h @@ -25,7 +25,7 @@ class DampingModel : public SubModel { DampingModel(class LAMMPS *); ~DampingModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(DampingModel*, DampingModel*) {}; + virtual void mix_coeffs(double*, double*) {}; virtual void init(); virtual double calculate_forces() = 0; double damp; @@ -60,7 +60,7 @@ class DampingViscoelastic : public DampingModel { class DampingTsuji : public DampingModel { public: DampingTsuji(class LAMMPS *); - void init(); + void init() override; double calculate_forces(); }; diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp index d25955b1c2..60f2ef1cbe 100644 --- a/src/GRANULAR/contact_heat_models.cpp +++ b/src/GRANULAR/contact_heat_models.cpp @@ -44,9 +44,9 @@ void HeatArea::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void HeatArea::mix_coeffs(HeatModel* imodel, HeatModel* jmodel) +void HeatArea::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); coeffs_to_local(); } diff --git a/src/GRANULAR/contact_heat_models.h b/src/GRANULAR/contact_heat_models.h index b3104e9f3a..33b7eb2e90 100644 --- a/src/GRANULAR/contact_heat_models.h +++ b/src/GRANULAR/contact_heat_models.h @@ -24,7 +24,8 @@ class HeatModel : public SubModel { HeatModel(class LAMMPS *); ~HeatModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(HeatModel*, HeatModel*) {}; + virtual void mix_coeffs(double*, double*) {}; + virtual void init() {}; virtual double calculate_heat() = 0; }; @@ -33,8 +34,8 @@ class HeatModel : public SubModel { class HeatArea : public HeatModel { public: HeatArea(class LAMMPS *); - void coeffs_to_local(); - void mix_coeffs(HeatModel*, HeatModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; double calculate_heat(); protected: double conductivity; diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index d0dc19b14f..fb3523069c 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -89,10 +89,10 @@ void NormalHooke::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalHooke::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void NormalHooke::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs_to_local(); } @@ -132,10 +132,10 @@ void NormalHertz::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalHertz::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void NormalHertz::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs_to_local(); } @@ -178,11 +178,11 @@ void NormalHertzMaterial::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalHertzMaterial::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void NormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0],imodel->coeffs[2], jmodel->coeffs[2]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs_to_local(); } @@ -212,12 +212,12 @@ void NormalDMT::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalDMT::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void NormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0],imodel->coeffs[2], jmodel->coeffs[2]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); - coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); coeffs_to_local(); } @@ -273,12 +273,12 @@ void NormalJKR::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalJKR::mix_coeffs(NormalModel* imodel, NormalModel* jmodel) +void NormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_stiffnessE(imodel->coeffs[0], jmodel->coeffs[0],imodel->coeffs[2], jmodel->coeffs[2]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); - coeffs[3] = mix_geom(imodel->coeffs[3], jmodel->coeffs[3]); + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); coeffs_to_local(); } diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index ec604d04ba..f683e53308 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -24,7 +24,8 @@ class NormalModel : public SubModel { NormalModel(class LAMMPS *); ~NormalModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(NormalModel*, NormalModel*) {}; + virtual void mix_coeffs(double*, double*) {}; + virtual void init() {}; virtual bool touch(); virtual double pulloff_distance(double, double); virtual double calculate_area(); @@ -43,8 +44,8 @@ class NormalHooke : public NormalModel { public: NormalHooke(class LAMMPS *); ~NormalHooke() {}; - void coeffs_to_local(); - void mix_coeffs(NormalModel*, NormalModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; double calculate_forces(); void set_knfac(); protected: @@ -57,8 +58,8 @@ class NormalHertz : public NormalModel { public: NormalHertz(class LAMMPS *); ~NormalHertz() {}; - void coeffs_to_local(); - void mix_coeffs(NormalModel*, NormalModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; double calculate_forces(); void set_knfac(); protected: @@ -71,8 +72,8 @@ class NormalHertzMaterial : public NormalHertz { public: NormalHertzMaterial(class LAMMPS *); ~NormalHertzMaterial() {}; - void coeffs_to_local(); - void mix_coeffs(NormalModel*, NormalModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; }; /* ---------------------------------------------------------------------- */ @@ -81,11 +82,11 @@ class NormalDMT : public NormalModel { public: NormalDMT(class LAMMPS *); ~NormalDMT() {}; - void coeffs_to_local(); - void mix_coeffs(NormalModel*, NormalModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; double calculate_forces(); void set_knfac(); - void set_fncrit(); + void set_fncrit() override; protected: double k, cohesion; double F_pulloff; @@ -97,14 +98,14 @@ class NormalJKR : public NormalModel { public: NormalJKR(class LAMMPS *); ~NormalJKR() {}; - void coeffs_to_local(); - void mix_coeffs(NormalModel*, NormalModel*); - bool touch(); - double pulloff_distance(double, double); - double calculate_area(); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; + bool touch() override; + double pulloff_distance(double, double) override; + double calculate_area() override; double calculate_forces(); void set_knfac(); - void set_fncrit(); + void set_fncrit() override; protected: double k, cohesion; double Escaled, F_pulloff; diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/GRANULAR/contact_rolling_models.cpp index cc8e3e471e..8f90b4bc04 100644 --- a/src/GRANULAR/contact_rolling_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -53,11 +53,11 @@ void RollingSDS::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void RollingSDS::mix_coeffs(RollingModel* imodel, RollingModel* jmodel) +void RollingSDS::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs_to_local(); } diff --git a/src/GRANULAR/contact_rolling_models.h b/src/GRANULAR/contact_rolling_models.h index e81d22301c..c3ab6810fa 100644 --- a/src/GRANULAR/contact_rolling_models.h +++ b/src/GRANULAR/contact_rolling_models.h @@ -24,7 +24,8 @@ class RollingModel : public SubModel { RollingModel(class LAMMPS *); ~RollingModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(RollingModel*, RollingModel*) {}; + virtual void mix_coeffs(double*, double*) {}; + virtual void init() {}; virtual double calculate_forces() = 0; }; @@ -33,8 +34,8 @@ class RollingModel : public SubModel { class RollingSDS : public RollingModel { public: RollingSDS(class LAMMPS *); - void coeffs_to_local(); - void mix_coeffs(RollingModel*, RollingModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; double calculate_forces(); protected: double k, mu, gamma; diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index 67e9c79e35..7b28bb4c57 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -29,9 +29,10 @@ class SubModel : protected Pointers { double *coeffs; void read_restart(); int parse_coeffs(char **, int, int); - virtual void mix_coeffs(SubModel*, SubModel*) {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; // called after all other submodel coeffs defined + virtual void mix_coeffs(double*, double*) = 0; + virtual void coeffs_to_local() = 0; + virtual void init() = 0; // called after all other submodel coeffs defined + void allocate_coeffs(); std::string name; diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index d518926c38..a4911cd5c2 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -61,10 +61,10 @@ void TangentialLinearNoHistory::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TangentialLinearNoHistory::mix_coeffs(TangentialModel* imodel, TangentialModel* jmodel) +void TangentialLinearNoHistory::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs_to_local(); } @@ -108,11 +108,11 @@ void TangentialLinearHistory::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TangentialLinearHistory::mix_coeffs(TangentialModel* imodel, TangentialModel* jmodel) +void TangentialLinearHistory::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs_to_local(); } @@ -205,12 +205,12 @@ void TangentialMindlin::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TangentialMindlin::mix_coeffs(TangentialModel* imodel, TangentialModel* jmodel) +void TangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) { - if (imodel->coeffs[0] == -1 || imodel->coeffs[0] == -1) coeffs[0] = -1; - else coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + if (icoeffs[0] == -1 || jcoeffs[0] == -1) coeffs[0] = -1; + else coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs_to_local(); } diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index 4e2c85f678..620f3388da 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -24,9 +24,9 @@ class TangentialModel : public SubModel { TangentialModel(class LAMMPS *); virtual ~TangentialModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(TangentialModel*, TangentialModel*) {}; + virtual void mix_coeffs(double*, double*) {}; + virtual void init(); virtual void calculate_forces() = 0; - void init(); int rescale_flag; double k, damp, mu; // Used by Marshall twisting model protected: @@ -38,8 +38,8 @@ class TangentialModel : public SubModel { class TangentialLinearNoHistory : public TangentialModel { public: TangentialLinearNoHistory(class LAMMPS *); - void coeffs_to_local(); - void mix_coeffs(TangentialModel*, TangentialModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; void calculate_forces(); }; @@ -48,8 +48,8 @@ class TangentialLinearNoHistory : public TangentialModel { class TangentialLinearHistory : public TangentialModel { public: TangentialLinearHistory(class LAMMPS *); - void coeffs_to_local(); - void mix_coeffs(TangentialModel*, TangentialModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; void calculate_forces(); }; @@ -58,8 +58,8 @@ class TangentialLinearHistory : public TangentialModel { class TangentialMindlin : public TangentialModel { public: TangentialMindlin(class LAMMPS *); - void coeffs_to_local(); - void mix_coeffs(TangentialModel*, TangentialModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; void calculate_forces(); protected: int mindlin_rescale, mindlin_force; diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 089b4c686e..1fddda559c 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -93,11 +93,11 @@ void TwistingSDS::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TwistingSDS::mix_coeffs(TwistingModel* imodel, TwistingModel* jmodel) +void TwistingSDS::mix_coeffs(double* icoeffs, double* jcoeffs) { - coeffs[0] = mix_geom(imodel->coeffs[0], jmodel->coeffs[0]); - coeffs[1] = mix_geom(imodel->coeffs[1], jmodel->coeffs[1]); - coeffs[2] = mix_geom(imodel->coeffs[2], jmodel->coeffs[2]); + coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs_to_local(); } diff --git a/src/GRANULAR/contact_twisting_models.h b/src/GRANULAR/contact_twisting_models.h index 5bcdc6b2a3..726eb163bf 100644 --- a/src/GRANULAR/contact_twisting_models.h +++ b/src/GRANULAR/contact_twisting_models.h @@ -24,7 +24,8 @@ class TwistingModel : public SubModel { TwistingModel(class LAMMPS *); virtual ~TwistingModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(TwistingModel*, TwistingModel*) {}; + virtual void mix_coeffs(double*, double*) {}; + virtual void init() {}; virtual double calculate_forces() = 0; }; @@ -41,8 +42,8 @@ class TwistingMarshall : public TwistingModel { class TwistingSDS : public TwistingModel { public: TwistingSDS(class LAMMPS *); - void coeffs_to_local(); - void mix_coeffs(TwistingModel*, TwistingModel*); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; double calculate_forces(); protected: double k, mu, damp; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index c1640c6fdf..b0f87890f7 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -361,7 +361,7 @@ void FixWallGran::init() int next_index = 0; if (model->beyond_contact) next_index = 1; - for (i = 0; i < NMODELS; i++) { + for (i = 0; i < NSUBMODELS; i++) { if (model->sub_models[i]) { model->sub_models[i]->history_index = next_index; next_index += model->sub_models[i]->size_history; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 44b81bbc87..c4d7bc1490 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -443,13 +443,13 @@ void PairGranular::init_style() error->all(FLERR,"Pair granular requires ghost atoms store velocity"); // allocate history and initialize models - int size_max[NMODELS] = {0}; + int size_max[NSUBMODELS] = {0}; for (auto &model : vec_models) { model.init(); if (model.size_history != 0) use_history = 1; - for (i = 0; i < NMODELS; i++) + for (i = 0; i < NSUBMODELS; i++) if (model.sub_models[i]) if (model.sub_models[i]->size_history > size_max[i]) size_max[i] = model.sub_models[i]->size_history; @@ -458,11 +458,11 @@ void PairGranular::init_style() } size_history = 0; - for (i = 0; i < NMODELS; i++) size_history += size_max[i]; + for (i = 0; i < NSUBMODELS; i++) size_history += size_max[i]; for (auto &model : vec_models) { int next_index = 0; - for (i = 0; i < NMODELS; i++) { + for (i = 0; i < NSUBMODELS; i++) { if (model.sub_models[i]) { model.sub_models[i]->history_index = next_index; next_index += size_max[i]; @@ -584,7 +584,7 @@ double PairGranular::init_one(int i, int j) vec_models.back().mix_coeffs(models[i][i], models[j][j]); vec_models.back().init(); // Calculates cumulative properties of sub models - for (int k = 0; k < NMODELS; k++) + for (int k = 0; k < NSUBMODELS; k++) vec_models.back().sub_models[k]->history_index = models[i][i]->sub_models[k]->history_index; } diff --git a/src/contact.h b/src/contact.h index 5fbb8a8489..535ec4461e 100644 --- a/src/contact.h +++ b/src/contact.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { namespace Contact { #define EPSILON 1e-10 -#define NMODELS 6 +#define NSUBMODELS 6 enum ModelType { NORMAL = 0, @@ -72,7 +72,7 @@ class ContactModel : protected Pointers { RollingModel *rolling_model; TwistingModel *twisting_model; HeatModel *heat_model; - SubModel *sub_models[NMODELS]; // Need to resize if we add more model flavors + SubModel *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors // Extra options int beyond_contact, limit_damping, history_update; @@ -96,7 +96,6 @@ class ContactModel : protected Pointers { double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; double magtwist; bool touch; - int nmodels; protected: From 06953bd67aafed30f097f37aac7c45ad119d88cb Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 9 Sep 2022 17:12:51 -0600 Subject: [PATCH 21/57] Adding none submodels, further cleaning up mixing, misc edits --- doc/src/fix_temp_integrate.rst | 11 +- doc/src/pair_granular.rst | 28 +++- src/GRANULAR/contact.cpp | 180 +++++++++++---------- src/GRANULAR/contact.h | 7 +- src/GRANULAR/contact_damping_models.cpp | 13 ++ src/GRANULAR/contact_damping_models.h | 9 ++ src/GRANULAR/contact_heat_models.cpp | 21 ++- src/GRANULAR/contact_heat_models.h | 10 +- src/GRANULAR/contact_normal_models.cpp | 31 ++-- src/GRANULAR/contact_normal_models.h | 21 +-- src/GRANULAR/contact_rolling_models.cpp | 19 +-- src/GRANULAR/contact_rolling_models.h | 14 +- src/GRANULAR/contact_sub_models.cpp | 9 ++ src/GRANULAR/contact_sub_models.h | 2 +- src/GRANULAR/contact_tangential_models.cpp | 25 +-- src/GRANULAR/contact_tangential_models.h | 11 +- src/GRANULAR/contact_twisting_models.cpp | 26 ++- src/GRANULAR/contact_twisting_models.h | 16 +- src/GRANULAR/fix_wall_gran.cpp | 8 +- src/GRANULAR/fix_wall_gran_region.cpp | 2 +- src/GRANULAR/pair_granular.cpp | 40 ++--- src/contact.h | 7 +- 22 files changed, 275 insertions(+), 235 deletions(-) diff --git a/doc/src/fix_temp_integrate.rst b/doc/src/fix_temp_integrate.rst index c2f1257075..bd06b45c6e 100644 --- a/doc/src/fix_temp_integrate.rst +++ b/doc/src/fix_temp_integrate.rst @@ -52,11 +52,12 @@ of the specific heat are defined, one for each of the *N* types of atoms. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. 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 `. +No information about this fix is written to :doc:`binary restart files `. +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 `. Restrictions """""""""""" diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index d630b18a3a..675c8fe4ff 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -38,7 +38,7 @@ Examples pair_coeff 2 2 dmt 1000.0 50.0 0.3 10.0 tangential mindlin NULL 0.5 0.1 rolling sds 500.0 200.0 0.1 twisting marshall pair_style granular - pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4 heat 0.1 + pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4 heat area 0.1 Description """"""""""" @@ -634,18 +634,30 @@ attractive force. This keyword cannot be used with the JKR or DMT models. ---------- -The optional *heat* keyword enables heat conduction and it must be followed by -a non-negative numeric value for the conductivity :math:`k_{s}.`` The heat :math:`Q` -conducted across an interface is given by +The optional *heat* keyword enables heat conduction . The options currently +supported are: + +1. *none* +2. *area* : :math:`k_{s}` + +If the *heat* keyword is not specified, the model defaults to *none*. + +For *heat* *area*, the heat +:math:`Q` conducted across an interface is given by .. math:: Q = k_{s} a \Delta T -where :math:`\Delta T` is the difference in the two particles' temperature and :math:`a` -is the area of the contact and depends on the normal force model. Note that the *heat* keyword -must be included in either all or none of of the *pair_coeff* calls. See -:doc:`fix temp/integrate ` for more information on this option. + + +where :math:`\Delta T` is the difference in the two particles' temperature, +:math:`k_{s}` is a non-negative numeric value for the conductivity, and +:math:`a` is the area of the contact and depends on the normal force model. + +Note that the option *none* must either be used in all or none of of the +*pair_coeff* calls. See :doc:`fix temp/integrate ` for +more information on this option. ---------- diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 488e175227..a1a35afe47 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -76,7 +76,9 @@ ContactModel::~ContactModel() void ContactModel::init_model(std::string model_name, ModelType model_type) { if (model_type == NORMAL) { - if (model_name == "hooke") normal_model = new NormalHooke(lmp); + delete normal_model; + if (model_name == "none") normal_model = new NormalNone(lmp); + else if (model_name == "hooke") normal_model = new NormalHooke(lmp); else if (model_name == "hertz") normal_model = new NormalHertz(lmp); else if (model_name == "hertz/material") normal_model = new NormalHertzMaterial(lmp); else if (model_name == "dmt") normal_model = new NormalDMT(lmp); @@ -85,7 +87,9 @@ void ContactModel::init_model(std::string model_name, ModelType model_type) sub_models[model_type] = normal_model; } else if (model_type == TANGENTIAL) { - if (model_name == "linear_nohistory") tangential_model = new TangentialLinearNoHistory(lmp); + delete tangential_model; + if (model_name == "none") tangential_model = new TangentialNone(lmp); + else if (model_name == "linear_nohistory") tangential_model = new TangentialLinearNoHistory(lmp); else if (model_name == "linear_history") tangential_model = new TangentialLinearHistory(lmp); else if (model_name == "mindlin") tangential_model = new TangentialMindlin(lmp); else if (model_name == "mindlin/force") tangential_model = new TangentialMindlinForce(lmp); @@ -95,7 +99,9 @@ void ContactModel::init_model(std::string model_name, ModelType model_type) sub_models[model_type] = tangential_model; } else if (model_type == DAMPING) { - if (model_name == "velocity") damping_model = new DampingVelocity(lmp); + delete damping_model; + if (model_name == "none") damping_model = new DampingNone(lmp); + else if (model_name == "velocity") damping_model = new DampingVelocity(lmp); else if (model_name == "mass_velocity") damping_model = new DampingMassVelocity(lmp); else if (model_name == "viscoelastic") damping_model = new DampingViscoelastic(lmp); else if (model_name == "tsuji") damping_model = new DampingTsuji(lmp); @@ -103,21 +109,33 @@ void ContactModel::init_model(std::string model_name, ModelType model_type) sub_models[model_type] = damping_model; } else if (model_type == ROLLING) { - if (model_name == "none") delete rolling_model; - else if (model_name == "sds") rolling_model = new RollingSDS(lmp); + delete rolling_model; + rolling_defined = 1; + if (model_name == "none") { + rolling_model = new RollingNone(lmp); + rolling_defined = 0; + } else if (model_name == "sds") rolling_model = new RollingSDS(lmp); else error->all(FLERR, "Rolling model name {} not recognized", model_name); sub_models[model_type] = rolling_model; } else if (model_type == TWISTING) { - if (model_name == "none") delete twisting_model; - else if (model_name == "sds") twisting_model = new TwistingSDS(lmp); + delete twisting_model; + twisting_defined = 1; + if (model_name == "none") { + twisting_model = new TwistingNone(lmp); + twisting_defined = 0; + } else if (model_name == "sds") twisting_model = new TwistingSDS(lmp); else if (model_name == "marshall") twisting_model = new TwistingMarshall(lmp); else error->all(FLERR, "Twisting model name {} not recognized", model_name); sub_models[model_type] = twisting_model; } else if (model_type == HEAT) { - if (model_name == "none") delete heat_model; - else if (model_name == "area") heat_model = new HeatArea(lmp); + delete heat_model; + heat_defined = 1; + if (model_name == "none") { + heat_model = new HeatNone(lmp); + heat_defined = 0; + } else if (model_name == "area") heat_model = new HeatArea(lmp); else error->all(FLERR, "Heat model name not {} recognized", model_name); sub_models[model_type] = heat_model; } else { @@ -170,9 +188,9 @@ int ContactModel::init_classic_model(char **arg, int iarg, int narg) init_model("mass_velocity", DAMPING); // ensure additional models are undefined - rolling_model = nullptr; - twisting_model = nullptr; - heat_model = nullptr; + init_model("none", ROLLING); + init_model("none", TWISTING); + init_model("none", HEAT); // manually parse coeffs normal_model->coeffs[0] = kn; @@ -186,67 +204,71 @@ int ContactModel::init_classic_model(char **arg, int iarg, int narg) damping_model->coeffs_to_local(); iarg += 7; - return iarg ; + return iarg; } /* ---------------------------------------------------------------------- */ void ContactModel::init() { - if (!normal_model) error->all(FLERR, "Must specify normal contact model"); - if (!damping_model) error->all(FLERR, "Must specify damping contact model"); - if (!tangential_model) error->all(FLERR, "Must specify tangential contact model"); + int i, j; + for (i = 0; i < NSUBMODELS; i++) + if (!sub_models[i]) init_model("none", (ModelType) i); - int i, j, size_cumulative; + // Must have valid normal, damping, and tangential models + if (normal_model->name == "none") error->all(FLERR, "Must specify normal contact model"); + if (damping_model->name == "none") error->all(FLERR, "Must specify damping contact model"); + if (tangential_model->name == "none") error->all(FLERR, "Must specify tangential contact model"); + + int size_cumulative; size_history = 0; for (i = 0; i < NSUBMODELS; i++) { - if (sub_models[i]) { - if (sub_models[i]->nondefault_history_transfer) - nondefault_history_transfer = 1; - if (sub_models[i]->beyond_contact) - beyond_contact = 1; - size_history += sub_models[i]->size_history; - } + if (sub_models[i]->nondefault_history_transfer) + nondefault_history_transfer = 1; + if (sub_models[i]->beyond_contact) + beyond_contact = 1; + size_history += sub_models[i]->size_history; } if (nondefault_history_transfer) { transfer_history_factor = new double[size_history]; for (i = 0; i < size_history; i++) { - // Find which model controls this history value + // Find which model owns this history value size_cumulative = 0; for (j = 0; j < NSUBMODELS; j++) { - if (sub_models[j]) { - if (size_cumulative + sub_models[j]->size_history > i) break; - size_cumulative += sub_models[j]->size_history; - } + if (size_cumulative + sub_models[j]->size_history > i) break; + size_cumulative += sub_models[j]->size_history; } // Check if model has nondefault transfers, if so copy its array + transfer_history_factor[i] = -1; if (j != NSUBMODELS) { - transfer_history_factor[i] = -1; - if (sub_models[j]) { - if (sub_models[j]->nondefault_history_transfer) { - transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; - } + if (sub_models[j]->nondefault_history_transfer) { + transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; } } } } - for (i = 0; i < NSUBMODELS; i++) - if (sub_models[i]) sub_models[i]->init(); + for (i = 0; i < NSUBMODELS; i++) sub_models[i]->init(); } /* ---------------------------------------------------------------------- */ -void ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) +int ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) { - for (int i = 0; i < NSUBMODELS; i++) - if (sub_models[i]) - sub_models[i]->mix_coeffs(c1->sub_models[i]->coeffs, c2->sub_models[i]->coeffs); + int i; + for (i = 0; i < NSUBMODELS; i++) { + if (c1->sub_models[i]->name != c2->sub_models[i]->name) return i; + + init_model(c1->sub_models[i]->name, (ModelType) i); + sub_models[i]->mix_coeffs(c1->sub_models[i]->coeffs, c2->sub_models[i]->coeffs); + } limit_damping = MAX(c1->limit_damping, c2->limit_damping); + + return -1; } /* ---------------------------------------------------------------------- */ @@ -256,17 +278,12 @@ void ContactModel::write_restart(FILE *fp) int num_char, num_coeffs; for (int i = 0; i < NSUBMODELS; i++) { - num_char = -1; - if (sub_models[i]) { - num_char = sub_models[i]->name.length(); - num_coeffs = sub_models[i]->num_coeffs; - fwrite(&num_char, sizeof(int), 1, fp); - fwrite(sub_models[i]->name.data(), sizeof(char), num_char, fp); - fwrite(&num_coeffs, sizeof(int), 1, fp); - fwrite(sub_models[i]->coeffs, sizeof(double), num_coeffs, fp); - } else { - fwrite(&num_char, sizeof(int), 1, fp); - } + num_char = sub_models[i]->name.length(); + num_coeffs = sub_models[i]->num_coeffs; + fwrite(&num_char, sizeof(int), 1, fp); + fwrite(sub_models[i]->name.data(), sizeof(char), num_char, fp); + fwrite(&num_coeffs, sizeof(int), 1, fp); + fwrite(sub_models[i]->coeffs, sizeof(double), num_coeffs, fp); } } @@ -281,27 +298,25 @@ void ContactModel::read_restart(FILE *fp) utils::sfread(FLERR, &num_char, sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&num_char, 1, MPI_INT, 0, world); - if (num_char != -1) { - std::string model_name (num_char, ' '); - if (comm->me == 0) - utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); - MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); + std::string model_name (num_char, ' '); + if (comm->me == 0) + utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); + MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); - init_model(model_name, (ModelType) i); + init_model(model_name, (ModelType) i); - if (comm->me == 0) { - utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); - if (num_coeff != sub_models[i]->num_coeffs) - error->one(FLERR, "Invalid contact model written to restart file"); - } - MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); - - if (comm->me == 0) { - utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(double), num_coeff, fp, nullptr, error); - } - MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); - sub_models[i]->coeffs_to_local(); + if (comm->me == 0) { + utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); + if (num_coeff != sub_models[i]->num_coeffs) + error->one(FLERR, "Invalid contact model written to restart file"); } + MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); + + if (comm->me == 0) { + utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(double), num_coeff, fp, nullptr, error); + } + MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); + sub_models[i]->coeffs_to_local(); } } @@ -378,10 +393,10 @@ void ContactModel::prep_contact() sub3(vt, temp, vtr); vrel = len3(vtr); - if (rolling_model || twisting_model) + if (rolling_defined || twisting_defined) sub3(omegai, omegaj, relrot); - if (rolling_model) { + if (rolling_defined) { // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) // this is different from the Marshall papers, which use the Bagi/Kuhn formulation // for rolling velocity (see Wang et al for why the latter is wrong) @@ -390,7 +405,7 @@ void ContactModel::prep_contact() vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); } - if (twisting_model) { + if (twisting_defined) { // omega_T (eq 29 of Marshall) magtwist = dot3(relrot, nx); } @@ -424,8 +439,8 @@ void ContactModel::calculate_forces() if (limit_damping && Fntot < 0.0) Fntot = 0.0; tangential_model->calculate_forces(); - if (rolling_model) rolling_model->calculate_forces(); - if (twisting_model) twisting_model->calculate_forces(); + if (rolling_defined) rolling_model->calculate_forces(); + if (twisting_defined) twisting_model->calculate_forces(); //********************************************** // sum contributions @@ -438,13 +453,13 @@ void ContactModel::calculate_forces() cross3(nx, fs, torquesi); copy3(torquesi, torquesj); - double dist_to_contact = radi-0.5*delta; + double dist_to_contact = radi - 0.5 * delta; scale3(dist_to_contact, torquesi); - dist_to_contact = radj-0.5*delta; + dist_to_contact = radj - 0.5 * delta; scale3(dist_to_contact, torquesj); double torroll[3]; - if (rolling_model) { + if (rolling_defined) { cross3(nx, fr, torroll); scale3(Reff, torroll); add3(torquesi, torroll, torquesi); @@ -452,18 +467,15 @@ void ContactModel::calculate_forces() } double tortwist[3]; - if (twisting_model) { + if (twisting_defined) { scale3(magtortwist, nx, tortwist); add3(torquesi, tortwist, torquesi); sub3(torquesj, tortwist, torquesj); } -} -/* ---------------------------------------------------------------------- */ - -double ContactModel::calculate_heat() -{ - return heat_model->calculate_heat(); + if (heat_defined) { + dq = heat_model->calculate_heat(); + } } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 535ec4461e..e0600146c3 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -55,12 +55,11 @@ class ContactModel : protected Pointers { void reset_contact(); void prep_contact(); void calculate_forces(); - double calculate_heat(); double pulloff_distance(double, double); void init_model(std::string, ModelType); int init_classic_model(char **, int, int); - void mix_coeffs(ContactModel*, ContactModel*); + int mix_coeffs(ContactModel*, ContactModel*); void write_restart(FILE *); void read_restart(FILE *); @@ -84,7 +83,7 @@ class ContactModel : protected Pointers { double *history; // Contact properties/output - double forces[3], torquesi[3], torquesj[3]; + double forces[3], torquesi[3], torquesj[3], dq; double radi, radj, rwall, meff, dt, Ti, Tj, area; double Fntot, magtortwist; @@ -98,7 +97,7 @@ class ContactModel : protected Pointers { bool touch; protected: - + int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels int prep_flag, check_flag; }; diff --git a/src/GRANULAR/contact_damping_models.cpp b/src/GRANULAR/contact_damping_models.cpp index 8d44746683..a003d181d9 100644 --- a/src/GRANULAR/contact_damping_models.cpp +++ b/src/GRANULAR/contact_damping_models.cpp @@ -33,6 +33,19 @@ void DampingModel::init() damp = contact->normal_model->damp; } +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +DampingNone::DampingNone(LAMMPS *lmp) : DampingModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + +double DampingNone::calculate_forces() +{ + return 0.0; +} + /* ---------------------------------------------------------------------- Velocity damping ------------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_damping_models.h b/src/GRANULAR/contact_damping_models.h index b1e1b795e0..611393da9f 100644 --- a/src/GRANULAR/contact_damping_models.h +++ b/src/GRANULAR/contact_damping_models.h @@ -33,6 +33,15 @@ class DampingModel : public SubModel { /* ---------------------------------------------------------------------- */ +class DampingNone : public DampingModel { + public: + DampingNone(class LAMMPS *); + void init() override {}; + double calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + class DampingVelocity : public DampingModel { public: DampingVelocity(class LAMMPS *); diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp index 60f2ef1cbe..00ac0c0785 100644 --- a/src/GRANULAR/contact_heat_models.cpp +++ b/src/GRANULAR/contact_heat_models.cpp @@ -28,6 +28,19 @@ HeatModel::HeatModel(LAMMPS *lmp) : SubModel(lmp) {} Area-based heat conduction ------------------------------------------------------------------------- */ +HeatNone::HeatNone(LAMMPS *lmp) : HeatModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + +double HeatNone::calculate_heat() +{ + return 0.0; +} + +/* ---------------------------------------------------------------------- + Area-based heat conduction +------------------------------------------------------------------------- */ + HeatArea::HeatArea(LAMMPS *lmp) : HeatModel(lmp) { num_coeffs = 1; @@ -44,14 +57,6 @@ void HeatArea::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void HeatArea::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - double HeatArea::calculate_heat() { return conductivity * contact->area * (contact->Ti - contact->Tj); diff --git a/src/GRANULAR/contact_heat_models.h b/src/GRANULAR/contact_heat_models.h index 33b7eb2e90..5a0d495810 100644 --- a/src/GRANULAR/contact_heat_models.h +++ b/src/GRANULAR/contact_heat_models.h @@ -24,18 +24,24 @@ class HeatModel : public SubModel { HeatModel(class LAMMPS *); ~HeatModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; virtual void init() {}; virtual double calculate_heat() = 0; }; /* ---------------------------------------------------------------------- */ +class HeatNone : public HeatModel { + public: + HeatNone(class LAMMPS *); + double calculate_heat(); +}; + +/* ---------------------------------------------------------------------- */ + class HeatArea : public HeatModel { public: HeatArea(class LAMMPS *); void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; double calculate_heat(); protected: double conductivity; diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index fb3523069c..2f59311edf 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -68,6 +68,19 @@ void NormalModel::set_fncrit() Fncrit = fabs(contact->Fntot); } +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +NormalNone::NormalNone(LAMMPS *lmp) : NormalModel(lmp) {} + +/* ---------------------------------------------------------------------- */ + +double NormalNone::calculate_forces() +{ + return 0.0; +} + /* ---------------------------------------------------------------------- Hookean normal force ------------------------------------------------------------------------- */ @@ -89,15 +102,6 @@ void NormalHooke::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalHooke::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - double NormalHooke::calculate_forces() { Fne = knfac * contact->delta; @@ -132,15 +136,6 @@ void NormalHertz::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void NormalHertz::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - double NormalHertz::calculate_forces() { Fne = knfac * contact->delta; diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index f683e53308..6d47dd3736 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -24,7 +24,6 @@ class NormalModel : public SubModel { NormalModel(class LAMMPS *); ~NormalModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; virtual void init() {}; virtual bool touch(); virtual double pulloff_distance(double, double); @@ -40,12 +39,19 @@ class NormalModel : public SubModel { /* ---------------------------------------------------------------------- */ +class NormalNone : public NormalModel { + public: + NormalNone(class LAMMPS *); + double calculate_forces(); + void set_knfac() {}; +}; + +/* ---------------------------------------------------------------------- */ + class NormalHooke : public NormalModel { public: NormalHooke(class LAMMPS *); - ~NormalHooke() {}; void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; double calculate_forces(); void set_knfac(); protected: @@ -57,9 +63,7 @@ class NormalHooke : public NormalModel { class NormalHertz : public NormalModel { public: NormalHertz(class LAMMPS *); - ~NormalHertz() {}; void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; double calculate_forces(); void set_knfac(); protected: @@ -71,7 +75,6 @@ class NormalHertz : public NormalModel { class NormalHertzMaterial : public NormalHertz { public: NormalHertzMaterial(class LAMMPS *); - ~NormalHertzMaterial() {}; void coeffs_to_local() override; void mix_coeffs(double*, double*) override; }; @@ -81,7 +84,6 @@ class NormalHertzMaterial : public NormalHertz { class NormalDMT : public NormalModel { public: NormalDMT(class LAMMPS *); - ~NormalDMT() {}; void coeffs_to_local() override; void mix_coeffs(double*, double*) override; double calculate_forces(); @@ -97,14 +99,13 @@ class NormalDMT : public NormalModel { class NormalJKR : public NormalModel { public: NormalJKR(class LAMMPS *); - ~NormalJKR() {}; void coeffs_to_local() override; void mix_coeffs(double*, double*) override; bool touch() override; double pulloff_distance(double, double) override; double calculate_area() override; - double calculate_forces(); - void set_knfac(); + double calculate_forces() override; + void set_knfac() override; void set_fncrit() override; protected: double k, cohesion; diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/GRANULAR/contact_rolling_models.cpp index 8f90b4bc04..956be65353 100644 --- a/src/GRANULAR/contact_rolling_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -29,6 +29,12 @@ using namespace MathExtra; RollingModel::RollingModel(LAMMPS *lmp) : SubModel(lmp) {} +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +RollingNone::RollingNone(LAMMPS *lmp) : RollingModel(lmp) {} + /* ---------------------------------------------------------------------- SDS rolling friction model ------------------------------------------------------------------------- */ @@ -53,17 +59,7 @@ void RollingSDS::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void RollingSDS::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - -double RollingSDS::calculate_forces() +void RollingSDS::calculate_forces() { int rhist0, rhist1, rhist2, frameupdate; double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; @@ -125,5 +121,4 @@ double RollingSDS::calculate_forces() contact->history[rhist0] = hist_temp[0]; contact->history[rhist1] = hist_temp[1]; contact->history[rhist2] = hist_temp[2]; - return 0; } diff --git a/src/GRANULAR/contact_rolling_models.h b/src/GRANULAR/contact_rolling_models.h index c3ab6810fa..f5af08c1b0 100644 --- a/src/GRANULAR/contact_rolling_models.h +++ b/src/GRANULAR/contact_rolling_models.h @@ -24,9 +24,16 @@ class RollingModel : public SubModel { RollingModel(class LAMMPS *); ~RollingModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; virtual void init() {}; - virtual double calculate_forces() = 0; + virtual void calculate_forces() = 0; +}; + +/* ---------------------------------------------------------------------- */ + +class RollingNone : public RollingModel { + public: + RollingNone(class LAMMPS *); + void calculate_forces() {}; }; /* ---------------------------------------------------------------------- */ @@ -35,8 +42,7 @@ class RollingSDS : public RollingModel { public: RollingSDS(class LAMMPS *); void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; - double calculate_forces(); + void calculate_forces(); protected: double k, mu, gamma; }; diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index 8aafc0f2b5..6ec7bbd017 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -73,6 +73,15 @@ int SubModel::parse_coeffs(char **arg, int iarg, int narg) return iarg + num_coeffs; } +/* ---------------------------------------------------------------------- */ + +void SubModel::mix_coeffs(double* icoeffs, double* jcoeffs) +{ + for (int i = 0; i < num_coeffs; i++) + coeffs[i] = mix_geom(icoeffs[i], jcoeffs[i]); + coeffs_to_local(); +} + /* ---------------------------------------------------------------------- mixing of Young's modulus (E) ------------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index 7b28bb4c57..730790616d 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -29,7 +29,7 @@ class SubModel : protected Pointers { double *coeffs; void read_restart(); int parse_coeffs(char **, int, int); - virtual void mix_coeffs(double*, double*) = 0; + virtual void mix_coeffs(double*, double*); virtual void coeffs_to_local() = 0; virtual void init() = 0; // called after all other submodel coeffs defined diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index a4911cd5c2..437615441c 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -37,6 +37,12 @@ void TangentialModel::init() damp = xt * contact->damping_model->damp; } +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +TangentialNone::TangentialNone(LAMMPS *lmp) : TangentialModel(lmp) {} + /* ---------------------------------------------------------------------- Linear model with no history ------------------------------------------------------------------------- */ @@ -61,15 +67,6 @@ void TangentialLinearNoHistory::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TangentialLinearNoHistory::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - void TangentialLinearNoHistory::calculate_forces() { double Fscrit, fsmag, Ft; @@ -108,16 +105,6 @@ void TangentialLinearHistory::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TangentialLinearHistory::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - void TangentialLinearHistory::calculate_forces() { double Fscrit, magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index 620f3388da..812eb62e55 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -24,7 +24,6 @@ class TangentialModel : public SubModel { TangentialModel(class LAMMPS *); virtual ~TangentialModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; virtual void init(); virtual void calculate_forces() = 0; int rescale_flag; @@ -35,11 +34,18 @@ class TangentialModel : public SubModel { /* ---------------------------------------------------------------------- */ +class TangentialNone : public TangentialModel { + public: + TangentialNone(class LAMMPS *); + void calculate_forces() {}; +}; + +/* ---------------------------------------------------------------------- */ + class TangentialLinearNoHistory : public TangentialModel { public: TangentialLinearNoHistory(class LAMMPS *); void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; void calculate_forces(); }; @@ -49,7 +55,6 @@ class TangentialLinearHistory : public TangentialModel { public: TangentialLinearHistory(class LAMMPS *); void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; void calculate_forces(); }; diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 1fddda559c..8f3c5e571e 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -26,11 +26,13 @@ using namespace MathConst; Default twisting model ------------------------------------------------------------------------- */ -TwistingModel::TwistingModel(LAMMPS *lmp) : SubModel(lmp) -{ - num_coeffs = 0; - size_history = 3; -} +TwistingModel::TwistingModel(LAMMPS *lmp) : SubModel(lmp) {} + +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +TwistingNone::TwistingNone(LAMMPS *lmp) : TwistingModel(lmp) {} /* ---------------------------------------------------------------------- Marshall twisting model @@ -44,7 +46,7 @@ TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) /* ---------------------------------------------------------------------- */ -double TwistingMarshall::calculate_forces() +void TwistingMarshall::calculate_forces() { double signtwist, Mtcrit; @@ -93,17 +95,7 @@ void TwistingSDS::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void TwistingSDS::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - -double TwistingSDS::calculate_forces() +void TwistingSDS::calculate_forces() { double signtwist, Mtcrit; diff --git a/src/GRANULAR/contact_twisting_models.h b/src/GRANULAR/contact_twisting_models.h index 726eb163bf..15124ca378 100644 --- a/src/GRANULAR/contact_twisting_models.h +++ b/src/GRANULAR/contact_twisting_models.h @@ -24,9 +24,16 @@ class TwistingModel : public SubModel { TwistingModel(class LAMMPS *); virtual ~TwistingModel() {}; virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; virtual void init() {}; - virtual double calculate_forces() = 0; + virtual void calculate_forces() = 0; +}; + +/* ---------------------------------------------------------------------- */ + +class TwistingNone : public TwistingModel { + public: + TwistingNone(class LAMMPS *); + void calculate_forces() {}; }; /* ---------------------------------------------------------------------- */ @@ -34,7 +41,7 @@ class TwistingModel : public SubModel { class TwistingMarshall : public TwistingModel { public: TwistingMarshall(class LAMMPS *); - double calculate_forces(); + void calculate_forces(); }; /* ---------------------------------------------------------------------- */ @@ -43,8 +50,7 @@ class TwistingSDS : public TwistingModel { public: TwistingSDS(class LAMMPS *); void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; - double calculate_forces(); + void calculate_forces(); protected: double k, mu, damp; }; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index b0f87890f7..95cd4fc6e0 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -362,10 +362,8 @@ void FixWallGran::init() if (model->beyond_contact) next_index = 1; for (i = 0; i < NSUBMODELS; i++) { - if (model->sub_models[i]) { - model->sub_models[i]->history_index = next_index; - next_index += model->sub_models[i]->size_history; - } + model->sub_models[i]->history_index = next_index; + next_index += model->sub_models[i]->size_history; } } @@ -546,10 +544,10 @@ void FixWallGran::post_force(int /*vflag*/) model->prep_contact(); model->calculate_forces(); - if (heat_flag) dq = model->calculate_heat(); forces = model->forces; torquesi = model->torquesi; + if (heat_flag) dq = model->dq; // apply forces & torques add3(f[i], forces, f[i]); diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 59ad15c02d..7a774132f0 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -265,10 +265,10 @@ void FixWallGranRegion::post_force(int /*vflag*/) model->prep_contact(); model->calculate_forces(); - if (heat_flag) dq = model->calculate_heat(); forces = model->forces; torquesi = model->torquesi; + if (heat_flag) dq = model->dq; // apply forces & torques add3(f[i], forces, f[i]); diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index c4d7bc1490..52e4a84ded 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -254,11 +254,11 @@ void PairGranular::compute(int eflag, int vflag) } models[itype][jtype]->calculate_forces(); - if (heat_flag) dq = models[itype][jtype]->calculate_heat(); forces = models[itype][jtype]->forces; torquesi = models[itype][jtype]->torquesi; torquesj = models[itype][jtype]->torquesj; + if (heat_flag) dq = models[itype][jtype]->dq; // apply forces & torques scale3(factor_lj, forces); @@ -450,9 +450,8 @@ void PairGranular::init_style() if (model.size_history != 0) use_history = 1; for (i = 0; i < NSUBMODELS; i++) - if (model.sub_models[i]) - if (model.sub_models[i]->size_history > size_max[i]) - size_max[i] = model.sub_models[i]->size_history; + if (model.sub_models[i]->size_history > size_max[i]) + size_max[i] = model.sub_models[i]->size_history; if (model.nondefault_history_transfer) nondefault_history_transfer = 1; } @@ -463,10 +462,8 @@ void PairGranular::init_style() for (auto &model : vec_models) { int next_index = 0; for (i = 0; i < NSUBMODELS; i++) { - if (model.sub_models[i]) { - model.sub_models[i]->history_index = next_index; - next_index += size_max[i]; - } + model.sub_models[i]->history_index = next_index; + next_index += size_max[i]; } } @@ -561,27 +558,20 @@ double PairGranular::init_one(int i, int j) double cutoff = 0.0; if (setflag[i][j] == 0) { - if ((models[i][i]->normal_model->name != models[j][j]->normal_model->name) || - (models[i][i]->damping_model->name != models[j][j]->damping_model->name) || - (models[i][i]->tangential_model->name != models[j][j]->tangential_model->name) || - (models[i][i]->rolling_model->name != models[j][j]->rolling_model->name) || - (models[i][i]->twisting_model->name != models[j][j]->twisting_model->name)) { - error->all(FLERR,"Granular pair style functional forms are different, " - "cannot mix coefficients for types {} and {}. \n" - "This combination must be set explicitly via a " - "pair_coeff command",i,j); - } vec_models.push_back(ContactModel(lmp)); models[i][j] = models[j][i] = & vec_models.back(); - vec_models.back().init_model(models[i][i]->normal_model->name, NORMAL); - vec_models.back().init_model(models[i][i]->tangential_model->name, TANGENTIAL); - vec_models.back().init_model(models[i][i]->damping_model->name, DAMPING); - vec_models.back().init_model(models[i][i]->rolling_model->name, ROLLING); - vec_models.back().init_model(models[i][i]->twisting_model->name, TWISTING); - vec_models.back().init_model(models[i][i]->heat_model->name, HEAT); - vec_models.back().mix_coeffs(models[i][i], models[j][j]); + int error_code = vec_models.back().mix_coeffs(models[i][i], models[j][j]); + if (error_code != -1) + error->all(FLERR,"Granular pair style functional forms are different, " + "cannot mix coefficients for types {} and {} \n" + "with submodels {} and {}. \n" + "This combination must be set explicitly via a " + "pair_coeff command",i,j, + models[i][i]->sub_models[error_code]->name, + models[j][j]->sub_models[error_code]->name); + vec_models.back().init(); // Calculates cumulative properties of sub models for (int k = 0; k < NSUBMODELS; k++) diff --git a/src/contact.h b/src/contact.h index 535ec4461e..cd680b220a 100644 --- a/src/contact.h +++ b/src/contact.h @@ -55,12 +55,11 @@ class ContactModel : protected Pointers { void reset_contact(); void prep_contact(); void calculate_forces(); - double calculate_heat(); double pulloff_distance(double, double); void init_model(std::string, ModelType); int init_classic_model(char **, int, int); - void mix_coeffs(ContactModel*, ContactModel*); + int mix_coeffs(ContactModel*, ContactModel*); void write_restart(FILE *); void read_restart(FILE *); @@ -84,7 +83,7 @@ class ContactModel : protected Pointers { double *history; // Contact properties/output - double forces[3], torquesi[3], torquesj[3]; + double forces[3], torquesi[3], torquesj[3], dq; double radi, radj, rwall, meff, dt, Ti, Tj, area; double Fntot, magtortwist; @@ -98,7 +97,7 @@ class ContactModel : protected Pointers { bool touch; protected: - + int rolling_defined, twisting_defined, heat_defined; int prep_flag, check_flag; }; From 038f4a52105aa93bbd835310d65be697812109f8 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 14 Sep 2022 21:40:00 -0600 Subject: [PATCH 22/57] Adding variable temperature to fix gran/wall, misc fixes/updates --- src/GRANULAR/contact.cpp | 62 ++++++++-------------- src/GRANULAR/contact.h | 12 ++--- src/GRANULAR/contact_normal_models.cpp | 2 +- src/GRANULAR/contact_sub_models.cpp | 12 +++-- src/GRANULAR/contact_tangential_models.cpp | 2 +- src/GRANULAR/contact_twisting_models.cpp | 16 ++++-- src/GRANULAR/contact_twisting_models.h | 3 ++ src/GRANULAR/fix_wall_gran.cpp | 29 +++++++--- src/GRANULAR/fix_wall_gran.h | 3 ++ src/GRANULAR/fix_wall_gran_region.cpp | 5 +- src/GRANULAR/pair_granular.cpp | 33 ++++++------ 11 files changed, 98 insertions(+), 81 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index a1a35afe47..f72245def3 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -10,12 +10,16 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- +------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- This class contains a series of tools for DEM contacts Multiple models can be defined and used to calculate forces and torques based on contact geometry -*/ + + Contributing authors: + Dan Bolintineanu (SNL), Joel Clemmer (SNL) +----------------------------------------------------------------------- */ #include "contact.h" #include "contact_sub_models.h" @@ -42,7 +46,7 @@ ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) beyond_contact = 0; nondefault_history_transfer = 0; - wall_type = NONE; + contact_type = PAIR; reset_contact(); @@ -175,17 +179,19 @@ int ContactModel::init_classic_model(char **arg, int iarg, int narg) if (strcmp(arg[iarg],"hooke") == 0) { init_model("hooke", NORMAL); init_model("linear_nohistory", TANGENTIAL); + init_model("mass_velocity", DAMPING); } else if (strcmp(arg[iarg],"hooke/history") == 0) { init_model("hooke", NORMAL); init_model("linear_history", TANGENTIAL); + init_model("mass_velocity", DAMPING); } else if (strcmp(arg[iarg],"hertz/history") == 0) { // convert Kn and Kt from pressure units to force/distance^2 if Hertzian kn /= force->nktv2p; kt /= force->nktv2p; init_model("hertz", NORMAL); - init_model("mindlin", TANGENTIAL); // Dan is this right? + init_model("mindlin", TANGENTIAL); + init_model("viscoelastic", DAMPING); } else error->all(FLERR,"Invalid classic gran model"); - init_model("mass_velocity", DAMPING); // ensure additional models are undefined init_model("none", ROLLING); @@ -322,25 +328,15 @@ void ContactModel::read_restart(FILE *fp) /* ---------------------------------------------------------------------- */ -void ContactModel::reset_contact() -{ - prep_flag = check_flag = 0; - touch = false; -} - -/* ---------------------------------------------------------------------- */ - bool ContactModel::check_contact(double rtemp) { - check_flag = 1; - - if (wall_type == RWALL) { + if (contact_type == WALL) { // Used by fix_wall_gran.cpp rsq = lensq3(dx); radsum = radi; if (rtemp == 0) Reff = radi; else Reff = radi * rtemp/(radi + rtemp); - } else if (wall_type == RDUPLICATE) { + } else if (contact_type == WALLREGION) { // Used by fix_wall_gran_region.cpp rsq = rtemp * rtemp; radsum = radi + radi; @@ -361,11 +357,6 @@ bool ContactModel::check_contact(double rtemp) void ContactModel::prep_contact() { - prep_flag = 1; - // If it hasn't already been done, test if the contact exists - if (check_flag != 1) touch = check_contact(); - if (!touch) return; - double temp[3]; // Standard geometric quantities @@ -415,16 +406,8 @@ void ContactModel::prep_contact() void ContactModel::calculate_forces() { - // If it hasn't already been done, run prep calculations - if (prep_flag != 1) prep_contact(); - if (!touch) { - forces[0] = forces[1] = forces[2] = 0.0; - return; - } + // calculate forces/torques - //********************************************** - // calculate forces - //********************************************** forces[0] = 0.0; double Fne, Fdamp; area = normal_model->calculate_area(); @@ -442,35 +425,36 @@ void ContactModel::calculate_forces() if (rolling_defined) rolling_model->calculate_forces(); if (twisting_defined) twisting_model->calculate_forces(); - //********************************************** // sum contributions - //********************************************** scale3(Fntot, nx, forces); add3(forces, fs, forces); - //May need to rethink this for use with walls (and eventually tris).. + //May need to rethink eventually tris.. cross3(nx, fs, torquesi); - copy3(torquesi, torquesj); double dist_to_contact = radi - 0.5 * delta; scale3(dist_to_contact, torquesi); - dist_to_contact = radj - 0.5 * delta; - scale3(dist_to_contact, torquesj); + + if (contact_type == PAIR) { + copy3(torquesi, torquesj); + dist_to_contact = radj - 0.5 * delta; + scale3(dist_to_contact, torquesj); + } double torroll[3]; if (rolling_defined) { cross3(nx, fr, torroll); scale3(Reff, torroll); add3(torquesi, torroll, torquesi); - sub3(torquesj, torroll, torquesj); + if (contact_type == PAIR) sub3(torquesj, torroll, torquesj); } double tortwist[3]; if (twisting_defined) { scale3(magtortwist, nx, tortwist); add3(torquesi, tortwist, torquesi); - sub3(torquesj, tortwist, torquesj); + if (contact_type == PAIR) sub3(torquesj, tortwist, torquesj); } if (heat_defined) { diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index e0600146c3..4dc88132c0 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -31,10 +31,10 @@ enum ModelType { HEAT = 5 }; // Relative order matters since some derive coeffs from others -enum WallType { - NONE = 0, - RWALL = 1, - RDUPLICATE = 2 +enum ContactType { + PAIR = 0, + WALL = 1, + WALLREGION = 2 }; // forward declaration @@ -52,7 +52,6 @@ class ContactModel : protected Pointers { ~ContactModel(); void init(); bool check_contact(double = 0); - void reset_contact(); void prep_contact(); void calculate_forces(); double pulloff_distance(double, double); @@ -75,7 +74,7 @@ class ContactModel : protected Pointers { // Extra options int beyond_contact, limit_damping, history_update; - WallType wall_type; + ContactType contact_type; // History variables int size_history, nondefault_history_transfer; @@ -98,7 +97,6 @@ class ContactModel : protected Pointers { protected: int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels - int prep_flag, check_flag; }; } // namespace Contact diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index 2f59311edf..9e0a377eb9 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -261,7 +261,7 @@ void NormalJKR::coeffs_to_local() poiss = coeffs[2]; cohesion = coeffs[3]; k = FOURTHIRDS * Emod; - Escaled = mix_stiffnessE(Emod, Emod, poiss, poiss); //Dan, not sure why these coefficients are mixed in the regular pair style + Escaled = mix_stiffnessE(Emod, Emod, poiss, poiss); if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); } diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index 6ec7bbd017..57834fc040 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -10,12 +10,16 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- +-------------------------------------------------------------------------*/ - This class contains a series of tools for DEM contacts - Multiple models can be defined and used to calculate forces +/* ---------------------------------------------------------------------- + This class contains a framework for normal, damping, tangential, + rolling, twisting, and heat models used to calculate forces and torques based on contact geometry -*/ + + Contributing authors: + Dan Bolintineanu (SNL), Joel Clemmer (SNL) +----------------------------------------------------------------------- */ #include "contact_sub_models.h" #include "error.h" diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 437615441c..46b370d15f 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -259,7 +259,7 @@ void TangentialMindlin::calculate_forces() temp_dbl = -damp; scale3(temp_dbl, contact->vtr, contact->fs); - if (! mindlin_force) { + if (!mindlin_force) { scale3(k_scaled, history, temp_array); add3(contact->fs, temp_array, contact->fs); } diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 8f3c5e571e..52b37d46e1 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -46,15 +46,25 @@ TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) /* ---------------------------------------------------------------------- */ + +void TwistingMarshall::init() +{ + k_tang = contact->tangential_model->k; + damp_tang = contact->tangential_model->damp; + mu_tang = contact->tangential_model->mu; +} + +/* ---------------------------------------------------------------------- */ + void TwistingMarshall::calculate_forces() { double signtwist, Mtcrit; // Calculate twist coefficients from tangential model & contact geometry // eq 32 of Marshall paper - double k = 0.5 * contact->tangential_model->k * contact->area * contact->area; - double damp = 0.5 * contact->tangential_model->damp * contact->area * contact->area; - double mu = TWOTHIRDS * contact->area * contact->tangential_model->mu; + double k = 0.5 * k_tang * contact->area * contact->area; + double damp = 0.5 * damp_tang * contact->area * contact->area; + double mu = TWOTHIRDS * mu_tang * contact->area; if (contact->history_update) { contact->history[history_index] += contact->magtwist * contact->dt; diff --git a/src/GRANULAR/contact_twisting_models.h b/src/GRANULAR/contact_twisting_models.h index 15124ca378..724448892a 100644 --- a/src/GRANULAR/contact_twisting_models.h +++ b/src/GRANULAR/contact_twisting_models.h @@ -42,6 +42,9 @@ class TwistingMarshall : public TwistingModel { public: TwistingMarshall(class LAMMPS *); void calculate_forces(); + void init(); + protected: + double k_tang, damp_tang, mu_tang; }; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 95cd4fc6e0..aca9341a58 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -14,7 +14,7 @@ /* ---------------------------------------------------------------------- Contributing authors: Leo Silbert (SNL), Gary Grest (SNL), - Dan Bolintineanu (SNL) + Dan Bolintineanu (SNL), Joel Clemmer (SNL) ------------------------------------------------------------------------- */ #include "fix_wall_gran.h" @@ -69,7 +69,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // set interaction style // disable bonded/history option for now model = new ContactModel(lmp); - model->wall_type = RWALL; + model->contact_type = WALL; if (strcmp(arg[3],"granular") == 0) classic_flag = 0; else classic_flag = 1; @@ -171,6 +171,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // wallstyle args idregion = nullptr; + tstr = nullptr; if (iarg >= narg) error->all(FLERR, "Illegal fix wall/gran command"); @@ -211,7 +212,11 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"temperature") == 0) { if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); - Twall = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (utils::strmatch(arg[iarg+1], "^v_")) { + tstr = utils::strdup(arg[3] + 2); + } else { + Twall = utils::numeric(FLERR,arg[iarg+1],false,lmp); + } Twall_defined = 1; iarg += 2; } else wallstyle = NOSTYLE; @@ -318,10 +323,10 @@ FixWallGran::~FixWallGran() atom->delete_callback(id,Atom::GROW); atom->delete_callback(id,Atom::RESTART); - delete model; - // delete local storage + delete model; + delete [] tstr; delete [] idregion; memory->destroy(history_one); memory->destroy(mass_rigid); @@ -365,6 +370,13 @@ void FixWallGran::init() model->sub_models[i]->history_index = next_index; next_index += model->sub_models[i]->size_history; } + + if (tstr) { + tvar = input->variable->find(tstr); + if (tvar < 0) error->all(FLERR, "Variable {} for fix wall/gran does not exist", tstr); + if (! input->variable->equalstyle(tvar)) + error->all(FLERR, "Variable {} for fix wall/gran must be an equal style variable", tstr); + } } /* ---------------------------------------------------------------------- */ @@ -467,7 +479,11 @@ void FixWallGran::post_force(int /*vflag*/) model->radj = 0.0; model->vj = vwall; model->omegaj = w0; - if (heat_flag) model->Tj = Twall; + if (heat_flag) { + if (tstr) + Twall = input->variable->compute_equal(tvar); + model->Tj = Twall; + } for (int i = 0; i < nlocal; i++) { if (! mask[i] & groupbit) continue; @@ -509,7 +525,6 @@ void FixWallGran::post_force(int /*vflag*/) } // Reset model and copy initial geometric data - model->reset_contact(); model->dx[0] = dx; model->dx[1] = dy; model->dx[2] = dz; diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index b61ac24d54..fd4a0a0ec8 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -67,6 +67,9 @@ class FixWallGran : public Fix { int heat_flag; int limit_damping; + int tvar; + char *tstr; + // shear history for single contact per particle double **history_one; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 7a774132f0..155b872e10 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Dan Bolintineanu (SNL) + Contributing authors: Dan Bolintineanu (SNL), Joel Clemmer (SNL) ------------------------------------------------------------------------- */ #include "fix_wall_gran_region.h" @@ -50,7 +50,7 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : tmax = region->tmax; c2r = new int[tmax]; - model->wall_type = RDUPLICATE; + model->contact_type = WALLREGION; // re-allocate atom-based arrays with nshear // do not register with Atom class, since parent class did that @@ -226,7 +226,6 @@ void FixWallGranRegion::post_force(int /*vflag*/) // Reset model and copy initial geometric data // A bit unncessary since region->contact[ic] stores r - model->reset_contact(); model->dx[0] = region->contact[ic].delx; model->dx[1] = region->contact[ic].dely; model->dx[2] = region->contact[ic].delz; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 52e4a84ded..b376bb64c1 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -14,8 +14,8 @@ /* ---------------------------------------------------------------------- Contributing authors: - Dan Bolintineanu (SNL), Ishan Srivastava (SNL), Jeremy Lechman(SNL) - Leo Silbert (SNL), Gary Grest (SNL) + Dan Bolintineanu (SNL), Joel Clemmer (SNL), Ishan Srivastava (SNL), + Jeremy Lechman(SNL), Leo Silbert (SNL), Gary Grest (SNL) ----------------------------------------------------------------------- */ #include "pair_granular.h" @@ -196,7 +196,6 @@ void PairGranular::compute(int eflag, int vflag) jtype = type[j]; // Reset model and copy initial geometric data - models[itype][jtype]->reset_contact(); models[itype][jtype]->xi = x[i]; models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; @@ -346,31 +345,30 @@ void PairGranular::coeff(int narg, char **arg) // Construct new model within vector vec_models.emplace_back(lmp); - //Parse mandatory normal and tangential specifications + //Parse mandatory specification int iarg = 2; vec_models.back().init_model(std::string(arg[iarg++]), NORMAL); iarg = vec_models.back().normal_model->parse_coeffs(arg, iarg, narg); - if (strcmp(arg[iarg++], "tangential") == 0) { - if (iarg >= narg) - error->all(FLERR,"Illegal pair_coeff command, must specify " - "tangential model after tangential keyword"); - vec_models.back().init_model(std::string(arg[iarg++]), TANGENTIAL); - iarg = vec_models.back().tangential_model->parse_coeffs(arg, iarg, narg); - } else{ - error->all(FLERR, "Illegal pair_coeff command, 'tangential' keyword expected"); - } - //Parse optional arguments while (iarg < narg) { - if (strcmp(arg[iarg], "damping") == 0) { + + if (strcmp(arg[iarg++], "tangential") == 0) { + if (iarg >= narg) + error->all(FLERR,"Illegal pair_coeff command, must specify " + "tangential model after tangential keyword"); + vec_models.back().init_model(std::string(arg[iarg++]), TANGENTIAL); + iarg = vec_models.back().tangential_model->parse_coeffs(arg, iarg, narg); + + } else if (strcmp(arg[iarg], "damping") == 0) { iarg++; if (iarg >= narg) error->all(FLERR, "Illegal pair_coeff command, must specify " "damping model after damping keyword"); vec_models.back().init_model(std::string(arg[iarg++]), DAMPING); iarg = vec_models.back().damping_model->parse_coeffs(arg, iarg, narg); + } else if (strcmp(arg[iarg], "rolling") == 0) { iarg++; if (iarg >= narg) @@ -386,6 +384,7 @@ void PairGranular::coeff(int narg, char **arg) "twisting model after twisting keyword"); vec_models.back().init_model(std::string(arg[iarg++]), TWISTING); iarg = vec_models.back().twisting_model->parse_coeffs(arg, iarg, narg); + } else if (strcmp(arg[iarg], "heat") == 0) { iarg++; if (iarg >= narg) @@ -394,6 +393,7 @@ void PairGranular::coeff(int narg, char **arg) vec_models.back().init_model(std::string(arg[iarg++]), HEAT); iarg = vec_models.back().heat_model->parse_coeffs(arg, iarg, narg); heat_flag = 1; + } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters for cutoff keyword"); @@ -576,6 +576,8 @@ double PairGranular::init_one(int i, int j) for (int k = 0; k < NSUBMODELS; k++) vec_models.back().sub_models[k]->history_index = models[i][i]->sub_models[k]->history_index; + + cutoff_type[i][j] = cutoff_type[j][i] = MAX(cutoff_type[i][i], cutoff_type[j][j]); } // Check if heat model is defined for all type combinations @@ -732,7 +734,6 @@ double PairGranular::single(int i, int j, int itype, int jtype, double *radius = atom->radius; // Reset model and copy initial geometric data - models[itype][jtype]->reset_contact(); models[itype][jtype]->xi = x[i]; models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; From b61cfb7480bbc342468e01710ae7884bc9877d1b Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 16 Sep 2022 09:06:52 -0600 Subject: [PATCH 23/57] Fixing errors in gran/wall reff calculation and adding heat capabilities --- doc/src/fix_wall_gran.rst | 15 +++++++++++++-- doc/src/fix_wall_gran_region.rst | 14 +++++++++++++- src/GRANULAR/contact.cpp | 18 +++++++++++------- src/GRANULAR/contact.h | 4 ++-- src/GRANULAR/fix_wall_gran.cpp | 12 +++++++++++- src/GRANULAR/fix_wall_gran_region.cpp | 2 ++ src/GRANULAR/pair_granular.cpp | 7 +++++++ 7 files changed, 59 insertions(+), 13 deletions(-) diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index cf8b659df0..7fa047a07f 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -46,7 +46,7 @@ Syntax radius = cylinder radius (distance units) * zero or more keyword/value pairs may be appended to args -* keyword = *wiggle* or *shear* or *contacts* +* keyword = *wiggle* or *shear* or *contacts* or *temperature* .. parsed-literal:: @@ -59,6 +59,8 @@ Syntax vshear = magnitude of shear velocity (velocity units) *contacts* value = none generate contact information for each particle + *temperature* value = temperature + specify temperature of wall Examples @@ -71,7 +73,7 @@ Examples fix 2 all wall/gran hooke 100000.0 20000.0 50.0 30.0 0.5 1 zcylinder 15.0 wiggle z 3.0 2.0 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 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 heat 10 region myCone temperature 1.0 fix 6 all wall/gran hooke 200000.0 NULL 50.0 NULL 0.5 0 xplane -10.0 10.0 contacts Description @@ -177,6 +179,15 @@ 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. +The *temperature* keyword is used to assign a temperature to the wall. +The following value can either be a numeric value or an equal-style +:doc:`variable `. If the value is a variable, it should be +specified as v_name, where name is the variable name. In this case, the +variable will be evaluated each timestep, and its value used to determine +the temperature. This option must be used in conjunction with a heat +conduction model defined in :doc:`pair_style granular ` +and a compatible atom style which stores temperature and a heat flux +as defined by the :doc:`atom_style sphere/temp ` command. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 5a4c983554..9dbf691ead 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -36,12 +36,14 @@ 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* +* keyword = *contacts* or *temperature* .. parsed-literal:: *contacts* value = none generate contact information for each particle + *temperature* value = temperature + specify temperature of wall Examples """""""" @@ -200,6 +202,16 @@ values for the 6 wall/particle coefficients than for particle/particle interactions. E.g. if you wish to model the wall as a different material. +The *temperature* keyword is used to assign a temperature to the wall. +The following value can either be a numeric value or an equal-style +:doc:`variable `. If the value is a variable, it should be +specified as v_name, where name is the variable name. In this case, the +variable will be evaluated each timestep, and its value used to determine +the temperature. This option must be used in conjunction with a heat +conduction model defined in :doc:`pair_style granular ` +and a compatible atom style which stores temperature and a heat flux +as defined by the :doc:`atom_style sphere/temp ` command. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index f72245def3..9e4542da08 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -328,20 +328,24 @@ void ContactModel::read_restart(FILE *fp) /* ---------------------------------------------------------------------- */ -bool ContactModel::check_contact(double rtemp) +bool ContactModel::check_contact() { if (contact_type == WALL) { // Used by fix_wall_gran.cpp + // radj = radius of wall + // dx already provided rsq = lensq3(dx); radsum = radi; - if (rtemp == 0) Reff = radi; - else Reff = radi * rtemp/(radi + rtemp); + if (radj == 0) Reff = radi; + else Reff = radi * radj / (radi + radj); } else if (contact_type == WALLREGION) { // Used by fix_wall_gran_region.cpp - rsq = rtemp * rtemp; - radsum = radi + radi; - if (rtemp == 0) Reff = radi; - else Reff = radi * rtemp/(radi + rtemp); + // radj = radius of wall + // dx and r already provided + rsq = r * r; + radsum = radi; + if (radj == 0) Reff = radi; + else Reff = radi * radj / (radi + radj); } else { sub3(xi, xj, dx); rsq = lensq3(dx); diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 4dc88132c0..54ecfeb757 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -51,7 +51,7 @@ class ContactModel : protected Pointers { ContactModel(class LAMMPS *); ~ContactModel(); void init(); - bool check_contact(double = 0); + bool check_contact(); void prep_contact(); void calculate_forces(); double pulloff_distance(double, double); @@ -84,7 +84,7 @@ class ContactModel : protected Pointers { // Contact properties/output double forces[3], torquesi[3], torquesj[3], dq; - double radi, radj, rwall, meff, dt, Ti, Tj, area; + double radi, radj, meff, dt, Ti, Tj, area; double Fntot, magtortwist; double *xi, *xj, *vi, *vj, *omegai, *omegaj; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index aca9341a58..6672a67387 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -354,6 +354,15 @@ void FixWallGran::init() if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + // check for compatible heat conduction atom style + + if (heat_flag) { + if (!atom->temperature_flag) + error->all(FLERR,"Heat conduction in fix wall/gran requires atom style with temperature property"); + if (!atom->heatflux_flag) + error->all(FLERR,"Heat conduction in fix wall/gran requires atom style with heatflux property"); + } + // check for FixRigid so can extract rigid body masses fix_rigid = nullptr; @@ -529,9 +538,10 @@ void FixWallGran::post_force(int /*vflag*/) model->dx[1] = dy; model->dx[2] = dz; model->radi = radius[i]; + model->radj = rwall; if (model->beyond_contact) model->touch = history_one[i][0]; - touchflag = model->check_contact(rwall); + touchflag = model->check_contact(); if (!touchflag) { if (use_history) diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 155b872e10..4058a31614 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -230,6 +230,8 @@ void FixWallGranRegion::post_force(int /*vflag*/) model->dx[1] = region->contact[ic].dely; model->dx[2] = region->contact[ic].delz; model->radi = radius[i]; + model->radj = region->contact[ic].radius; + model->r = region->contact[ic].r; if (model->beyond_contact) model->touch = history_many[i][c2r[ic]][0]; touchflag = model->check_contact(region->contact[ic].r); diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index b376bb64c1..9e512c78c0 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -442,6 +442,13 @@ void PairGranular::init_style() if (comm->ghost_velocity == 0) error->all(FLERR,"Pair granular requires ghost atoms store velocity"); + if (heat_flag) { + if (!atom->temperature_flag) + error->all(FLERR,"Heat conduction in pair granular requires atom style with temperature property"); + if (!atom->heatflux_flag) + error->all(FLERR,"Heat conduction in pair granular requires atom style with heatflux property"); + } + // allocate history and initialize models int size_max[NSUBMODELS] = {0}; From 71db9f5e75d4bd21a195d9e3c006c2277d7c4617 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 16 Sep 2022 14:16:34 -0600 Subject: [PATCH 24/57] Fixing tangential damping coefficient --- src/GRANULAR/contact.cpp | 8 ++--- src/GRANULAR/contact_damping_models.cpp | 12 ++++--- src/GRANULAR/contact_damping_models.h | 2 +- src/GRANULAR/contact_normal_models.cpp | 7 ++-- src/GRANULAR/contact_normal_models.h | 14 ++++---- src/GRANULAR/contact_tangential_models.cpp | 37 ++++++++++------------ src/GRANULAR/contact_tangential_models.h | 1 - src/GRANULAR/contact_twisting_models.cpp | 2 +- 8 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 9e4542da08..cd2c323a59 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -202,7 +202,7 @@ int ContactModel::init_classic_model(char **arg, int iarg, int narg) normal_model->coeffs[0] = kn; normal_model->coeffs[1] = gamman; tangential_model->coeffs[0] = kt; - tangential_model->coeffs[1] = gammat; + tangential_model->coeffs[1] = gammat / gamman; tangential_model->coeffs[2] = xmu; normal_model->coeffs_to_local(); @@ -364,7 +364,7 @@ void ContactModel::prep_contact() double temp[3]; // Standard geometric quantities - r = sqrt(rsq); + if (contact_type != WALLREGION) r = sqrt(rsq); rinv = 1.0 / r; delta = radsum - r; dR = delta * Reff; @@ -420,11 +420,9 @@ void ContactModel::calculate_forces() Fdamp = damping_model->calculate_forces(); Fntot = Fne + Fdamp; - - normal_model->set_fncrit(); // Needed for tangential, rolling, twisting - if (limit_damping && Fntot < 0.0) Fntot = 0.0; + normal_model->set_fncrit(); // Needed for tangential, rolling, twisting tangential_model->calculate_forces(); if (rolling_defined) rolling_model->calculate_forces(); if (twisting_defined) twisting_model->calculate_forces(); diff --git a/src/GRANULAR/contact_damping_models.cpp b/src/GRANULAR/contact_damping_models.cpp index a003d181d9..07b6b88649 100644 --- a/src/GRANULAR/contact_damping_models.cpp +++ b/src/GRANULAR/contact_damping_models.cpp @@ -56,7 +56,8 @@ DampingVelocity::DampingVelocity(LAMMPS *lmp) : DampingModel(lmp) {} double DampingVelocity::calculate_forces() { - return -damp * contact->vnnr; + damp_prefactor = damp; + return -damp_prefactor * contact->vnnr; } /* ---------------------------------------------------------------------- @@ -69,7 +70,8 @@ DampingMassVelocity::DampingMassVelocity(LAMMPS *lmp) : DampingModel(lmp) {} double DampingMassVelocity::calculate_forces() { - return -damp * contact->meff * contact->vnnr; + damp_prefactor = damp * contact->meff; + return -damp_prefactor * contact->vnnr; } /* ---------------------------------------------------------------------- @@ -82,7 +84,8 @@ DampingViscoelastic::DampingViscoelastic(LAMMPS *lmp) : DampingModel(lmp) {} double DampingViscoelastic::calculate_forces() { - return -damp * contact->meff * contact->area * contact->vnnr; + damp_prefactor = damp * contact->meff * contact->area; + return -damp_prefactor * contact->vnnr; } /* ---------------------------------------------------------------------- @@ -105,5 +108,6 @@ void DampingTsuji::init() double DampingTsuji::calculate_forces() { - return -damp * sqrt(contact->meff * contact->normal_model->knfac) * contact->vnnr; + damp_prefactor = damp * sqrt(contact->meff * contact->normal_model->knfac); + return -damp_prefactor * contact->vnnr; } diff --git a/src/GRANULAR/contact_damping_models.h b/src/GRANULAR/contact_damping_models.h index 611393da9f..222e901160 100644 --- a/src/GRANULAR/contact_damping_models.h +++ b/src/GRANULAR/contact_damping_models.h @@ -28,7 +28,7 @@ class DampingModel : public SubModel { virtual void mix_coeffs(double*, double*) {}; virtual void init(); virtual double calculate_forces() = 0; - double damp; + double damp, damp_prefactor; }; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index 9e0a377eb9..ed14eb93b4 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -45,12 +45,11 @@ bool NormalModel::touch() return touchflag; } -/* ---------------------------------------------------------------------- - called outside of compute(), do not assume geometry defined in contact -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ double NormalModel::pulloff_distance(double radi, double radj) { + //called outside of compute(), do not assume correct geometry defined in contact return radi + radj; } @@ -112,7 +111,7 @@ double NormalHooke::calculate_forces() void NormalHooke::set_knfac() { - knfac = k * contact->area; + knfac = k; } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index 6d47dd3736..66217e32a2 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -28,8 +28,8 @@ class NormalModel : public SubModel { virtual bool touch(); virtual double pulloff_distance(double, double); virtual double calculate_area(); - virtual double calculate_forces() = 0; virtual void set_knfac() = 0; + virtual double calculate_forces() = 0; virtual void set_fncrit(); double damp; // Vestigial argument needed by damping double Emod, poiss; @@ -42,8 +42,8 @@ class NormalModel : public SubModel { class NormalNone : public NormalModel { public: NormalNone(class LAMMPS *); - double calculate_forces(); void set_knfac() {}; + double calculate_forces(); }; /* ---------------------------------------------------------------------- */ @@ -52,8 +52,8 @@ class NormalHooke : public NormalModel { public: NormalHooke(class LAMMPS *); void coeffs_to_local() override; - double calculate_forces(); void set_knfac(); + double calculate_forces(); protected: double k; }; @@ -64,8 +64,8 @@ class NormalHertz : public NormalModel { public: NormalHertz(class LAMMPS *); void coeffs_to_local() override; - double calculate_forces(); void set_knfac(); + double calculate_forces(); protected: double k; }; @@ -86,8 +86,8 @@ class NormalDMT : public NormalModel { NormalDMT(class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; - double calculate_forces(); void set_knfac(); + double calculate_forces(); void set_fncrit() override; protected: double k, cohesion; @@ -104,8 +104,8 @@ class NormalJKR : public NormalModel { bool touch() override; double pulloff_distance(double, double) override; double calculate_area() override; - double calculate_forces() override; - void set_knfac() override; + void set_knfac(); + double calculate_forces(); void set_fncrit() override; protected: double k, cohesion; diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 46b370d15f..0349927731 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -30,13 +30,6 @@ using namespace MathExtra; TangentialModel::TangentialModel(LAMMPS *lmp) : SubModel(lmp) {} -/* ---------------------------------------------------------------------- */ - -void TangentialModel::init() -{ - damp = xt * contact->damping_model->damp; -} - /* ---------------------------------------------------------------------- No model ------------------------------------------------------------------------- */ @@ -69,16 +62,17 @@ void TangentialLinearNoHistory::coeffs_to_local() void TangentialLinearNoHistory::calculate_forces() { - double Fscrit, fsmag, Ft; - // classic pair gran/hooke (no history) - Fscrit = mu * contact->normal_model->Fncrit; - fsmag = damp * contact->vrel; + damp = xt * contact->damping_model->damp_prefactor; + + double Fscrit = mu * contact->normal_model->Fncrit; + double fsmag = damp * contact->vrel; + + double Ft; if (contact->vrel != 0.0) Ft = MIN(Fscrit, fsmag) / contact->vrel; else Ft = 0.0; - Ft = -Ft; - scale3(Ft, contact->vtr, contact->fs); + scale3(-Ft, contact->vtr, contact->fs); } /* ---------------------------------------------------------------------- @@ -107,11 +101,12 @@ void TangentialLinearHistory::coeffs_to_local() void TangentialLinearHistory::calculate_forces() { - double Fscrit, magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; int frame_update = 0; - Fscrit = contact->normal_model->Fncrit * mu; + damp = xt * contact->damping_model->damp_prefactor; + double Fscrit = contact->normal_model->Fncrit * mu; double *history = & contact->history[history_index]; // rotate and update displacements / force. @@ -140,8 +135,7 @@ void TangentialLinearHistory::calculate_forces() } // tangential forces = history + tangential velocity damping - temp_dbl = -damp; - scale3(temp_dbl, contact->vtr, contact->fs); + scale3(-damp, contact->vtr, contact->fs); // rescale frictional displacements and forces if needed magfs = len3(contact->fs); @@ -205,12 +199,14 @@ void TangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) void TangentialMindlin::calculate_forces() { - double Fscrit, k_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; + double k_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; int frame_update = 0; + damp = xt * contact->damping_model->damp_prefactor; + double *history = & contact->history[history_index]; - Fscrit = contact->normal_model->Fncrit * mu; + double Fscrit = contact->normal_model->Fncrit * mu; k_scaled = k * contact->area; if (mindlin_rescale) { @@ -256,8 +252,7 @@ void TangentialMindlin::calculate_forces() } // tangential forces = history + tangential velocity damping - temp_dbl = -damp; - scale3(temp_dbl, contact->vtr, contact->fs); + scale3(-damp, contact->vtr, contact->fs); if (!mindlin_force) { scale3(k_scaled, history, temp_array); diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index 812eb62e55..9c0092dabc 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -24,7 +24,6 @@ class TangentialModel : public SubModel { TangentialModel(class LAMMPS *); virtual ~TangentialModel() {}; virtual void coeffs_to_local() {}; - virtual void init(); virtual void calculate_forces() = 0; int rescale_flag; double k, damp, mu; // Used by Marshall twisting model diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 52b37d46e1..14b998d32f 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -50,7 +50,7 @@ TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) void TwistingMarshall::init() { k_tang = contact->tangential_model->k; - damp_tang = contact->tangential_model->damp; + damp_tang = contact->tangential_model->damp_tangential; mu_tang = contact->tangential_model->mu; } From c9ba3f415715e6a6cfa3dca780c24737d77b6f87 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 16 Sep 2022 16:56:20 -0600 Subject: [PATCH 25/57] Adding classic tangential models --- src/GRANULAR/contact.cpp | 22 ++-- src/GRANULAR/contact.h | 1 + src/GRANULAR/contact_tangential_models.cpp | 116 ++++++++++++++++++--- src/GRANULAR/contact_tangential_models.h | 17 +++ src/GRANULAR/contact_twisting_models.cpp | 2 +- src/GRANULAR/fix_wall_gran.cpp | 2 + src/GRANULAR/fix_wall_gran_region.cpp | 2 +- src/contact.h | 19 ++-- 8 files changed, 145 insertions(+), 36 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index cd2c323a59..b7c4e7c0e4 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -45,11 +45,9 @@ ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) limit_damping = 0; beyond_contact = 0; nondefault_history_transfer = 0; - + classic_model = 0; contact_type = PAIR; - reset_contact(); - normal_model = nullptr; damping_model = nullptr; tangential_model = nullptr; @@ -95,6 +93,7 @@ void ContactModel::init_model(std::string model_name, ModelType model_type) if (model_name == "none") tangential_model = new TangentialNone(lmp); else if (model_name == "linear_nohistory") tangential_model = new TangentialLinearNoHistory(lmp); else if (model_name == "linear_history") tangential_model = new TangentialLinearHistory(lmp); + else if (model_name == "linear_history_classic") tangential_model = new TangentialLinearHistoryClassic(lmp); else if (model_name == "mindlin") tangential_model = new TangentialMindlin(lmp); else if (model_name == "mindlin/force") tangential_model = new TangentialMindlinForce(lmp); else if (model_name == "mindlin_rescale") tangential_model = new TangentialMindlinRescale(lmp); @@ -157,6 +156,8 @@ int ContactModel::init_classic_model(char **arg, int iarg, int narg) { double kn, kt, gamman, gammat, xmu; + classic_model = 1; + if (iarg + 6 >= narg) error->all(FLERR,"Insufficient arguments provided for classic gran model command"); @@ -182,7 +183,7 @@ int ContactModel::init_classic_model(char **arg, int iarg, int narg) init_model("mass_velocity", DAMPING); } else if (strcmp(arg[iarg],"hooke/history") == 0) { init_model("hooke", NORMAL); - init_model("linear_history", TANGENTIAL); + init_model("linear_history_classic", TANGENTIAL); init_model("mass_velocity", DAMPING); } else if (strcmp(arg[iarg],"hertz/history") == 0) { // convert Kn and Kt from pressure units to force/distance^2 if Hertzian @@ -435,13 +436,18 @@ void ContactModel::calculate_forces() //May need to rethink eventually tris.. cross3(nx, fs, torquesi); - double dist_to_contact = radi - 0.5 * delta; - scale3(dist_to_contact, torquesi); + double dist_to_contact; + if (!classic_model) { + dist_to_contact = radi - 0.5 * delta; + scale3(dist_to_contact, torquesi); + } if (contact_type == PAIR) { copy3(torquesi, torquesj); - dist_to_contact = radj - 0.5 * delta; - scale3(dist_to_contact, torquesj); + if (!classic_model) { + dist_to_contact = radj - 0.5 * delta; + scale3(dist_to_contact, torquesj); + } } double torroll[3]; diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 54ecfeb757..632555a21f 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -97,6 +97,7 @@ class ContactModel : protected Pointers { protected: int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels + int classic_model; }; } // namespace Contact diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 0349927731..1ac8c1c44c 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -73,6 +73,7 @@ void TangentialLinearNoHistory::calculate_forces() else Ft = 0.0; scale3(-Ft, contact->vtr, contact->fs); + } /* ---------------------------------------------------------------------- @@ -101,7 +102,8 @@ void TangentialLinearHistory::coeffs_to_local() void TangentialLinearHistory::calculate_forces() { - double magfs, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + // Note: this is the same as the base Mindlin calculation except k isn't scaled by area + double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; int frame_update = 0; damp = xt * contact->damping_model->damp_prefactor; @@ -117,8 +119,11 @@ void TangentialLinearHistory::calculate_forces() if (frame_update) { shrmag = len3(history); + // projection - scale3(rsht, contact->nx, history); + scale3(rsht, contact->nx, temp_array); + sub3(history, temp_array, history); + // also rescale to preserve magnitude prjmag = len3(history); if (prjmag > 0) temp_dbl = shrmag / prjmag; @@ -126,27 +131,30 @@ void TangentialLinearHistory::calculate_forces() scale3(temp_dbl, history); } - // update history - // tangential force + // update history, tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = k * contact->dt; - scale3(temp_dbl, contact->vtr, temp_array); - sub3(history, temp_array, history); + scale3(contact->dt, contact->vtr, temp_array); + add3(history, temp_array, history); } // tangential forces = history + tangential velocity damping - scale3(-damp, contact->vtr, contact->fs); + scale3(-k, history, contact->fs); + scale3(damp, contact->vtr, temp_array); + sub3(contact->fs, temp_array, contact->fs); // rescale frictional displacements and forces if needed magfs = len3(contact->fs); if (magfs > Fscrit) { shrmag = len3(history); if (shrmag != 0.0) { - temp_dbl = Fscrit / magfs; + magfs_inv = 1.0 / magfs; + temp_dbl = Fscrit * magfs_inv; scale3(temp_dbl, contact->fs, history); scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); - temp_dbl = Fscrit / magfs; + temp_dbl = -1.0 / k; + scale3(temp_dbl, history); + temp_dbl = Fscrit * magfs_inv; scale3(temp_dbl, contact->fs); } else { zero3(contact->fs); @@ -154,6 +162,80 @@ void TangentialLinearHistory::calculate_forces() } } +/* ---------------------------------------------------------------------- + Linear model with history from pair gran/hooke/history +------------------------------------------------------------------------- */ + +TangentialLinearHistoryClassic::TangentialLinearHistoryClassic(LAMMPS *lmp) : TangentialLinearHistory(lmp) +{ + scale_area = 0; +} + +/* ---------------------------------------------------------------------- */ + +void TangentialLinearHistoryClassic::calculate_forces() +{ + double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; + double temp_array[3]; + int frame_update = 0; + + k_scaled = k; + if (scale_area) k_scaled *= contact->area; + + damp = xt * contact->damping_model->damp_prefactor; + + double Fscrit = contact->normal_model->Fncrit * mu; + double *history = & contact->history[history_index]; + + // update history + if (contact->history_update) { + scale3(contact->dt, contact->vtr, temp_array); + add3(history, temp_array, history); + } + + shrmag = len3(history); + + // rotate shear displacements + if (contact->history_update) { + rsht = dot3(history, contact->nx); + scale3(rsht, contact->nx, temp_array); + sub3(history, temp_array, history); + } + + // tangential forces = history + tangential velocity damping + scale3(-k_scaled, history, contact->fs); + scale3(damp, contact->vtr, temp_array); + sub3(contact->fs, temp_array, contact->fs); + + // rescale frictional displacements and forces if needed + magfs = len3(contact->fs); + if (magfs > Fscrit) { + if (shrmag != 0.0) { + magfs_inv = 1.0 / magfs; + temp_dbl = Fscrit * magfs_inv; + scale3(temp_dbl, contact->fs, history); + scale3(damp, contact->vtr, temp_array); + add3(history, temp_array, history); + temp_dbl = -1.0 / k_scaled; + if (scale_area) temp_dbl /= contact->area; + scale3(temp_dbl, history); + temp_dbl = Fscrit * magfs_inv; + scale3(temp_dbl, contact->fs); + } else { + zero3(contact->fs); + } + } +} + +/* ---------------------------------------------------------------------- + Mindlin from pair gran/hertz/history +------------------------------------------------------------------------- */ + +TangentialMindlinClassic::TangentialMindlinClassic(LAMMPS *lmp) : TangentialLinearHistoryClassic(lmp) +{ + scale_area = 1; +} + /* ---------------------------------------------------------------------- Mindlin model ------------------------------------------------------------------------- */ @@ -199,7 +281,7 @@ void TangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) void TangentialMindlin::calculate_forces() { - double k_scaled, magfs, rsht, shrmag, prjmag, temp_dbl; + double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; int frame_update = 0; @@ -229,7 +311,8 @@ void TangentialMindlin::calculate_forces() if (frame_update) { shrmag = len3(history); // projection - scale3(rsht, contact->nx, history); + scale3(rsht, contact->nx, temp_array); + sub3(history, temp_array, history); // also rescale to preserve magnitude prjmag = len3(history); if (prjmag > 0) temp_dbl = shrmag / prjmag; @@ -256,7 +339,7 @@ void TangentialMindlin::calculate_forces() if (!mindlin_force) { scale3(k_scaled, history, temp_array); - add3(contact->fs, temp_array, contact->fs); + sub3(contact->fs, temp_array, contact->fs); } // rescale frictional displacements and forces if needed @@ -264,15 +347,16 @@ void TangentialMindlin::calculate_forces() if (magfs > Fscrit) { shrmag = len3(history); if (shrmag != 0.0) { - temp_dbl = Fscrit / magfs; + magfs_inv = 1.0 / magfs; + temp_dbl = Fscrit * magfs_inv; scale3(temp_dbl, contact->fs, history); scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); - if (! mindlin_force) { + if (!mindlin_force) { temp_dbl = -1.0 / k_scaled; scale3(temp_dbl, history); } - temp_dbl = Fscrit / magfs; + temp_dbl = Fscrit * magfs_inv; scale3(temp_dbl, contact->fs); } else { zero3(contact->fs); diff --git a/src/GRANULAR/contact_tangential_models.h b/src/GRANULAR/contact_tangential_models.h index 9c0092dabc..a54d03c495 100644 --- a/src/GRANULAR/contact_tangential_models.h +++ b/src/GRANULAR/contact_tangential_models.h @@ -24,6 +24,7 @@ class TangentialModel : public SubModel { TangentialModel(class LAMMPS *); virtual ~TangentialModel() {}; virtual void coeffs_to_local() {}; + virtual void init() {}; virtual void calculate_forces() = 0; int rescale_flag; double k, damp, mu; // Used by Marshall twisting model @@ -59,6 +60,22 @@ class TangentialLinearHistory : public TangentialModel { /* ---------------------------------------------------------------------- */ +class TangentialLinearHistoryClassic : public TangentialLinearHistory { + public: + TangentialLinearHistoryClassic(class LAMMPS *); + void calculate_forces(); + int scale_area; +}; + +/* ---------------------------------------------------------------------- */ + +class TangentialMindlinClassic : public TangentialLinearHistoryClassic { + public: + TangentialMindlinClassic(class LAMMPS *); +}; + +/* ---------------------------------------------------------------------- */ + class TangentialMindlin : public TangentialModel { public: TangentialMindlin(class LAMMPS *); diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 14b998d32f..52b37d46e1 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -50,7 +50,7 @@ TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) void TwistingMarshall::init() { k_tang = contact->tangential_model->k; - damp_tang = contact->tangential_model->damp_tangential; + damp_tang = contact->tangential_model->damp; mu_tang = contact->tangential_model->mu; } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 6672a67387..05e060e61c 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -30,6 +30,7 @@ #include "contact_heat_models.h" #include "domain.h" #include "error.h" +#include "input.h" #include "math_const.h" #include "math_extra.h" #include "memory.h" @@ -37,6 +38,7 @@ #include "neighbor.h" #include "respa.h" #include "update.h" +#include "variable.h" #include diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 4058a31614..2e57e335f7 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -234,7 +234,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) model->r = region->contact[ic].r; if (model->beyond_contact) model->touch = history_many[i][c2r[ic]][0]; - touchflag = model->check_contact(region->contact[ic].r); + touchflag = model->check_contact(); if (!touchflag) { if (use_history) diff --git a/src/contact.h b/src/contact.h index cd680b220a..632555a21f 100644 --- a/src/contact.h +++ b/src/contact.h @@ -31,10 +31,10 @@ enum ModelType { HEAT = 5 }; // Relative order matters since some derive coeffs from others -enum WallType { - NONE = 0, - RWALL = 1, - RDUPLICATE = 2 +enum ContactType { + PAIR = 0, + WALL = 1, + WALLREGION = 2 }; // forward declaration @@ -51,8 +51,7 @@ class ContactModel : protected Pointers { ContactModel(class LAMMPS *); ~ContactModel(); void init(); - bool check_contact(double = 0); - void reset_contact(); + bool check_contact(); void prep_contact(); void calculate_forces(); double pulloff_distance(double, double); @@ -75,7 +74,7 @@ class ContactModel : protected Pointers { // Extra options int beyond_contact, limit_damping, history_update; - WallType wall_type; + ContactType contact_type; // History variables int size_history, nondefault_history_transfer; @@ -85,7 +84,7 @@ class ContactModel : protected Pointers { // Contact properties/output double forces[3], torquesi[3], torquesj[3], dq; - double radi, radj, rwall, meff, dt, Ti, Tj, area; + double radi, radj, meff, dt, Ti, Tj, area; double Fntot, magtortwist; double *xi, *xj, *vi, *vj, *omegai, *omegaj; @@ -97,8 +96,8 @@ class ContactModel : protected Pointers { bool touch; protected: - int rolling_defined, twisting_defined, heat_defined; - int prep_flag, check_flag; + int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels + int classic_model; }; } // namespace Contact From 7f16225ffbc8842239f34da434d75c9902602dbe Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 16 Sep 2022 16:57:32 -0600 Subject: [PATCH 26/57] Removing leftover file --- src/contact.h | 106 -------------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 src/contact.h diff --git a/src/contact.h b/src/contact.h deleted file mode 100644 index 632555a21f..0000000000 --- a/src/contact.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef LMP_CONTACT_H -#define LMP_CONTACT_H - -#include "pointers.h" // IWYU pragma: export - -namespace LAMMPS_NS { -namespace Contact { - -#define EPSILON 1e-10 -#define NSUBMODELS 6 - -enum ModelType { - NORMAL = 0, - DAMPING = 1, - TANGENTIAL = 2, - ROLLING = 3, - TWISTING = 4, - HEAT = 5 -}; // Relative order matters since some derive coeffs from others - -enum ContactType { - PAIR = 0, - WALL = 1, - WALLREGION = 2 -}; - -// forward declaration -class NormalModel; -class DampingModel; -class TangentialModel; -class RollingModel; -class TwistingModel; -class HeatModel; -class SubModel; - -class ContactModel : protected Pointers { - public: - ContactModel(class LAMMPS *); - ~ContactModel(); - void init(); - bool check_contact(); - void prep_contact(); - void calculate_forces(); - double pulloff_distance(double, double); - - void init_model(std::string, ModelType); - int init_classic_model(char **, int, int); - int mix_coeffs(ContactModel*, ContactModel*); - - void write_restart(FILE *); - void read_restart(FILE *); - - // Sub models - NormalModel *normal_model; - DampingModel *damping_model; - TangentialModel *tangential_model; - RollingModel *rolling_model; - TwistingModel *twisting_model; - HeatModel *heat_model; - SubModel *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors - - // Extra options - int beyond_contact, limit_damping, history_update; - ContactType contact_type; - - // History variables - int size_history, nondefault_history_transfer; - double *transfer_history_factor; - double *history; - - // Contact properties/output - double forces[3], torquesi[3], torquesj[3], dq; - - double radi, radj, meff, dt, Ti, Tj, area; - double Fntot, magtortwist; - - double *xi, *xj, *vi, *vj, *omegai, *omegaj; - double fs[3], fr[3], ft[3]; - - double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; - double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; - double magtwist; - bool touch; - - protected: - int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels - int classic_model; -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif From 13be68aecef770daf4559a6a69b62696bda7fd8a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 19 Sep 2022 22:14:59 -0600 Subject: [PATCH 27/57] Fixing argument errors and adding note on datafiles to doc --- doc/src/pair_gran.rst | 5 +++++ doc/src/pair_granular.rst | 5 +++++ src/GRANULAR/contact_tangential_models.cpp | 4 ++-- src/GRANULAR/contact_twisting_models.cpp | 3 +-- src/GRANULAR/contact_twisting_models.h | 2 +- src/GRANULAR/fix_wall_gran.cpp | 3 +-- src/GRANULAR/pair_granular.cpp | 3 ++- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index f83fd6d6ab..3249bae866 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -279,6 +279,11 @@ statistically similar results. This is because the forces they compute depend on atom velocities. See the :doc:`read_restart ` command for more details. +Accumulated values for individual contacts are saved to to restart +files but are not saved to data files. Therefore, forces may +differ significantly when a system is reloaded using A +:doc:`read_data ` command. + Related commands """""""""""""""" diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 675c8fe4ff..5856db307b 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -780,6 +780,11 @@ statistically similar results. This is because the forces they compute depend on atom velocities. See the :doc:`read_restart ` command for more details. +Accumulated values for individual contacts are saved to to restart +files but are not saved to data files. Therefore, forces may +differ significantly when a system is reloaded using A +:doc:`read_data ` command. + Related commands """""""""""""""" diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index 1ac8c1c44c..d9bb3320b8 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -168,7 +168,7 @@ void TangentialLinearHistory::calculate_forces() TangentialLinearHistoryClassic::TangentialLinearHistoryClassic(LAMMPS *lmp) : TangentialLinearHistory(lmp) { - scale_area = 0; + scale_area = 0; // Sets gran/hooke/history behavior } /* ---------------------------------------------------------------------- */ @@ -233,7 +233,7 @@ void TangentialLinearHistoryClassic::calculate_forces() TangentialMindlinClassic::TangentialMindlinClassic(LAMMPS *lmp) : TangentialLinearHistoryClassic(lmp) { - scale_area = 1; + scale_area = 1; // Sets gran/hertz/history behavior } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index 52b37d46e1..aca4f958e7 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -50,7 +50,6 @@ TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) void TwistingMarshall::init() { k_tang = contact->tangential_model->k; - damp_tang = contact->tangential_model->damp; mu_tang = contact->tangential_model->mu; } @@ -63,7 +62,7 @@ void TwistingMarshall::calculate_forces() // Calculate twist coefficients from tangential model & contact geometry // eq 32 of Marshall paper double k = 0.5 * k_tang * contact->area * contact->area; - double damp = 0.5 * damp_tang * contact->area * contact->area; + double damp = 0.5 * contact->tangential_model->damp * contact->area * contact->area; double mu = TWOTHIRDS * mu_tang * contact->area; if (contact->history_update) { diff --git a/src/GRANULAR/contact_twisting_models.h b/src/GRANULAR/contact_twisting_models.h index 724448892a..1fa5aa2c6a 100644 --- a/src/GRANULAR/contact_twisting_models.h +++ b/src/GRANULAR/contact_twisting_models.h @@ -44,7 +44,7 @@ class TwistingMarshall : public TwistingModel { void calculate_forces(); void init(); protected: - double k_tang, damp_tang, mu_tang; + double k_tang, mu_tang; }; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 05e060e61c..0d6fc587fb 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -83,8 +83,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : int iarg; if (classic_flag) { - iarg = 4; - iarg = model->init_classic_model(arg, iarg, narg); + iarg = model->init_classic_model(arg, 3, narg); if (iarg < narg) { if (strcmp(arg[iarg],"limit_damping") == 0) { diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 9e512c78c0..1e423b92b3 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -354,7 +354,8 @@ void PairGranular::coeff(int narg, char **arg) while (iarg < narg) { - if (strcmp(arg[iarg++], "tangential") == 0) { + if (strcmp(arg[iarg], "tangential") == 0) { + iarg++; if (iarg >= narg) error->all(FLERR,"Illegal pair_coeff command, must specify " "tangential model after tangential keyword"); From dc1b7d4cfece31fd2379737b32a4bbe2db234624 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 21 Sep 2022 16:31:18 -0600 Subject: [PATCH 28/57] Fixing mathematical errors in force/torque calculations --- src/GRANULAR/contact.cpp | 18 +++--- src/GRANULAR/contact.h | 1 + src/GRANULAR/contact_normal_models.cpp | 45 +++++++++----- src/GRANULAR/contact_normal_models.h | 2 +- src/GRANULAR/contact_rolling_models.cpp | 43 +++++++------- src/GRANULAR/contact_sub_models.cpp | 20 +++++++ src/GRANULAR/contact_sub_models.h | 2 + src/GRANULAR/contact_tangential_models.cpp | 69 +++++++++++----------- src/GRANULAR/contact_twisting_models.cpp | 4 +- src/GRANULAR/fix_wall_gran.cpp | 1 + src/GRANULAR/fix_wall_gran_region.cpp | 2 +- src/GRANULAR/pair_granular.cpp | 21 ++++--- 12 files changed, 133 insertions(+), 95 deletions(-) diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index b7c4e7c0e4..5290f13629 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -414,7 +414,7 @@ void ContactModel::calculate_forces() // calculate forces/torques forces[0] = 0.0; - double Fne, Fdamp; + double Fne, Fdamp, dist_to_contact; area = normal_model->calculate_area(); normal_model->set_knfac(); Fne = normal_model->calculate_forces(); @@ -435,18 +435,18 @@ void ContactModel::calculate_forces() //May need to rethink eventually tris.. cross3(nx, fs, torquesi); + scale3(-1, torquesi); + if (contact_type == PAIR) copy3(torquesi, torquesj); - double dist_to_contact; if (!classic_model) { - dist_to_contact = radi - 0.5 * delta; - scale3(dist_to_contact, torquesi); - } - - if (contact_type == PAIR) { - copy3(torquesi, torquesj); - if (!classic_model) { + if (contact_type == PAIR) { + dist_to_contact = radi - 0.5 * delta; + scale3(dist_to_contact, torquesi); dist_to_contact = radj - 0.5 * delta; scale3(dist_to_contact, torquesj); + } else { + dist_to_contact = radi; + scale3(dist_to_contact, torquesi); } } diff --git a/src/GRANULAR/contact.h b/src/GRANULAR/contact.h index 632555a21f..d1a13c5eb1 100644 --- a/src/GRANULAR/contact.h +++ b/src/GRANULAR/contact.h @@ -87,6 +87,7 @@ class ContactModel : protected Pointers { double radi, radj, meff, dt, Ti, Tj, area; double Fntot, magtortwist; + int i, j; double *xi, *xj, *vi, *vj, *omegai, *omegaj; double fs[3], fr[3], ft[3]; diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/GRANULAR/contact_normal_models.cpp index ed14eb93b4..b377d5d027 100644 --- a/src/GRANULAR/contact_normal_models.cpp +++ b/src/GRANULAR/contact_normal_models.cpp @@ -165,7 +165,11 @@ void NormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + if (contact->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); } @@ -199,7 +203,11 @@ void NormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + if (contact->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); } @@ -259,8 +267,14 @@ void NormalJKR::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - k = FOURTHIRDS * Emod; - Escaled = mix_stiffnessE(Emod, Emod, poiss, poiss); + + if (contact->contact_type == PAIR) { + Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + Emix = mix_stiffnessE_wall(Emod, poiss); + } + + k = FOURTHIRDS * Emix; if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); } @@ -285,8 +299,8 @@ bool NormalJKR::touch() if (contact->touch) { R2 = contact->Reff * contact->Reff; - area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4.0 * Escaled)); - delta_pulloff = area_at_pulloff * area_at_pulloff / contact->Reff - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff /Escaled); + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4.0 * Emix)); + delta_pulloff = area_at_pulloff * area_at_pulloff / contact->Reff - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Emix); dist_pulloff = contact->radsum - delta_pulloff; touchflag = contact->rsq < (dist_pulloff * dist_pulloff); } else { @@ -307,8 +321,8 @@ double NormalJKR::pulloff_distance(double radi, double radj) Reff_tmp = radi * radj / (radi + radj); // May not be defined if (Reff_tmp <= 0) return 0; - area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4.0 * Escaled)); - return area_at_pulloff * area_at_pulloff / Reff_tmp - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Escaled); + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4.0 * Emix)); + return area_at_pulloff * area_at_pulloff / Reff_tmp - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Emix); } /* ---------------------------------------------------------------------- */ @@ -320,18 +334,18 @@ double NormalJKR::calculate_area() R2 = contact->Reff * contact->Reff; dR2 = contact->dR * contact->dR; - t0 = cohesion * cohesion * R2 * R2 * Escaled; + t0 = cohesion * cohesion * R2 * R2 * Emix; t1 = PI27SQ * t0; - t2 = 8.0 * contact->dR * dR2 * Escaled * Escaled * Escaled; - t3 = 4.0 * dR2 * Escaled; + t2 = 8.0 * contact->dR * dR2 * Emix * Emix * Emix; + t3 = 4.0 * dR2 * Emix; // in case sqrt(0) < 0 due to precision issues sqrt1 = MAX(0, t0 * (t1 + 2.0 * t2)); t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Escaled; + t5 = t3 / t4 + t4 / Emix; sqrt2 = MAX(0, 2.0 * contact->dR + t5); t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4.0 * contact->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Escaled * t6)); + sqrt3 = MAX(0, 4.0 * contact->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Emix * t6)); return INVROOT6 * (t6 + sqrt(sqrt3)); } @@ -341,9 +355,8 @@ double NormalJKR::calculate_area() double NormalJKR::calculate_forces() { double a2; - a2 = contact->area * contact->area; - Fne = Escaled * contact->area * a2 / contact->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Escaled / (MY_PI * contact->area)); + Fne = knfac * a2 / contact->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Emix / (MY_PI * contact->area)); F_pulloff = 3.0 * MY_PI * cohesion * contact->Reff; return Fne; @@ -353,7 +366,7 @@ double NormalJKR::calculate_forces() void NormalJKR::set_knfac() { - knfac = Escaled * contact->area; + knfac = k * contact->area; } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_normal_models.h b/src/GRANULAR/contact_normal_models.h index 66217e32a2..8159a4c620 100644 --- a/src/GRANULAR/contact_normal_models.h +++ b/src/GRANULAR/contact_normal_models.h @@ -109,7 +109,7 @@ class NormalJKR : public NormalModel { void set_fncrit() override; protected: double k, cohesion; - double Escaled, F_pulloff; + double Emix, F_pulloff; }; } // namespace Contact diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/GRANULAR/contact_rolling_models.cpp index 956be65353..3ee80c0e48 100644 --- a/src/GRANULAR/contact_rolling_models.cpp +++ b/src/GRANULAR/contact_rolling_models.cpp @@ -50,8 +50,8 @@ RollingSDS::RollingSDS(LAMMPS *lmp) : RollingModel(lmp) void RollingSDS::coeffs_to_local() { k = coeffs[0]; - mu = coeffs[1]; - gamma = coeffs[2]; + gamma = coeffs[1]; + mu = coeffs[2]; if (k < 0.0 || mu < 0.0 || gamma < 0.0) error->all(FLERR, "Illegal SDS rolling model"); @@ -62,7 +62,8 @@ void RollingSDS::coeffs_to_local() void RollingSDS::calculate_forces() { int rhist0, rhist1, rhist2, frameupdate; - double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], temp_dbl, temp_array[3]; + double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], scalefac, temp_array[3]; + double k_inv, magfr_inv; rhist0 = history_index; rhist1 = rhist0 + 1; @@ -76,49 +77,45 @@ void RollingSDS::calculate_forces() hist_temp[2] = contact->history[rhist2]; rolldotn = dot3(hist_temp, contact->nx); - frameupdate = fabs(rolldotn) * k > EPSILON * Frcrit; + frameupdate = (fabs(rolldotn) * k) > (EPSILON * Frcrit); if (frameupdate) { // rotate into tangential plane rollmag = len3(hist_temp); // projection - temp_dbl = -rolldotn; - scale3(temp_dbl, contact->nx, temp_array); + scale3(rolldotn, contact->nx, temp_array); sub3(hist_temp, temp_array, hist_temp); // also rescale to preserve magnitude prjmag = len3(hist_temp); - if (prjmag > 0) temp_dbl = rollmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, hist_temp); + if (prjmag > 0) scalefac = rollmag / prjmag; + else scalefac = 0; + scale3(scalefac, hist_temp); } scale3(contact->dt, contact->vrl, temp_array); add3(hist_temp, temp_array, hist_temp); } - scaleadd3(k, hist_temp, gamma, contact->vrl, contact->fr); - negate3(contact->fr); + scaleadd3(-k, hist_temp, -gamma, contact->vrl, contact->fr); // rescale frictional displacements and forces if needed - magfr = len3(contact->fr); if (magfr > Frcrit) { rollmag = len3(hist_temp); if (rollmag != 0.0) { - temp_dbl = -Frcrit / (magfr * k); - scale3(temp_dbl, contact->fr, temp_array); + k_inv = 1.0 / k; + magfr_inv = 1.0 / magfr; + scale3(-Frcrit * k_inv * magfr_inv, contact->fr, hist_temp); + scale3(-gamma * k_inv, contact->vrl, temp_array); add3(hist_temp, temp_array, hist_temp); - temp_dbl = -gamma/k; - scale3(temp_dbl, contact->vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - - temp_dbl = Frcrit / magfr; - scale3(temp_dbl, contact->fr); + scale3(Frcrit * magfr_inv, contact->fr); } else { zero3(contact->fr); } } - contact->history[rhist0] = hist_temp[0]; - contact->history[rhist1] = hist_temp[1]; - contact->history[rhist2] = hist_temp[2]; + if (contact->history_update) { + contact->history[rhist0] = hist_temp[0]; + contact->history[rhist1] = hist_temp[1]; + contact->history[rhist2] = hist_temp[2]; + } } diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/GRANULAR/contact_sub_models.cpp index 57834fc040..1c9fe6b4f5 100644 --- a/src/GRANULAR/contact_sub_models.cpp +++ b/src/GRANULAR/contact_sub_models.cpp @@ -110,6 +110,26 @@ double SubModel::mix_stiffnessG(double E1, double E2, return 1 / (factor1 + factor2); } +/* ---------------------------------------------------------------------- + mixing of Young's modulus (E) for walls +------------------------------------------------------------------------- */ + +double SubModel::mix_stiffnessE_wall(double E, double pois) +{ + double factor = 2 * (1 - pois); + return E / factor; +} + +/* ---------------------------------------------------------------------- + mixing of shear modulus (G) for walls +------------------------------------------------------------------------ */ + +double SubModel::mix_stiffnessG_wall(double E, double pois) +{ + double factor = 32.0 * (2 - pois) * (1 + pois); + return E / factor; +} + /* ---------------------------------------------------------------------- mixing of everything else ------------------------------------------------------------------------- */ diff --git a/src/GRANULAR/contact_sub_models.h b/src/GRANULAR/contact_sub_models.h index 730790616d..0f577bf08e 100644 --- a/src/GRANULAR/contact_sub_models.h +++ b/src/GRANULAR/contact_sub_models.h @@ -51,6 +51,8 @@ class SubModel : protected Pointers { double mix_stiffnessE(double, double, double, double); double mix_stiffnessG(double, double, double, double); + double mix_stiffnessE_wall(double, double); + double mix_stiffnessG_wall(double, double); double mix_geom(double, double); }; diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/GRANULAR/contact_tangential_models.cpp index d9bb3320b8..ca95d1d00b 100644 --- a/src/GRANULAR/contact_tangential_models.cpp +++ b/src/GRANULAR/contact_tangential_models.cpp @@ -73,7 +73,6 @@ void TangentialLinearNoHistory::calculate_forces() else Ft = 0.0; scale3(-Ft, contact->vtr, contact->fs); - } /* ---------------------------------------------------------------------- @@ -115,7 +114,7 @@ void TangentialLinearHistory::calculate_forces() // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 if (contact->history_update) { rsht = dot3(history, contact->nx); - frame_update = fabs(rsht) * k > EPSILON * Fscrit; + frame_update = (fabs(rsht) * k) > (EPSILON * Fscrit); if (frame_update) { shrmag = len3(history); @@ -137,6 +136,7 @@ void TangentialLinearHistory::calculate_forces() add3(history, temp_array, history); } + // tangential forces = history + tangential velocity damping scale3(-k, history, contact->fs); scale3(damp, contact->vtr, temp_array); @@ -148,14 +148,11 @@ void TangentialLinearHistory::calculate_forces() shrmag = len3(history); if (shrmag != 0.0) { magfs_inv = 1.0 / magfs; - temp_dbl = Fscrit * magfs_inv; - scale3(temp_dbl, contact->fs, history); + scale3(Fscrit * magfs_inv, contact->fs, history); scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); - temp_dbl = -1.0 / k; - scale3(temp_dbl, history); - temp_dbl = Fscrit * magfs_inv; - scale3(temp_dbl, contact->fs); + scale3(-1.0 / k, history); + scale3(Fscrit * magfs_inv, contact->fs); } else { zero3(contact->fs); } @@ -212,15 +209,13 @@ void TangentialLinearHistoryClassic::calculate_forces() if (magfs > Fscrit) { if (shrmag != 0.0) { magfs_inv = 1.0 / magfs; - temp_dbl = Fscrit * magfs_inv; - scale3(temp_dbl, contact->fs, history); + scale3(Fscrit * magfs_inv, contact->fs, history); scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); temp_dbl = -1.0 / k_scaled; if (scale_area) temp_dbl /= contact->area; scale3(temp_dbl, history); - temp_dbl = Fscrit * magfs_inv; - scale3(temp_dbl, contact->fs); + scale3(Fscrit * magfs_inv, contact->fs); } else { zero3(contact->fs); } @@ -259,7 +254,15 @@ void TangentialMindlin::coeffs_to_local() if (k == -1) { if (!contact->normal_model->material_properties) error->all(FLERR, "Must either specify tangential stiffness or material properties for normal model for the Mindlin tangential style"); - k = 8.0 * mix_stiffnessG(contact->normal_model->Emod, contact->normal_model->Emod, contact->normal_model->poiss, contact->normal_model->poiss); + + double Emod = contact->normal_model->Emod; + double poiss = contact->normal_model->poiss; + + if (contact->contact_type == PAIR) { + k = 8.0 * mix_stiffnessG(Emod, Emod, poiss, poiss); + } else { + k = 8.0 * mix_stiffnessG_wall(Emod, poiss); + } } if (k < 0.0 || xt < 0.0 || mu < 0.0) @@ -291,22 +294,21 @@ void TangentialMindlin::calculate_forces() double Fscrit = contact->normal_model->Fncrit * mu; k_scaled = k * contact->area; - if (mindlin_rescale) { - // on unloading, rescale the shear displacements/force - if (contact->area < history[3]) { - temp_dbl = contact->area / history[3]; - scale3(temp_dbl, history); - } - } + + // on unloading, rescale the shear displacements/force + if (mindlin_rescale) + if (contact->area < history[3]) + scale3(contact->area / history[3], history); // rotate and update displacements / force. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 if (contact->history_update) { rsht = dot3(history, contact->nx); - if (mindlin_force) - frame_update = fabs(rsht) > EPSILON * Fscrit; - else - frame_update = fabs(rsht) * k_scaled > EPSILON * Fscrit; + if (mindlin_force) { + frame_update = fabs(rsht) > (EPSILON * Fscrit); + } else { + frame_update = (fabs(rsht) * k_scaled) > (EPSILON * Fscrit); + } if (frame_update) { shrmag = len3(history); @@ -324,8 +326,7 @@ void TangentialMindlin::calculate_forces() if (mindlin_force) { // tangential force // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - temp_dbl = -k_scaled * contact->dt; - scale3(temp_dbl, contact->vtr, temp_array); + scale3(-k_scaled * contact->dt, contact->vtr, temp_array); } else { scale3(contact->dt, contact->vtr, temp_array); } @@ -340,6 +341,8 @@ void TangentialMindlin::calculate_forces() if (!mindlin_force) { scale3(k_scaled, history, temp_array); sub3(contact->fs, temp_array, contact->fs); + } else { + add3(contact->fs, history, contact->fs); } // rescale frictional displacements and forces if needed @@ -348,16 +351,14 @@ void TangentialMindlin::calculate_forces() shrmag = len3(history); if (shrmag != 0.0) { magfs_inv = 1.0 / magfs; - temp_dbl = Fscrit * magfs_inv; - scale3(temp_dbl, contact->fs, history); + scale3(Fscrit * magfs_inv, contact->fs, history); scale3(damp, contact->vtr, temp_array); add3(history, temp_array, history); - if (!mindlin_force) { - temp_dbl = -1.0 / k_scaled; - scale3(temp_dbl, history); - } - temp_dbl = Fscrit * magfs_inv; - scale3(temp_dbl, contact->fs); + + if (!mindlin_force) + scale3(-1.0 / k_scaled, history); + + scale3(Fscrit * magfs_inv, contact->fs); } else { zero3(contact->fs); } diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/GRANULAR/contact_twisting_models.cpp index aca4f958e7..94a88161f3 100644 --- a/src/GRANULAR/contact_twisting_models.cpp +++ b/src/GRANULAR/contact_twisting_models.cpp @@ -95,8 +95,8 @@ TwistingSDS::TwistingSDS(LAMMPS *lmp) : TwistingModel(lmp) void TwistingSDS::coeffs_to_local() { k = coeffs[0]; - mu = coeffs[1]; - damp = coeffs[2]; + damp = coeffs[1]; + mu = coeffs[2]; if (k < 0.0 || mu < 0.0 || damp < 0.0) error->all(FLERR, "Illegal SDS twisting model"); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 0d6fc587fb..c0221b0d34 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -535,6 +535,7 @@ void FixWallGran::post_force(int /*vflag*/) } // Reset model and copy initial geometric data + model->i = i; model->dx[0] = dx; model->dx[1] = dy; model->dx[2] = dz; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 2e57e335f7..93bca1485b 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -225,7 +225,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) for (int ic = 0; ic < nc; ic++) { // Reset model and copy initial geometric data - // A bit unncessary since region->contact[ic] stores r + model->i = i; model->dx[0] = region->contact[ic].delx; model->dx[1] = region->contact[ic].dely; model->dx[2] = region->contact[ic].delz; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 1e423b92b3..dddd1acdcb 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -196,6 +196,8 @@ void PairGranular::compute(int eflag, int vflag) jtype = type[j]; // Reset model and copy initial geometric data + models[itype][jtype]->i = i; + models[itype][jtype]->j = j; models[itype][jtype]->xi = x[i]; models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; @@ -214,9 +216,9 @@ void PairGranular::compute(int eflag, int vflag) continue; } - if (use_history) { + // if any history is needed + if (use_history || models[itype][jtype]->beyond_contact) { touch[jj] = 1; - history = &allhistory[size_history*jj]; } // meff = effective mass of pair of particles @@ -239,19 +241,17 @@ void PairGranular::compute(int eflag, int vflag) models[itype][jtype]->omegai = omega[i]; models[itype][jtype]->omegaj = omega[j]; models[itype][jtype]->history_update = history_update; - if (use_history) models[itype][jtype]->history = history; + if (use_history) { + history = &allhistory[size_history*jj]; + models[itype][jtype]->history = history; + } +; if (heat_flag) { models[itype][jtype]->Ti = temperature[i]; models[itype][jtype]->Tj = temperature[j]; } models[itype][jtype]->prep_contact(); - // if any history is needed - if (use_history) { - touch[jj] = 1; - history = &allhistory[size_history*jj]; - } - models[itype][jtype]->calculate_forces(); forces = models[itype][jtype]->forces; @@ -455,6 +455,7 @@ void PairGranular::init_style() for (auto &model : vec_models) { model.init(); + if (model.beyond_contact) beyond_contact = 1; if (model.size_history != 0) use_history = 1; for (i = 0; i < NSUBMODELS; i++) @@ -742,6 +743,8 @@ double PairGranular::single(int i, int j, int itype, int jtype, double *radius = atom->radius; // Reset model and copy initial geometric data + models[itype][jtype]->i = i; + models[itype][jtype]->j = j; models[itype][jtype]->xi = x[i]; models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; From cca7a5313267304a07ff8eef1bfc8793c0ebb784 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Sun, 25 Sep 2022 14:53:53 -0600 Subject: [PATCH 29/57] Patching heat implementation and adding example --- doc/src/dump.rst | 4 +- doc/src/fix_temp_integrate.rst | 2 +- doc/src/fix_wall_gran.rst | 2 +- doc/src/fix_wall_gran_region.rst | 2 +- doc/src/pair_granular.rst | 4 +- doc/src/set.rst | 2 +- examples/granular/in.pour.heat | 83 +++++++++++++++++++++++++++ src/GRANULAR/atom_vec_sphere_temp.cpp | 10 ++-- src/GRANULAR/atom_vec_sphere_temp.h | 2 +- src/GRANULAR/contact.cpp | 18 +++--- src/GRANULAR/contact_heat_models.cpp | 2 +- src/GRANULAR/fix_temp_integrate.cpp | 10 ++-- src/GRANULAR/fix_wall_gran.cpp | 43 ++++++-------- src/GRANULAR/fix_wall_gran_region.cpp | 21 ++++--- src/GRANULAR/pair_granular.cpp | 12 ++-- src/atom.cpp | 14 ++--- src/atom.h | 4 +- src/dump_custom.cpp | 22 +++---- src/dump_custom.h | 2 +- 19 files changed, 169 insertions(+), 90 deletions(-) create mode 100644 examples/granular/in.pour.heat diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 4406c827bf..c324c945ee 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -81,7 +81,7 @@ Syntax q, mux, muy, muz, mu, radius, diameter, omegax, omegay, omegaz, angmomx, angmomy, angmomz, tqx, tqy, tqz, - heatflux, temperature, + heatflow, temperature, c_ID, c_ID[I], f_ID, f_ID[I], v_name, i_name, d_name, i2_name[I], d2_name[I] @@ -108,7 +108,7 @@ Syntax omegax,omegay,omegaz = angular velocity of spherical particle angmomx,angmomy,angmomz = angular momentum of aspherical particle tqx,tqy,tqz = torque on finite-size particles - heatflux = flux of heat into particle + heatflow = flow of heat into particle temperature = temperature of particle c_ID = per-atom vector calculated by a compute with ID c_ID[I] = Ith column of per-atom array calculated by a compute with ID, I can include wildcard (see below) diff --git a/doc/src/fix_temp_integrate.rst b/doc/src/fix_temp_integrate.rst index bd06b45c6e..03fae7a872 100644 --- a/doc/src/fix_temp_integrate.rst +++ b/doc/src/fix_temp_integrate.rst @@ -62,7 +62,7 @@ not invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix requires that atoms store temperature and a heat flux +This fix requires that atoms store temperature and heat flow as defined by the :doc:`atom_style sphere/temp ` command. Related commands diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 7fa047a07f..0cc4798dd2 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -186,7 +186,7 @@ specified as v_name, where name is the variable name. In this case, the variable will be evaluated each timestep, and its value used to determine the temperature. This option must be used in conjunction with a heat conduction model defined in :doc:`pair_style granular ` -and a compatible atom style which stores temperature and a heat flux +and a compatible atom style which stores temperature and a heat flow as defined by the :doc:`atom_style sphere/temp ` command. Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 9dbf691ead..73a2e9c973 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -209,7 +209,7 @@ specified as v_name, where name is the variable name. In this case, the variable will be evaluated each timestep, and its value used to determine the temperature. This option must be used in conjunction with a heat conduction model defined in :doc:`pair_style granular ` -and a compatible atom style which stores temperature and a heat flux +and a compatible atom style which stores temperature and a heat flow as defined by the :doc:`atom_style sphere/temp ` command. Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 5856db307b..bc365814cd 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -634,7 +634,7 @@ attractive force. This keyword cannot be used with the JKR or DMT models. ---------- -The optional *heat* keyword enables heat conduction . The options currently +The optional *heat* keyword enables heat conduction. The options currently supported are: 1. *none* @@ -643,7 +643,7 @@ supported are: If the *heat* keyword is not specified, the model defaults to *none*. For *heat* *area*, the heat -:math:`Q` conducted across an interface is given by +:math:`Q` conducted between two particles is given by .. math:: diff --git a/doc/src/set.rst b/doc/src/set.rst index d11d3fc229..fdce40b72d 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -95,7 +95,7 @@ Syntax value can be an atom-style variable (see below) *density/disc* value = particle density for a 2d disc or ellipse (mass/distance\^2 units) value can be an atom-style variable (see below) - *temperature* value = particle temperature for a finite-size particle particle (temperature units)s + *temperature* value = temperature for finite-size particles (temperature units) value can be an atom-style variable (see below) *volume* value = particle volume for Peridynamic particle (distance\^3 units) value can be an atom-style variable (see below) diff --git a/examples/granular/in.pour.heat b/examples/granular/in.pour.heat new file mode 100644 index 0000000000..495a80454a --- /dev/null +++ b/examples/granular/in.pour.heat @@ -0,0 +1,83 @@ +# pour one types of particles into cylinder and oscillate +# temperature of the bottom plate + +variable name string heat_plate + +atom_style sphere/temp +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 10 +variable boxy equal 10 +variable boxz equal 50 + +variable drum_rad equal ${boxx}*0.5 +variable drum_height equal 30 + +variable xc equal 0.5*${boxx} +variable yc equal 0.5*${boxx} +variable zc equal 0.5*${boxz} + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dhi equal 2.0*${rhi} + +variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} + +variable dens equal 1.0 + +variable skin equal 0.4*${rhi} + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +create_box 2 boxreg +change_box all boundary p p f + +pair_style granular +pair_coeff * * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 + +region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in +region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in + +region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} + +fix 0 all balance 100 1.0 shift xy 5 1.1 +fix 1 all nve/sphere +fix 2 all temp/integrate constant 1.0 +fix grav all gravity 10 vector 0 0 -1 +fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} + +comm_modify vel yes + +neighbor ${skin} bin +neigh_modify delay 0 every 1 check yes + +variable oscillate equal 1.0*sin(step*0.0001) + +fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate + +thermo_style custom step atoms ke pxx pyy pzz +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 1000 ${name}.dump id type radius mass x y z temperature heatflow + +#For removal later +compute 1 all property/atom radius +variable zmax atom z+c_1>0.5*${drum_height} +group delgroup dynamic all var zmax every 10000 + +run 100000 + diff --git a/src/GRANULAR/atom_vec_sphere_temp.cpp b/src/GRANULAR/atom_vec_sphere_temp.cpp index a92486a1b5..bc3dcb7a2d 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.cpp +++ b/src/GRANULAR/atom_vec_sphere_temp.cpp @@ -33,17 +33,17 @@ AtomVecSphereTemp::AtomVecSphereTemp(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1; - atom->temperature_flag = atom->heatflux_flag = 1; + atom->temperature_flag = atom->heatflow_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = {"radius", "rmass", "omega", "torque", "temperature", "heatflux"}; + fields_grow = {"radius", "rmass", "omega", "torque", "temperature", "heatflow"}; fields_copy = {"radius", "rmass", "omega", "temperature"}; fields_comm_vel = {"omega", "temperature"}; - fields_reverse = {"torque", "heatflux"}; + fields_reverse = {"torque", "heatflow"}; fields_border = {"radius", "rmass", "temperature"}; fields_border_vel = {"radius", "rmass", "omega", "temperature"}; fields_exchange = {"radius", "rmass", "omega", "temperature"}; @@ -107,7 +107,7 @@ void AtomVecSphereTemp::grow_pointers() rmass = atom->rmass; omega = atom->omega; temperature = atom->temperature; - heatflux = atom->heatflux; + heatflow = atom->heatflow; } /* ---------------------------------------------------------------------- @@ -117,7 +117,7 @@ void AtomVecSphereTemp::grow_pointers() void AtomVecSphereTemp::force_clear(int n, size_t nbytes) { - memset(&heatflux[n], 0, nbytes); + memset(&heatflow[n], 0, nbytes); } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/atom_vec_sphere_temp.h b/src/GRANULAR/atom_vec_sphere_temp.h index 70e047a8cc..c93b0ee4dd 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.h +++ b/src/GRANULAR/atom_vec_sphere_temp.h @@ -40,7 +40,7 @@ class AtomVecSphereTemp : public AtomVec { private: double *radius, *rmass; double **omega; - double *temperature, *heatflux; + double *temperature, *heatflow; int radvary; double radius_one, rmass_one; diff --git a/src/GRANULAR/contact.cpp b/src/GRANULAR/contact.cpp index 5290f13629..ae294d7db9 100644 --- a/src/GRANULAR/contact.cpp +++ b/src/GRANULAR/contact.cpp @@ -438,16 +438,14 @@ void ContactModel::calculate_forces() scale3(-1, torquesi); if (contact_type == PAIR) copy3(torquesi, torquesj); - if (!classic_model) { - if (contact_type == PAIR) { - dist_to_contact = radi - 0.5 * delta; - scale3(dist_to_contact, torquesi); - dist_to_contact = radj - 0.5 * delta; - scale3(dist_to_contact, torquesj); - } else { - dist_to_contact = radi; - scale3(dist_to_contact, torquesi); - } + if (!classic_model && contact_type == PAIR) { + dist_to_contact = radi - 0.5 * delta; + scale3(dist_to_contact, torquesi); + dist_to_contact = radj - 0.5 * delta; + scale3(dist_to_contact, torquesj); + } else { + dist_to_contact = radi; + scale3(dist_to_contact, torquesi); } double torroll[3]; diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/GRANULAR/contact_heat_models.cpp index 00ac0c0785..1804ece9df 100644 --- a/src/GRANULAR/contact_heat_models.cpp +++ b/src/GRANULAR/contact_heat_models.cpp @@ -59,5 +59,5 @@ void HeatArea::coeffs_to_local() double HeatArea::calculate_heat() { - return conductivity * contact->area * (contact->Ti - contact->Tj); + return conductivity * contact->area * (contact->Tj - contact->Ti); } diff --git a/src/GRANULAR/fix_temp_integrate.cpp b/src/GRANULAR/fix_temp_integrate.cpp index f81442766b..e5fbae63dc 100644 --- a/src/GRANULAR/fix_temp_integrate.cpp +++ b/src/GRANULAR/fix_temp_integrate.cpp @@ -77,8 +77,8 @@ void FixTempIntegrate::init() if (!atom->temperature_flag) error->all(FLERR,"Fix temp/integrate requires atom style with temperature property"); - if (!atom->heatflux_flag) - error->all(FLERR,"Fix temp/integrate requires atom style with heatflux property"); + if (!atom->heatflow_flag) + error->all(FLERR,"Fix temp/integrate requires atom style with heatflow property"); } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void FixTempIntegrate::final_integrate() // update temperature of atoms in group double *temperature = atom->temperature; - double *heatflux = atom->heatflux; + double *heatflow = atom->heatflow; double *rmass = atom->rmass; double *mass = atom->mass; int *type = atom->type; @@ -99,12 +99,12 @@ void FixTempIntegrate::final_integrate() if (rmass) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - temperature[i] += dt * heatflux[i] / (calc_cp(i) * rmass[i]); + temperature[i] += dt * heatflow[i] / (calc_cp(i) * rmass[i]); } } else { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - temperature[i] += dt * heatflux[i] / (calc_cp(i) * mass[type[i]]); + temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); } } } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index c0221b0d34..96fbaeefb5 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -125,7 +125,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix wall/gran command, must specify " "twisting model after twisting keyword"); model->init_model(std::string(arg[iarg++]), TWISTING); - iarg += 1; iarg = model->twisting_model->parse_coeffs(arg, iarg, narg); } else if (strcmp(arg[iarg], "heat") == 0) { iarg++; @@ -133,7 +132,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix wall/gran command, must specify " "heat model after heat keyword"); model->init_model(std::string(arg[iarg++]), HEAT); - iarg += 1; iarg = model->heat_model->parse_coeffs(arg, iarg, narg); heat_flag = 1; } else if (strcmp(arg[iarg], "xplane") == 0 || @@ -211,20 +209,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wallstyle = REGION; idregion = utils::strdup(arg[iarg+1]); iarg += 2; - } else if (strcmp(arg[iarg],"temperature") == 0) { - if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); - if (utils::strmatch(arg[iarg+1], "^v_")) { - tstr = utils::strdup(arg[3] + 2); - } else { - Twall = utils::numeric(FLERR,arg[iarg+1],false,lmp); - } - Twall_defined = 1; - iarg += 2; } else wallstyle = NOSTYLE; - if (heat_flag != Twall_defined) - error->all(FLERR, "To model conduction, must define both heat model and wall temperature"); - // optional args wiggle = 0; @@ -256,9 +242,21 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 8; peratom_freq = 1; iarg += 1; + } else if (strcmp(arg[iarg],"temperature") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall/gran command"); + if (utils::strmatch(arg[iarg+1], "^v_")) { + tstr = utils::strdup(arg[iarg+1] + 2); + } else { + Twall = utils::numeric(FLERR,arg[iarg+1],false,lmp); + } + Twall_defined = 1; + iarg += 2; } else error->all(FLERR,"Illegal fix wall/gran command"); } + if (heat_flag != Twall_defined) + error->all(FLERR, "To model conduction, must define both heat model and wall temperature"); + if (wallstyle == NOSTYLE) error->all(FLERR,"No wall style defined"); if (wallstyle == XPLANE && domain->xperiodic) @@ -360,8 +358,8 @@ void FixWallGran::init() if (heat_flag) { if (!atom->temperature_flag) error->all(FLERR,"Heat conduction in fix wall/gran requires atom style with temperature property"); - if (!atom->heatflux_flag) - error->all(FLERR,"Heat conduction in fix wall/gran requires atom style with heatflux property"); + if (!atom->heatflow_flag) + error->all(FLERR,"Heat conduction in fix wall/gran requires atom style with heatflow property"); } // check for FixRigid so can extract rigid body masses @@ -408,7 +406,7 @@ void FixWallGran::post_force(int /*vflag*/) { int i,j; double dx,dy,dz,del1,del2,delxy,delr,rwall,meff; - double *forces, *torquesi, dq; + double *forces, *torquesi; double vwall[3]; double w0[3] = {0.0}; bool touchflag = false; @@ -471,11 +469,7 @@ void FixWallGran::post_force(int /*vflag*/) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; - double *temperature, *heatflux; - if (heat_flag) { - temperature = atom->temperature; - heatflux = atom->heatflux; - } + double *temperature, *heatflow; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -490,6 +484,8 @@ void FixWallGran::post_force(int /*vflag*/) model->vj = vwall; model->omegaj = w0; if (heat_flag) { + temperature = atom->temperature; + heatflow = atom->heatflow; if (tstr) Twall = input->variable->compute_equal(tvar); model->Tj = Twall; @@ -574,13 +570,12 @@ void FixWallGran::post_force(int /*vflag*/) forces = model->forces; torquesi = model->torquesi; - if (heat_flag) dq = model->dq; // apply forces & torques add3(f[i], forces, f[i]); add3(torque[i], torquesi, torque[i]); - if (heat_flag) heatflux[i] += dq; + if (heat_flag) heatflow[i] += model->dq; // store contact info if (peratom_flag) { diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 93bca1485b..2f57d90ad6 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -22,11 +22,13 @@ #include "comm.h" #include "domain.h" #include "error.h" +#include "input.h" #include "memory.h" #include "neighbor.h" #include "math_extra.h" #include "region.h" #include "update.h" +#include "variable.h" #include @@ -124,7 +126,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) { int i, m, nc, iwall; double dx, dy, dz, meff; - double *forces, *torquesi, dq; + double *forces, *torquesi; double vwall[3]; double w0[3] = {0.0}; bool touchflag = false; @@ -167,11 +169,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; - double *temperature, *heatflux; - if (heat_flag) { - temperature = atom->temperature; - heatflux = atom->heatflux; - } + double *temperature, *heatflow; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -188,7 +186,13 @@ void FixWallGranRegion::post_force(int /*vflag*/) // Define constant wall properties (atom j) model->radj = 0.0; model->omegaj = w0; - if (heat_flag) model->Tj = Twall; + if (heat_flag) { + temperature = atom->temperature; + heatflow = atom->heatflow; + if (tstr) + Twall = input->variable->compute_equal(tvar); + model->Tj = Twall; + } for (i = 0; i < nlocal; i++) { if (! mask[i] & groupbit) continue; @@ -269,13 +273,12 @@ void FixWallGranRegion::post_force(int /*vflag*/) forces = model->forces; torquesi = model->torquesi; - if (heat_flag) dq = model->dq; // apply forces & torques add3(f[i], forces, f[i]); add3(torque[i], torquesi, torque[i]); - if (heat_flag) heatflux[i] += dq; + if (heat_flag) heatflow[i] += model->dq; // store contact info if (peratom_flag) { diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index dddd1acdcb..63354a4eda 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -161,9 +161,9 @@ void PairGranular::compute(int eflag, int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; double *special_lj = force->special_lj; - double *heatflux, *temperature; + double *heatflow, *temperature; if (heat_flag) { - heatflux = atom->heatflux; + heatflow = atom->heatflow; temperature = atom->temperature; } @@ -265,13 +265,13 @@ void PairGranular::compute(int eflag, int vflag) scale3(factor_lj, torquesi); add3(torque[i], torquesi, torque[i]); - if (heat_flag) heatflux[i] += dq; + if (heat_flag) heatflow[i] += dq; if (force->newton_pair || j < nlocal) { sub3(f[j], forces, f[j]); scale3(factor_lj, torquesj); add3(torque[j], torquesj, torque[j]); - if (heat_flag) heatflux[j] -= dq; + if (heat_flag) heatflow[j] -= dq; } if (evflag) { @@ -446,8 +446,8 @@ void PairGranular::init_style() if (heat_flag) { if (!atom->temperature_flag) error->all(FLERR,"Heat conduction in pair granular requires atom style with temperature property"); - if (!atom->heatflux_flag) - error->all(FLERR,"Heat conduction in pair granular requires atom style with heatflux property"); + if (!atom->heatflow_flag) + error->all(FLERR,"Heat conduction in pair granular requires atom style with heatflow property"); } // allocate history and initialize models diff --git a/src/atom.cpp b/src/atom.cpp index ce66742779..5e462dd8bd 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -124,7 +124,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) ellipsoid = line = tri = body = nullptr; quat = nullptr; temperature = nullptr; - heatflux = nullptr; + heatflow = nullptr; // molecular systems @@ -413,7 +413,7 @@ void Atom::peratom_create() add_peratom("body",&body,INT,0); add_peratom("temperature",&temperature,DOUBLE,0); - add_peratom("heatflux",&heatflux,DOUBLE,0); + add_peratom("heatflow",&heatflow,DOUBLE,0); // BPM package @@ -617,7 +617,7 @@ void Atom::set_atomflag_defaults() molecule_flag = molindex_flag = molatom_flag = 0; q_flag = mu_flag = 0; rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0; - temperature_flag = heatflux_flag = 0; + temperature_flag = heatflow_flag = 0; vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0; cs_flag = csforce_flag = vforce_flag = ervelforce_flag = etag_flag = 0; rho_flag = esph_flag = cv_flag = vest_flag = 0; @@ -2612,10 +2612,10 @@ length of the data area, and a short description. - double - 1 - temperature of the particles - * - heatflux + * - heatflow - double - 1 - - heatflux of the particles + - heatflow of the particles * - i_name - int - 1 @@ -2673,7 +2673,7 @@ void *Atom::extract(const char *name) if (strcmp(name,"body") == 0) return (void *) body; if (strcmp(name,"quat") == 0) return (void *) quat; if (strcmp(name,"temperature") == 0) return (void *) temperature; - if (strcmp(name,"heatflux") == 0) return (void *) heatflux; + if (strcmp(name,"heatflow") == 0) return (void *) heatflow; if (strcmp(name,"vfrac") == 0) return (void *) vfrac; if (strcmp(name,"s0") == 0) return (void *) s0; @@ -2798,7 +2798,7 @@ int Atom::extract_datatype(const char *name) if (strcmp(name,"body") == 0) return LAMMPS_INT; if (strcmp(name,"quat") == 0) return LAMMPS_DOUBLE_2D; if (strcmp(name,"temperature") == 0) return LAMMPS_DOUBLE; - if (strcmp(name,"heatflux") == 0) return LAMMPS_DOUBLE; + if (strcmp(name,"heatflow") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"vfrac") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"s0") == 0) return LAMMPS_DOUBLE; diff --git a/src/atom.h b/src/atom.h index 7ac459317c..bfb79d4366 100644 --- a/src/atom.h +++ b/src/atom.h @@ -80,7 +80,7 @@ class Atom : protected Pointers { double **omega, **angmom, **torque; int *ellipsoid, *line, *tri, *body; double **quat; - double *temperature, *heatflux; + double *temperature, *heatflow; // molecular systems @@ -183,7 +183,7 @@ class Atom : protected Pointers { int molecule_flag, molindex_flag, molatom_flag; int q_flag, mu_flag; int rmass_flag, radius_flag, omega_flag, torque_flag, angmom_flag, quat_flag; - int temperature_flag, heatflux_flag; + int temperature_flag, heatflow_flag; int vfrac_flag, spin_flag, eradius_flag, ervel_flag, erforce_flag; int cs_flag, csforce_flag, vforce_flag, ervelforce_flag, etag_flag; int rho_flag, esph_flag, cv_flag, vest_flag; diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index a74e91c889..cc4fdbe20b 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -41,7 +41,7 @@ enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS, XSU,YSU,ZSU,XSUTRI,YSUTRI,ZSUTRI, IX,IY,IZ, VX,VY,VZ,FX,FY,FZ, - Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,HEATFLUX,TEMPERATURE, + Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,heatflow,TEMPERATURE, OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ, TQX,TQY,TQZ, COMPUTE,FIX,VARIABLE,IVEC,DVEC,IARRAY,DARRAY}; @@ -930,11 +930,11 @@ int DumpCustom::count() for (i = 0; i < nlocal; i++) dchoose[i] = 2.0*radius[i]; ptr = dchoose; nstride = 1; - } else if (thresh_array[ithresh] == HEATFLUX) { - if (!atom->heatflux_flag) + } else if (thresh_array[ithresh] == heatflow) { + if (!atom->heatflow_flag) error->all(FLERR, "Threshold for an atom property that isn't allocated"); - ptr = atom->heatflux; + ptr = atom->heatflow; nstride = 1; } else if (thresh_array[ithresh] == TEMPERATURE) { if (!atom->temperature_flag) @@ -1392,10 +1392,10 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Dumping an atom property that isn't allocated"); pack_choice[iarg] = &DumpCustom::pack_diameter; vtype[iarg] = Dump::DOUBLE; - } else if (strcmp(arg[iarg],"heatflux") == 0) { - if (!atom->heatflux_flag) + } else if (strcmp(arg[iarg],"heatflow") == 0) { + if (!atom->heatflow_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); - pack_choice[iarg] = &DumpCustom::pack_heatflux; + pack_choice[iarg] = &DumpCustom::pack_heatflow; vtype[iarg] = Dump::DOUBLE; } else if (strcmp(arg[iarg],"temperature") == 0) { if (!atom->temperature_flag) @@ -1867,7 +1867,7 @@ int DumpCustom::modify_param(int narg, char **arg) else if (strcmp(arg[1],"radius") == 0) thresh_array[nthresh] = RADIUS; else if (strcmp(arg[1],"diameter") == 0) thresh_array[nthresh] = DIAMETER; - else if (strcmp(arg[1],"heatflux") == 0) thresh_array[nthresh] = HEATFLUX; + else if (strcmp(arg[1],"heatflow") == 0) thresh_array[nthresh] = heatflow; else if (strcmp(arg[1],"temperature") == 0) thresh_array[nthresh] = TEMPERATURE; else if (strcmp(arg[1],"omegax") == 0) thresh_array[nthresh] = OMEGAX; else if (strcmp(arg[1],"omegay") == 0) thresh_array[nthresh] = OMEGAY; @@ -2783,12 +2783,12 @@ void DumpCustom::pack_diameter(int n) /* ---------------------------------------------------------------------- */ -void DumpCustom::pack_heatflux(int n) +void DumpCustom::pack_heatflow(int n) { - double *heatflux = atom->heatflux; + double *heatflow = atom->heatflow; for (int i = 0; i < nchoose; i++) { - buf[n] = heatflux[clist[i]]; + buf[n] = heatflow[clist[i]]; n += size_one; } } diff --git a/src/dump_custom.h b/src/dump_custom.h index fd4fd413c3..eeae415dd2 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -193,7 +193,7 @@ class DumpCustom : public Dump { void pack_mu(int); void pack_radius(int); void pack_diameter(int); - void pack_heatflux(int); + void pack_heatflow(int); void pack_temperature(int); void pack_omegax(int); From 955fbe46d12c12070a4068728cf310f9990608e9 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 26 Oct 2022 22:25:58 -0600 Subject: [PATCH 30/57] Renaming classes, adjusting initialization --- src/.gitignore | 32 +- src/GRANULAR/fix_wall_gran.cpp | 65 +-- src/GRANULAR/fix_wall_gran.h | 4 +- src/GRANULAR/fix_wall_gran_region.cpp | 5 +- src/GRANULAR/granular_model.cpp | 498 ++++++++++++++++++ src/GRANULAR/granular_model.h | 107 ++++ src/GRANULAR/gsm.cpp | 127 +++++ src/GRANULAR/gsm.h | 61 +++ src/GRANULAR/gsm_damping.cpp | 113 ++++ src/GRANULAR/gsm_damping.h | 79 +++ src/GRANULAR/gsm_heat.cpp | 63 +++ src/GRANULAR/gsm_heat.h | 53 ++ src/GRANULAR/gsm_normal.cpp | 377 +++++++++++++ src/GRANULAR/gsm_normal.h | 118 +++++ src/GRANULAR/gsm_rolling.cpp | 121 +++++ src/GRANULAR/gsm_rolling.h | 53 ++ src/GRANULAR/gsm_tangential.cpp | 412 +++++++++++++++ src/GRANULAR/gsm_tangential.h | 113 ++++ src/GRANULAR/gsm_twisting.cpp | 124 +++++ src/GRANULAR/gsm_twisting.h | 64 +++ src/GRANULAR/pair_granular.cpp | 97 +--- src/GRANULAR/pair_granular.h | 8 +- src/{GRANULAR => }/contact.cpp | 0 src/{GRANULAR => }/contact.h | 0 src/{GRANULAR => }/contact_damping_models.cpp | 0 src/{GRANULAR => }/contact_damping_models.h | 0 src/{GRANULAR => }/contact_heat_models.cpp | 0 src/{GRANULAR => }/contact_heat_models.h | 0 src/{GRANULAR => }/contact_normal_models.cpp | 0 src/{GRANULAR => }/contact_normal_models.h | 0 src/{GRANULAR => }/contact_rolling_models.cpp | 0 src/{GRANULAR => }/contact_rolling_models.h | 0 src/{GRANULAR => }/contact_sub_models.cpp | 0 src/{GRANULAR => }/contact_sub_models.h | 0 .../contact_tangential_models.cpp | 0 .../contact_tangential_models.h | 0 .../contact_twisting_models.cpp | 0 src/{GRANULAR => }/contact_twisting_models.h | 0 38 files changed, 2545 insertions(+), 149 deletions(-) create mode 100644 src/GRANULAR/granular_model.cpp create mode 100644 src/GRANULAR/granular_model.h create mode 100644 src/GRANULAR/gsm.cpp create mode 100644 src/GRANULAR/gsm.h create mode 100644 src/GRANULAR/gsm_damping.cpp create mode 100644 src/GRANULAR/gsm_damping.h create mode 100644 src/GRANULAR/gsm_heat.cpp create mode 100644 src/GRANULAR/gsm_heat.h create mode 100644 src/GRANULAR/gsm_normal.cpp create mode 100644 src/GRANULAR/gsm_normal.h create mode 100644 src/GRANULAR/gsm_rolling.cpp create mode 100644 src/GRANULAR/gsm_rolling.h create mode 100644 src/GRANULAR/gsm_tangential.cpp create mode 100644 src/GRANULAR/gsm_tangential.h create mode 100644 src/GRANULAR/gsm_twisting.cpp create mode 100644 src/GRANULAR/gsm_twisting.h rename src/{GRANULAR => }/contact.cpp (100%) rename src/{GRANULAR => }/contact.h (100%) rename src/{GRANULAR => }/contact_damping_models.cpp (100%) rename src/{GRANULAR => }/contact_damping_models.h (100%) rename src/{GRANULAR => }/contact_heat_models.cpp (100%) rename src/{GRANULAR => }/contact_heat_models.h (100%) rename src/{GRANULAR => }/contact_normal_models.cpp (100%) rename src/{GRANULAR => }/contact_normal_models.h (100%) rename src/{GRANULAR => }/contact_rolling_models.cpp (100%) rename src/{GRANULAR => }/contact_rolling_models.h (100%) rename src/{GRANULAR => }/contact_sub_models.cpp (100%) rename src/{GRANULAR => }/contact_sub_models.h (100%) rename src/{GRANULAR => }/contact_tangential_models.cpp (100%) rename src/{GRANULAR => }/contact_tangential_models.h (100%) rename src/{GRANULAR => }/contact_twisting_models.cpp (100%) rename src/{GRANULAR => }/contact_twisting_models.h (100%) diff --git a/src/.gitignore b/src/.gitignore index 07230a10b4..7c2b502f67 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1472,22 +1472,6 @@ /compute_xrd.cpp /compute_xrd.h /compute_xrd_consts.h -/contact.cpp -/contact.h -/contact_normal_models.cpp -/contact_normal_models.h -/contact_damping_models.cpp -/contact_damping_models.h -/contact_tangential_models.cpp -/contact_tangential_models.h -/contact_twisting_models.cpp -/contact_twisting_models.h -/contact_rolling_models.cpp -/contact_rolling_models.h -/contact_heat_models.cpp -/contact_heat_models.h -/contact_sub_models.cpp -/contact_sub_models.h /fix_atom_swap.cpp /fix_atom_swap.h /fix_ave_spatial_sphere.cpp @@ -1536,6 +1520,22 @@ /fix_ttm_grid.h /fix_ttm_mod.cpp /fix_ttm_mod.h +/granular_model.cpp +/granular_model.h +/gsm_normal.cpp +/gsm_normal.h +/gsm_damping.cpp +/gsm_damping.h +/gsm_tangential.cpp +/gsm_tangential.h +/gsm_twisting.cpp +/gsm_twisting.h +/gsm_rolling.cpp +/gsm_rolling.h +/gsm_heat.cpp +/gsm_heat.h +/gsm.cpp +/gsm.h /pair_born_coul_long_cs.cpp /pair_born_coul_long_cs.h /pair_born_coul_dsf_cs.cpp diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 96fbaeefb5..31913c6061 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -20,14 +20,8 @@ #include "fix_wall_gran.h" #include "atom.h" -#include "contact.h" -#include "contact_sub_models.h" -#include "contact_normal_models.h" -#include "contact_tangential_models.h" -#include "contact_damping_models.h" -#include "contact_rolling_models.h" -#include "contact_twisting_models.h" -#include "contact_heat_models.h" +#include "granular_model.h" +#include "gsm.h" #include "domain.h" #include "error.h" #include "input.h" @@ -43,7 +37,7 @@ #include using namespace LAMMPS_NS; -using namespace Contact; +using namespace Granular_NS; using namespace FixConst; using namespace MathConst; using namespace MathExtra; @@ -70,7 +64,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // set interaction style // disable bonded/history option for now - model = new ContactModel(lmp); + model = new GranularModel(lmp); model->contact_type = WALL; if (strcmp(arg[3],"granular") == 0) classic_flag = 0; @@ -94,45 +88,19 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } else { iarg = 4; - model->init_model(std::string(arg[iarg++]), NORMAL); - iarg = model->normal_model->parse_coeffs(arg, iarg, narg); + iarg = model->init_submodel(arg, iarg, narg, NORMAL); while (iarg < narg) { if (strcmp(arg[iarg], "damping") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal fix wall/gran command, must specify " - "damping model after damping keyword"); - model->init_model(std::string(arg[iarg++]), DAMPING); - iarg = model->damping_model->parse_coeffs(arg, iarg, narg); + iarg = model->init_submodel(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "tangential") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal fix wall/gran command, must specify " - "tangential model after tangential keyword"); - model->init_model(std::string(arg[iarg++]), TANGENTIAL); - iarg = model->tangential_model->parse_coeffs(arg, iarg, narg); + iarg = model->init_submodel(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal fix wall/gran command, must specify " - "rolling model after rolling keyword"); - model->init_model(std::string(arg[iarg++]), ROLLING); - iarg = model->rolling_model->parse_coeffs(arg, iarg, narg); + iarg = model->init_submodel(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal fix wall/gran command, must specify " - "twisting model after twisting keyword"); - model->init_model(std::string(arg[iarg++]), TWISTING); - iarg = model->twisting_model->parse_coeffs(arg, iarg, narg); + iarg = model->init_submodel(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal fix wall/gran command, must specify " - "heat model after heat keyword"); - model->init_model(std::string(arg[iarg++]), HEAT); - iarg = model->heat_model->parse_coeffs(arg, iarg, narg); + iarg = model->init_submodel(arg, iarg + 1, narg, HEAT); heat_flag = 1; } else if (strcmp(arg[iarg], "xplane") == 0 || strcmp(arg[iarg], "yplane") == 0 || @@ -151,14 +119,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // Define default damping model if unspecified, takes no args if (!model->damping_model) - model->init_model("viscoelastic", DAMPING); - - //Dan original code didn't require tangential? - if (!model->tangential_model) error->all(FLERR, "No tangential?"); - - if (model->limit_damping && !model->normal_model->allow_limit_damping) - error->all(FLERR,"Illegal pair_coeff command, " - "Cannot limit damping with specified normal contact model"); + model->construct_submodel("viscoelastic", DAMPING); + if (!model->tangential_model) error->all(FLERR, "No tangential model specified"); model->init(); @@ -546,7 +508,7 @@ void FixWallGran::post_force(int /*vflag*/) for (j = 0; j < size_history; j++) history_one[i][j] = 0.0; continue; - } // Dan: I tried to simplify this logic, not sure it's 100% correct + } if (model->beyond_contact) history_one[i][0] = 1; @@ -564,7 +526,6 @@ void FixWallGran::post_force(int /*vflag*/) model->history_update = history_update; if (use_history) model->history = history_one[i]; if (heat_flag) model->Ti = temperature[i]; - model->prep_contact(); model->calculate_forces(); diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index fd4a0a0ec8..73c95becc4 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -20,7 +20,7 @@ FixStyle(wall/gran,FixWallGran); #ifndef LMP_FIX_WALL_GRAN_H #define LMP_FIX_WALL_GRAN_H -#include "contact.h" +#include "granular_model.h" #include "fix.h" namespace LAMMPS_NS { @@ -53,7 +53,7 @@ class FixWallGran : public Fix { bigint time_origin; // for granular model choices - Contact::ContactModel *model; + Granular_NS::GranularModel *model; double lo, hi, cylradius; double amplitude, period, omega, vshear; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 2f57d90ad6..ddafb316c0 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -18,7 +18,7 @@ #include "fix_wall_gran_region.h" #include "atom.h" -#include "contact.h" +#include "granular_model.h" #include "comm.h" #include "domain.h" #include "error.h" @@ -33,7 +33,7 @@ #include using namespace LAMMPS_NS; -using namespace Contact; +using namespace Granular_NS; using namespace FixConst; using namespace MathExtra; @@ -267,7 +267,6 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (use_history) model->history = history_many[i][c2r[ic]]; if (heat_flag) model->Ti = temperature[i]; - model->prep_contact(); model->calculate_forces(); diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp new file mode 100644 index 0000000000..b5987d222b --- /dev/null +++ b/src/GRANULAR/granular_model.cpp @@ -0,0 +1,498 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This class contains a series of tools for DEM contacts + Multiple models can be defined and used to calculate forces + and torques based on contact geometry + + Contributing authors: + Dan Bolintineanu (SNL), Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + +#include "granular_model.h" +#include "gsm.h" +#include "gsm_normal.h" +#include "gsm_tangential.h" +#include "gsm_damping.h" +#include "gsm_rolling.h" +#include "gsm_twisting.h" +#include "gsm_heat.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_extra.h" + +#include + +using namespace LAMMPS_NS; +using namespace Granular_NS; +using namespace MathExtra; + +GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) +{ + limit_damping = 0; + beyond_contact = 0; + nondefault_history_transfer = 0; + classic_model = 0; + contact_type = PAIR; + + normal_model = nullptr; + damping_model = nullptr; + tangential_model = nullptr; + rolling_model = nullptr; + twisting_model = nullptr; + heat_model = nullptr; + + for (int i = 0; i < NSUBMODELS; i++) sub_models[i] = nullptr; + transfer_history_factor = nullptr; +} + +/* ---------------------------------------------------------------------- */ + +GranularModel::~GranularModel() +{ + delete [] transfer_history_factor; + + delete normal_model; + delete damping_model; + delete tangential_model; + delete rolling_model; + delete twisting_model; + delete heat_model; +} + +/* ---------------------------------------------------------------------- */ + +int GranularModel::init_submodel(char **arg, int iarg, int narg, SubmodelType model_type) +{ + if (iarg >= narg) + error->all(FLERR, "Must specify granular submodel name"); + + std::string model_name = std::string(arg[iarg++]); + construct_submodel(model_name, model_type); + + int num_coeffs = sub_models[model_type]->num_coeffs; + if (iarg + num_coeffs > narg) + error->all(FLERR, "Insufficient arguments provided for {} model", model_name); + + for (int i = 0; i < num_coeffs; i++) { + // A few parameters (eg.g kt for tangential mindlin) allow null + if (strcmp(arg[iarg + i], "NULL") == 0) sub_models[model_type]->coeffs[i] = -1; + else sub_models[model_type]->coeffs[i] = utils::numeric(FLERR,arg[iarg + i],false,lmp); + } + sub_models[model_type]->coeffs_to_local(); + + return iarg + num_coeffs; +} + +/* ---------------------------------------------------------------------- */ + +void GranularModel::construct_submodel(std::string model_name, SubmodelType model_type) +{ +if (model_type == NORMAL) { + delete normal_model; + if (model_name == "none") normal_model = new GSMNormalNone(this, lmp); + else if (model_name == "hooke") normal_model = new GSMNormalHooke(this, lmp); + else if (model_name == "hertz") normal_model = new GSMNormalHertz(this, lmp); + else if (model_name == "hertz/material") normal_model = new GSMNormalHertzMaterial(this, lmp); + else if (model_name == "dmt") normal_model = new GSMNormalDMT(this, lmp); + else if (model_name == "jkr") normal_model = new GSMNormalJKR(this, lmp); + else error->all(FLERR, "Normal model name {} not recognized", model_name); + sub_models[model_type] = normal_model; + + } else if (model_type == TANGENTIAL) { + delete tangential_model; + if (model_name == "none") tangential_model = new GSMTangentialNone(this, lmp); + else if (model_name == "linear_nohistory") tangential_model = new GSMTangentialLinearNoHistory(this, lmp); + else if (model_name == "linear_history") tangential_model = new GSMTangentialLinearHistory(this, lmp); + else if (model_name == "linear_history_classic") tangential_model = new GSMTangentialLinearHistoryClassic(this, lmp); + else if (model_name == "mindlin") tangential_model = new GSMTangentialMindlin(this, lmp); + else if (model_name == "mindlin/force") tangential_model = new GSMTangentialMindlinForce(this, lmp); + else if (model_name == "mindlin_rescale") tangential_model = new GSMTangentialMindlinRescale(this, lmp); + else if (model_name == "mindlin_rescale/force") tangential_model = new GSMTangentialMindlinRescaleForce(this, lmp); + else error->all(FLERR, "Tangential model name {} not recognized", model_name); + sub_models[model_type] = tangential_model; + + } else if (model_type == DAMPING) { + delete damping_model; + if (model_name == "none") damping_model = new GSMDampingNone(this, lmp); + else if (model_name == "velocity") damping_model = new GSMDampingVelocity(this, lmp); + else if (model_name == "mass_velocity") damping_model = new GSMDampingMassVelocity(this, lmp); + else if (model_name == "viscoelastic") damping_model = new GSMDampingViscoelastic(this, lmp); + else if (model_name == "tsuji") damping_model = new GSMDampingTsuji(this, lmp); + else error->all(FLERR, "Damping model name {} not recognized", model_name); + sub_models[model_type] = damping_model; + + } else if (model_type == ROLLING) { + delete rolling_model; + rolling_defined = 1; + if (model_name == "none") { + rolling_model = new GSMRollingNone(this, lmp); + rolling_defined = 0; + } else if (model_name == "sds") rolling_model = new GSMRollingSDS(this, lmp); + else error->all(FLERR, "Rolling model name {} not recognized", model_name); + sub_models[model_type] = rolling_model; + + } else if (model_type == TWISTING) { + delete twisting_model; + twisting_defined = 1; + if (model_name == "none") { + twisting_model = new GSMTwistingNone(this, lmp); + twisting_defined = 0; + } else if (model_name == "sds") twisting_model = new GSMTwistingSDS(this, lmp); + else if (model_name == "marshall") twisting_model = new GSMTwistingMarshall(this, lmp); + else error->all(FLERR, "Twisting model name {} not recognized", model_name); + sub_models[model_type] = twisting_model; + + } else if (model_type == HEAT) { + delete heat_model; + heat_defined = 1; + if (model_name == "none") { + heat_model = new GSMHeatNone(this, lmp); + heat_defined = 0; + } else if (model_name == "area") heat_model = new GSMHeatArea(this, lmp); + else error->all(FLERR, "Heat model name not {} recognized", model_name); + sub_models[model_type] = heat_model; + } else { + error->all(FLERR, "Illegal model type {}", model_type); + } + + sub_models[model_type]->name.assign(model_name); +} + +/* ---------------------------------------------------------------------- */ + +int GranularModel::init_classic_model(char **arg, int iarg, int narg) +{ + double kn, kt, gamman, gammat, xmu; + + classic_model = 1; + + if (iarg + 6 >= narg) + error->all(FLERR,"Insufficient arguments provided for classic gran model command"); + + kn = utils::numeric(FLERR,arg[iarg + 1],false,lmp); + if (strcmp(arg[iarg + 2],"NULL") == 0) kt = kn * 2.0 / 7.0; + else kt = utils::numeric(FLERR,arg[iarg + 2],false,lmp); + + gamman = utils::numeric(FLERR,arg[iarg + 3],false,lmp); + if (strcmp(arg[iarg + 4],"NULL") == 0) gammat = 0.5 * gamman; + else gammat = utils::numeric(FLERR,arg[iarg + 4],false,lmp); + + xmu = utils::numeric(FLERR,arg[iarg + 5],false,lmp); + int dampflag = utils::inumeric(FLERR,arg[iarg + 6],false,lmp); + if (dampflag == 0) gammat = 0.0; + + if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || + xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) + error->all(FLERR,"Illegal classic gran model command"); + + if (strcmp(arg[iarg],"hooke") == 0) { + construct_submodel("hooke", NORMAL); + construct_submodel("linear_nohistory", TANGENTIAL); + construct_submodel("mass_velocity", DAMPING); + } else if (strcmp(arg[iarg],"hooke/history") == 0) { + construct_submodel("hooke", NORMAL); + construct_submodel("linear_history_classic", TANGENTIAL); + construct_submodel("mass_velocity", DAMPING); + } else if (strcmp(arg[iarg],"hertz/history") == 0) { + // convert Kn and Kt from pressure units to force/distance^2 if Hertzian + kn /= force->nktv2p; + kt /= force->nktv2p; + construct_submodel("hertz", NORMAL); + construct_submodel("mindlin", TANGENTIAL); + construct_submodel("viscoelastic", DAMPING); + } else error->all(FLERR,"Invalid classic gran model"); + + // ensure additional models are undefined + construct_submodel("none", ROLLING); + construct_submodel("none", TWISTING); + construct_submodel("none", HEAT); + + // manually parse coeffs + normal_model->coeffs[0] = kn; + normal_model->coeffs[1] = gamman; + tangential_model->coeffs[0] = kt; + tangential_model->coeffs[1] = gammat / gamman; + tangential_model->coeffs[2] = xmu; + + normal_model->coeffs_to_local(); + tangential_model->coeffs_to_local(); + damping_model->coeffs_to_local(); + + iarg += 7; + return iarg; +} + +/* ---------------------------------------------------------------------- */ + +void GranularModel::init() +{ + int i, j; + for (i = 0; i < NSUBMODELS; i++) + if (!sub_models[i]) construct_submodel("none", (SubmodelType) i); + + // Must have valid normal, damping, and tangential models + if (normal_model->name == "none") error->all(FLERR, "Must specify normal granular model"); + if (damping_model->name == "none") error->all(FLERR, "Must specify damping granular model"); + if (tangential_model->name == "none") error->all(FLERR, "Must specify tangential granular model"); + + int size_cumulative; + size_history = 0; + for (i = 0; i < NSUBMODELS; i++) { + if (sub_models[i]->nondefault_history_transfer) + nondefault_history_transfer = 1; + if (sub_models[i]->beyond_contact) + beyond_contact = 1; + size_history += sub_models[i]->size_history; + if (limit_damping && (!sub_models[i]->allow_limit_damping)) + error->all(FLERR,"Cannot limit damping with {} model", sub_models[i]->name); + } + + if (nondefault_history_transfer) { + transfer_history_factor = new double[size_history]; + + for (i = 0; i < size_history; i++) { + // Find which model owns this history value + size_cumulative = 0; + for (j = 0; j < NSUBMODELS; j++) { + if (size_cumulative + sub_models[j]->size_history > i) break; + size_cumulative += sub_models[j]->size_history; + } + + // Check if model has nondefault transfers, if so copy its array + transfer_history_factor[i] = -1; + if (j != NSUBMODELS) { + if (sub_models[j]->nondefault_history_transfer) { + transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; + } + } + } + } + + for (i = 0; i < NSUBMODELS; i++) sub_models[i]->init(); +} + +/* ---------------------------------------------------------------------- */ + +int GranularModel::mix_coeffs(GranularModel *g1, GranularModel *g2) +{ + int i; + for (i = 0; i < NSUBMODELS; i++) { + if (g1->sub_models[i]->name != g2->sub_models[i]->name) return i; + + construct_submodel(g1->sub_models[i]->name, (SubmodelType) i); + sub_models[i]->mix_coeffs(g1->sub_models[i]->coeffs, g2->sub_models[i]->coeffs); + } + + limit_damping = MAX(g1->limit_damping, g2->limit_damping); + + return -1; +} + +/* ---------------------------------------------------------------------- */ + +void GranularModel::write_restart(FILE *fp) +{ + int num_char, num_coeffs; + + for (int i = 0; i < NSUBMODELS; i++) { + num_char = sub_models[i]->name.length(); + num_coeffs = sub_models[i]->num_coeffs; + fwrite(&num_char, sizeof(int), 1, fp); + fwrite(sub_models[i]->name.data(), sizeof(char), num_char, fp); + fwrite(&num_coeffs, sizeof(int), 1, fp); + fwrite(sub_models[i]->coeffs, sizeof(double), num_coeffs, fp); + } +} + +/* ---------------------------------------------------------------------- */ + +void GranularModel::read_restart(FILE *fp) +{ + int num_char, num_coeff; + + for (int i = 0; i < NSUBMODELS; i++) { + if (comm->me == 0) + utils::sfread(FLERR, &num_char, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&num_char, 1, MPI_INT, 0, world); + + std::string model_name (num_char, ' '); + if (comm->me == 0) + utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); + MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); + + construct_submodel(model_name, (SubmodelType) i); + + if (comm->me == 0) { + utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); + if (num_coeff != sub_models[i]->num_coeffs) + error->one(FLERR, "Invalid granular model written to restart file"); + } + MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); + + if (comm->me == 0) { + utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(double), num_coeff, fp, nullptr, error); + } + MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); + sub_models[i]->coeffs_to_local(); + } +} + +/* ---------------------------------------------------------------------- */ + +bool GranularModel::check_contact() +{ + if (contact_type == WALL) { + // Used by fix_wall_gran.cpp + // radj = radius of wall + // dx already provided + rsq = lensq3(dx); + radsum = radi; + if (radj == 0) Reff = radi; + else Reff = radi * radj / (radi + radj); + } else if (contact_type == WALLREGION) { + // Used by fix_wall_gran_region.cpp + // radj = radius of wall + // dx and r already provided + rsq = r * r; + radsum = radi; + if (radj == 0) Reff = radi; + else Reff = radi * radj / (radi + radj); + } else { + sub3(xi, xj, dx); + rsq = lensq3(dx); + radsum = radi + radj; + Reff = radi * radj / radsum; + } + + touch = normal_model->touch(); + return touch; +} + +/* ---------------------------------------------------------------------- */ + +void GranularModel::calculate_forces() +{ + double temp[3]; + + // Standard geometric quantities + if (contact_type != WALLREGION) r = sqrt(rsq); + rinv = 1.0 / r; + delta = radsum - r; + dR = delta * Reff; + scale3(rinv, dx, nx); + + // relative translational velocity + sub3(vi, vj, vr); + + // normal component + vnnr = dot3(vr, nx); //v_R . n + scale3(vnnr, nx, vn); + + // tangential component + sub3(vr, vn, vt); + + // relative rotational velocity + scaleadd3(radi, omegai, radj, omegaj, wr); + + // relative tangential velocities + cross3(wr, nx, temp); + sub3(vt, temp, vtr); + vrel = len3(vtr); + + if (rolling_defined || twisting_defined) + sub3(omegai, omegaj, relrot); + + if (rolling_defined) { + // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) + vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); + vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); + vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); + } + + if (twisting_defined) { + // omega_T (eq 29 of Marshall) + magtwist = dot3(relrot, nx); + } + + // calculate forces/torques + + forces[0] = 0.0; + double Fne, Fdamp, dist_to_contact; + area = normal_model->calculate_area(); + normal_model->set_knfac(); + Fne = normal_model->calculate_forces(); + + Fdamp = damping_model->calculate_forces(); + Fntot = Fne + Fdamp; + if (limit_damping && Fntot < 0.0) Fntot = 0.0; + + normal_model->set_fncrit(); // Needed for tangential, rolling, twisting + tangential_model->calculate_forces(); + if (rolling_defined) rolling_model->calculate_forces(); + if (twisting_defined) twisting_model->calculate_forces(); + + // sum contributions + + scale3(Fntot, nx, forces); + add3(forces, fs, forces); + + //May need to rethink eventually tris.. + cross3(nx, fs, torquesi); + scale3(-1, torquesi); + if (contact_type == PAIR) copy3(torquesi, torquesj); + + if (!classic_model && contact_type == PAIR) { + dist_to_contact = radi - 0.5 * delta; + scale3(dist_to_contact, torquesi); + dist_to_contact = radj - 0.5 * delta; + scale3(dist_to_contact, torquesj); + } else { + dist_to_contact = radi; + scale3(dist_to_contact, torquesi); + } + + double torroll[3]; + if (rolling_defined) { + cross3(nx, fr, torroll); + scale3(Reff, torroll); + add3(torquesi, torroll, torquesi); + if (contact_type == PAIR) sub3(torquesj, torroll, torquesj); + } + + double tortwist[3]; + if (twisting_defined) { + scale3(magtortwist, nx, tortwist); + add3(torquesi, tortwist, torquesi); + if (contact_type == PAIR) sub3(torquesj, tortwist, torquesj); + } + + if (heat_defined) { + dq = heat_model->calculate_heat(); + } +} + +/* ---------------------------------------------------------------------- + compute pull-off distance (beyond contact) for a given radius and atom type + use temporary variables since this does not use a specific contact geometry +------------------------------------------------------------------------- */ + +double GranularModel::pulloff_distance(double radi, double radj) +{ + return normal_model->pulloff_distance(radi, radj); +} diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h new file mode 100644 index 0000000000..cc94f49a1e --- /dev/null +++ b/src/GRANULAR/granular_model.h @@ -0,0 +1,107 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_GRANULAR_MODEL_H +#define LMP_GRANULAR_MODEL_H + +#include "pointers.h" // IWYU pragma: export + +namespace LAMMPS_NS { +namespace Granular_NS { + +#define EPSILON 1e-10 +#define NSUBMODELS 6 + +enum SubmodelType { + NORMAL = 0, + DAMPING = 1, + TANGENTIAL = 2, + ROLLING = 3, + TWISTING = 4, + HEAT = 5 +}; // Relative order matters since some derive coeffs from others + +enum ContactType { + PAIR = 0, + WALL = 1, + WALLREGION = 2 +}; + +// forward declaration +class GSM; +class GSMNormal; +class GSMDamping; +class GSMTangential; +class GSMRolling; +class GSMTwisting; +class GSMHeat; + +class GranularModel : protected Pointers { + public: + GranularModel(class LAMMPS *); + ~GranularModel(); + void init(); + bool check_contact(); + void calculate_forces(); + double pulloff_distance(double, double); + + int init_submodel(char **, int, int, SubmodelType); + int init_classic_model(char **, int, int); + void construct_submodel(std::string, SubmodelType); + int mix_coeffs(GranularModel*, GranularModel*); + + void write_restart(FILE *); + void read_restart(FILE *); + + // Sub models + GSMNormal *normal_model; + GSMDamping *damping_model; + GSMTangential *tangential_model; + GSMRolling *rolling_model; + GSMTwisting *twisting_model; + GSMHeat *heat_model; + GSM *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors + + // Extra options + int beyond_contact, limit_damping, history_update; + ContactType contact_type; + + // History variables + int size_history, nondefault_history_transfer; + double *transfer_history_factor; + double *history; + + // Contact properties/output + double forces[3], torquesi[3], torquesj[3], dq; + + double radi, radj, meff, dt, Ti, Tj, area; + double Fntot, magtortwist; + + int i, j; + double *xi, *xj, *vi, *vj, *omegai, *omegaj; + double fs[3], fr[3], ft[3]; + + double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; + double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; + double magtwist; + bool touch; + + protected: + int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels + int classic_model; +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif diff --git a/src/GRANULAR/gsm.cpp b/src/GRANULAR/gsm.cpp new file mode 100644 index 0000000000..17b816ad21 --- /dev/null +++ b/src/GRANULAR/gsm.cpp @@ -0,0 +1,127 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +-------------------------------------------------------------------------*/ + +/* ---------------------------------------------------------------------- + This class contains a framework for granular submodels (GSM) including: + normal, damping, tangential, rolling, twisting, and heat + These are used to calculate forces/torques/etc based on contact geometry + + Contributing authors: + Dan Bolintineanu (SNL), Joel Clemmer (SNL) +----------------------------------------------------------------------- */ + +#include "gsm.h" +#include "error.h" +#include "utils.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; + +/* ---------------------------------------------------------------------- + Parent class for all types of granular submodels +------------------------------------------------------------------------- */ + +GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) +{ + this->gm = gm; + + allocated = 0; + size_history = 0; + history_index = 0; + allow_limit_damping = 1; + beyond_contact = 0; + num_coeffs = 0; + + nondefault_history_transfer = 0; + transfer_history_factor = nullptr; + allocate_coeffs(); +} + +/* ---------------------------------------------------------------------- */ + +GSM::~GSM() +{ + if (allocated) delete [] coeffs; + delete [] transfer_history_factor; +} + +/* ---------------------------------------------------------------------- */ + +void GSM::allocate_coeffs() +{ + allocated = 1; + coeffs = new double[num_coeffs]; +} + +/* ---------------------------------------------------------------------- */ + +void GSM::mix_coeffs(double* icoeffs, double* jcoeffs) +{ + for (int i = 0; i < num_coeffs; i++) + coeffs[i] = mix_geom(icoeffs[i], jcoeffs[i]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- + mixing of Young's modulus (E) +------------------------------------------------------------------------- */ + +double GSM::mix_stiffnessE(double E1, double E2, + double pois1, double pois2) +{ + double factor1 = (1 - pois1 * pois1) / E1; + double factor2 = (1 - pois2 * pois2) / E2; + return 1 / (factor1 + factor2); +} + +/* ---------------------------------------------------------------------- + mixing of shear modulus (G) +------------------------------------------------------------------------ */ + +double GSM::mix_stiffnessG(double E1, double E2, + double pois1, double pois2) +{ + double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; + double factor2 = 2 * (2 - pois2) * (1 + pois2) / E2; + return 1 / (factor1 + factor2); +} + +/* ---------------------------------------------------------------------- + mixing of Young's modulus (E) for walls +------------------------------------------------------------------------- */ + +double GSM::mix_stiffnessE_wall(double E, double pois) +{ + double factor = 2 * (1 - pois); + return E / factor; +} + +/* ---------------------------------------------------------------------- + mixing of shear modulus (G) for walls +------------------------------------------------------------------------ */ + +double GSM::mix_stiffnessG_wall(double E, double pois) +{ + double factor = 32.0 * (2 - pois) * (1 + pois); + return E / factor; +} + +/* ---------------------------------------------------------------------- + mixing of everything else +------------------------------------------------------------------------- */ + +double GSM::mix_geom(double val1, double val2) +{ + return sqrt(val1 * val2); +} diff --git a/src/GRANULAR/gsm.h b/src/GRANULAR/gsm.h new file mode 100644 index 0000000000..b2df6bef2b --- /dev/null +++ b/src/GRANULAR/gsm.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_GSM_H_ +#define LMP_GSM_H_ + +#include "granular_model.h" +#include "pointers.h" // IWYU pragma: export + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSM : protected Pointers { + public: + GSM(class GranularModel *, class LAMMPS *); + virtual ~GSM(); + + int num_coeffs; + double *coeffs; + void read_restart(); + virtual void mix_coeffs(double*, double*); + virtual void coeffs_to_local() = 0; + virtual void init() = 0; // called after all submodel coeffs defined + + void allocate_coeffs(); + std::string name; + + int size_history; + int nondefault_history_transfer; + double *transfer_history_factor; + + int history_index; + int beyond_contact; + int allow_limit_damping; + + GranularModel *gm; + + protected: + int allocated; + + double mix_stiffnessE(double, double, double, double); + double mix_stiffnessG(double, double, double, double); + double mix_stiffnessE_wall(double, double); + double mix_stiffnessG_wall(double, double); + double mix_geom(double, double); +}; + +} // namespace GranularModel +} // namespace LAMMPS_NS + +#endif /* GSM_H_ */ diff --git a/src/GRANULAR/gsm_damping.cpp b/src/GRANULAR/gsm_damping.cpp new file mode 100644 index 0000000000..9b51651f30 --- /dev/null +++ b/src/GRANULAR/gsm_damping.cpp @@ -0,0 +1,113 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "gsm_damping.h" +#include "gsm_normal.h" +#include "granular_model.h" +#include "math_special.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; +using namespace MathSpecial; + +/* ---------------------------------------------------------------------- + Default damping model +------------------------------------------------------------------------- */ + +GSMDamping::GSMDamping(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +void GSMDamping::init() +{ + damp = gm->normal_model->damp; +} + +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +GSMDampingNone::GSMDampingNone(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +double GSMDampingNone::calculate_forces() +{ + return 0.0; +} + +/* ---------------------------------------------------------------------- + Velocity damping +------------------------------------------------------------------------- */ + +GSMDampingVelocity::GSMDampingVelocity(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +double GSMDampingVelocity::calculate_forces() +{ + damp_prefactor = damp; + return -damp_prefactor * gm->vnnr; +} + +/* ---------------------------------------------------------------------- + Mass velocity damping +------------------------------------------------------------------------- */ + +GSMDampingMassVelocity::GSMDampingMassVelocity(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +double GSMDampingMassVelocity::calculate_forces() +{ + damp_prefactor = damp * gm->meff; + return -damp_prefactor * gm->vnnr; +} + +/* ---------------------------------------------------------------------- + Default, viscoelastic damping +------------------------------------------------------------------------- */ + +GSMDampingViscoelastic::GSMDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +double GSMDampingViscoelastic::calculate_forces() +{ + damp_prefactor = damp * gm->meff * gm->area; + return -damp_prefactor * gm->vnnr; +} + +/* ---------------------------------------------------------------------- + Tsuji damping +------------------------------------------------------------------------- */ + +GSMDampingTsuji::GSMDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +void GSMDampingTsuji::init() +{ + double tmp = gm->normal_model->damp; + damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); + damp += -22.348 * cube(tmp)+ 27.467 * powint(tmp, 4); + damp += -18.022 * powint(tmp, 5) + 4.8218 * powint(tmp,6); +} + +/* ---------------------------------------------------------------------- */ + +double GSMDampingTsuji::calculate_forces() +{ + damp_prefactor = damp * sqrt(gm->meff * gm->normal_model->knfac); + return -damp_prefactor * gm->vnnr; +} diff --git a/src/GRANULAR/gsm_damping.h b/src/GRANULAR/gsm_damping.h new file mode 100644 index 0000000000..ab12cbc2d3 --- /dev/null +++ b/src/GRANULAR/gsm_damping.h @@ -0,0 +1,79 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GSM_DAMPING_H_ +#define GSM_DAMPING_H_ + +#include "gsm.h" +#include "pointers.h" + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSMDamping : public GSM { + public: + GSMDamping(class GranularModel *, class LAMMPS *); + ~GSMDamping() {}; + virtual void coeffs_to_local() {}; + virtual void mix_coeffs(double*, double*) {}; + virtual void init(); + virtual double calculate_forces() = 0; + double damp, damp_prefactor; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMDampingNone : public GSMDamping { + public: + GSMDampingNone(class GranularModel *, class LAMMPS *); + void init() override {}; + double calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMDampingVelocity : public GSMDamping { + public: + GSMDampingVelocity(class GranularModel *, class LAMMPS *); + double calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMDampingMassVelocity : public GSMDamping { + public: + GSMDampingMassVelocity(class GranularModel *, class LAMMPS *); + double calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMDampingViscoelastic : public GSMDamping { + public: + GSMDampingViscoelastic(class GranularModel *, class LAMMPS *); + double calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMDampingTsuji : public GSMDamping { + public: + GSMDampingTsuji(class GranularModel *, class LAMMPS *); + void init() override; + double calculate_forces(); +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif /*GSM_DAMPING_H_ */ diff --git a/src/GRANULAR/gsm_heat.cpp b/src/GRANULAR/gsm_heat.cpp new file mode 100644 index 0000000000..449df5520b --- /dev/null +++ b/src/GRANULAR/gsm_heat.cpp @@ -0,0 +1,63 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "gsm_heat.h" +#include "granular_model.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; + +/* ---------------------------------------------------------------------- + Default heat conduction +------------------------------------------------------------------------- */ + +GSMHeat::GSMHeat(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} + +/* ---------------------------------------------------------------------- + Area-based heat conduction +------------------------------------------------------------------------- */ + +GSMHeatNone::GSMHeatNone(GranularModel *gm, LAMMPS *lmp) : GSMHeat(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +double GSMHeatNone::calculate_heat() +{ + return 0.0; +} + +/* ---------------------------------------------------------------------- + Area-based heat conduction +------------------------------------------------------------------------- */ + +GSMHeatArea::GSMHeatArea(GranularModel *gm, LAMMPS *lmp) : GSMHeat(gm, lmp) +{ + num_coeffs = 1; +} + +/* ---------------------------------------------------------------------- */ + +void GSMHeatArea::coeffs_to_local() +{ + conductivity = coeffs[0]; + + if (conductivity < 0.0) error->all(FLERR, "Illegal area heat model"); +} + +/* ---------------------------------------------------------------------- */ + +double GSMHeatArea::calculate_heat() +{ + return conductivity * gm->area * (gm->Tj - gm->Ti); +} diff --git a/src/GRANULAR/gsm_heat.h b/src/GRANULAR/gsm_heat.h new file mode 100644 index 0000000000..f397d555b6 --- /dev/null +++ b/src/GRANULAR/gsm_heat.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GSM_HEAT_H_ +#define GSM_HEAT_H_ + +#include "gsm.h" + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSMHeat : public GSM { + public: + GSMHeat(class GranularModel *, class LAMMPS *); + ~GSMHeat() {}; + virtual void coeffs_to_local() {}; + virtual void init() {}; + virtual double calculate_heat() = 0; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMHeatNone : public GSMHeat { + public: + GSMHeatNone(class GranularModel *, class LAMMPS *); + double calculate_heat(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMHeatArea : public GSMHeat { + public: + GSMHeatArea(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + double calculate_heat(); + protected: + double conductivity; +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif /*GSM_HEAT_H_ */ diff --git a/src/GRANULAR/gsm_normal.cpp b/src/GRANULAR/gsm_normal.cpp new file mode 100644 index 0000000000..2b029ece6a --- /dev/null +++ b/src/GRANULAR/gsm_normal.cpp @@ -0,0 +1,377 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "gsm_normal.h" +#include "granular_model.h" +#include "error.h" +#include "math_const.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; +using namespace MathConst; + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS (4.0/3.0) // 4/3 +#define ONETHIRD (1.0/3.0) // 1/3 +#define THREEQUARTERS 0.75 // 3/4 + +/* ---------------------------------------------------------------------- + Default normal model +------------------------------------------------------------------------- */ + +GSMNormal::GSMNormal(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) +{ + material_properties = 0; +} + +/* ---------------------------------------------------------------------- */ + +bool GSMNormal::touch() +{ + bool touchflag = (gm->rsq < gm->radsum * gm->radsum); + return touchflag; +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormal::pulloff_distance(double radi, double radj) +{ + //called outside of compute(), do not assume correct geometry defined in contact + return radi + radj; +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormal::calculate_area() +{ + return sqrt(gm->dR); +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormal::set_fncrit() +{ + Fncrit = fabs(gm->Fntot); +} + +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +GSMNormalNone::GSMNormalNone(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) {} + +/* ---------------------------------------------------------------------- */ + +double GSMNormalNone::calculate_forces() +{ + return 0.0; +} + +/* ---------------------------------------------------------------------- + Hookean normal force +------------------------------------------------------------------------- */ + +GSMNormalHooke::GSMNormalHooke(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +{ + num_coeffs = 2; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalHooke::coeffs_to_local() +{ + k = coeffs[0]; + damp = coeffs[1]; + + if (k < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hooke normal model"); +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormalHooke::calculate_forces() +{ + Fne = knfac * gm->delta; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalHooke::set_knfac() +{ + knfac = k; +} + +/* ---------------------------------------------------------------------- + Hertzian normal force +------------------------------------------------------------------------- */ + +GSMNormalHertz::GSMNormalHertz(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +{ + num_coeffs = 2; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalHertz::coeffs_to_local() +{ + k = coeffs[0]; + damp = coeffs[1]; + + if (k < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz normal model"); +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormalHertz::calculate_forces() +{ + Fne = knfac * gm->delta; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalHertz::set_knfac() +{ + knfac = k * gm->area; +} + +/* ---------------------------------------------------------------------- + Hertzian normal force with material properties +------------------------------------------------------------------------- */ + +GSMNormalHertzMaterial::GSMNormalHertzMaterial(GranularModel *gm, LAMMPS *lmp) : GSMNormalHertz(gm, lmp) +{ + material_properties = 1; + num_coeffs = 3; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalHertzMaterial::coeffs_to_local() +{ + Emod = coeffs[0]; + damp = coeffs[1]; + poiss = coeffs[2]; + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } + + if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) +{ + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- + DMT normal force +------------------------------------------------------------------------- */ + +GSMNormalDMT::GSMNormalDMT(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +{ + allow_limit_damping = 0; + material_properties = 1; + num_coeffs = 4; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalDMT::coeffs_to_local() +{ + Emod = coeffs[0]; + damp = coeffs[1]; + poiss = coeffs[2]; + cohesion = coeffs[3]; + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } + + if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) +{ + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormalDMT::calculate_forces() +{ + Fne = knfac * gm->delta; + F_pulloff = 4.0 * MathConst::MY_PI * cohesion * gm->Reff; + Fne -= F_pulloff; + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalDMT::set_knfac() +{ + knfac = k * gm->area; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalDMT::set_fncrit() +{ + Fncrit = fabs(Fne + 2.0 * F_pulloff); +} + +/* ---------------------------------------------------------------------- + JKR normal force +------------------------------------------------------------------------- */ + +GSMNormalJKR::GSMNormalJKR(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +{ + allow_limit_damping = 0; + material_properties = 1; + beyond_contact = 1; + num_coeffs = 4; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalJKR::coeffs_to_local() +{ + Emod = coeffs[0]; + damp = coeffs[1]; + poiss = coeffs[2]; + cohesion = coeffs[3]; + + if (gm->contact_type == PAIR) { + Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + Emix = mix_stiffnessE_wall(Emod, poiss); + } + + k = FOURTHIRDS * Emix; + + if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) +{ + coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +bool GSMNormalJKR::touch() +{ + double area_at_pulloff, R2, delta_pulloff, dist_pulloff; + bool touchflag; + + if (gm->touch) { + R2 = gm->Reff * gm->Reff; + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4.0 * Emix)); + delta_pulloff = area_at_pulloff * area_at_pulloff / gm->Reff - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Emix); + dist_pulloff = gm->radsum - delta_pulloff; + touchflag = gm->rsq < (dist_pulloff * dist_pulloff); + } else { + touchflag = gm->rsq < (gm->radsum * gm->radsum); + } + + return touchflag; +} + +/* ---------------------------------------------------------------------- + called outside of compute(), do not assume geometry defined in contact +------------------------------------------------------------------------- */ + +double GSMNormalJKR::pulloff_distance(double radi, double radj) +{ + double area_at_pulloff, Reff_tmp; + + Reff_tmp = radi * radj / (radi + radj); // May not be defined + if (Reff_tmp <= 0) return 0; + + area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4.0 * Emix)); + return area_at_pulloff * area_at_pulloff / Reff_tmp - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Emix); +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormalJKR::calculate_area() +{ + double R2, dR2, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3; + + R2 = gm->Reff * gm->Reff; + dR2 = gm->dR * gm->dR; + t0 = cohesion * cohesion * R2 * R2 * Emix; + t1 = PI27SQ * t0; + t2 = 8.0 * gm->dR * dR2 * Emix * Emix * Emix; + t3 = 4.0 * dR2 * Emix; + + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0 * (t1 + 2.0 * t2)); + t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); + t5 = t3 / t4 + t4 / Emix; + sqrt2 = MAX(0, 2.0 * gm->dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4.0 * gm->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Emix * t6)); + + return INVROOT6 * (t6 + sqrt(sqrt3)); +} + +/* ---------------------------------------------------------------------- */ + +double GSMNormalJKR::calculate_forces() +{ + double a2; + a2 = gm->area * gm->area; + Fne = knfac * a2 / gm->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Emix / (MY_PI * gm->area)); + F_pulloff = 3.0 * MY_PI * cohesion * gm->Reff; + + return Fne; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalJKR::set_knfac() +{ + knfac = k * gm->area; +} + +/* ---------------------------------------------------------------------- */ + +void GSMNormalJKR::set_fncrit() +{ + Fncrit = fabs(Fne + 2.0 * F_pulloff); +} diff --git a/src/GRANULAR/gsm_normal.h b/src/GRANULAR/gsm_normal.h new file mode 100644 index 0000000000..31587dfd03 --- /dev/null +++ b/src/GRANULAR/gsm_normal.h @@ -0,0 +1,118 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GSM_NORMAL_H_ +#define GSM_NORMAL_H_ + +#include "gsm.h" + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSMNormal : public GSM { + public: + GSMNormal(class GranularModel *, class LAMMPS *); + ~GSMNormal() {}; + virtual void coeffs_to_local() {}; + virtual void init() {}; + virtual bool touch(); + virtual double pulloff_distance(double, double); + virtual double calculate_area(); + virtual void set_knfac() = 0; + virtual double calculate_forces() = 0; + virtual void set_fncrit(); + double damp; // Vestigial argument needed by damping + double Emod, poiss; + double Fncrit, Fne, knfac; + int material_properties; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMNormalNone : public GSMNormal { + public: + GSMNormalNone(class GranularModel *, class LAMMPS *); + void set_knfac() {}; + double calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMNormalHooke : public GSMNormal { + public: + GSMNormalHooke(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void set_knfac(); + double calculate_forces(); + protected: + double k; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMNormalHertz : public GSMNormal { + public: + GSMNormalHertz(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void set_knfac(); + double calculate_forces(); + protected: + double k; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMNormalHertzMaterial : public GSMNormalHertz { + public: + GSMNormalHertzMaterial(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMNormalDMT : public GSMNormal { + public: + GSMNormalDMT(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; + void set_knfac(); + double calculate_forces(); + void set_fncrit() override; + protected: + double k, cohesion; + double F_pulloff; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMNormalJKR : public GSMNormal { + public: + GSMNormalJKR(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; + bool touch() override; + double pulloff_distance(double, double) override; + double calculate_area() override; + void set_knfac(); + double calculate_forces(); + void set_fncrit() override; + protected: + double k, cohesion; + double Emix, F_pulloff; +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif /*GSM_NORMAL_H_ */ diff --git a/src/GRANULAR/gsm_rolling.cpp b/src/GRANULAR/gsm_rolling.cpp new file mode 100644 index 0000000000..efb0ea423b --- /dev/null +++ b/src/GRANULAR/gsm_rolling.cpp @@ -0,0 +1,121 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "gsm_normal.h" +#include "gsm_rolling.h" +#include "granular_model.h" +#include "error.h" +#include "math_const.h" +#include "math_extra.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; +using namespace MathConst; +using namespace MathExtra; + +/* ---------------------------------------------------------------------- + Default rolling friction model +------------------------------------------------------------------------- */ + +GSMRolling::GSMRolling(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} + +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +GSMRollingNone::GSMRollingNone(GranularModel *gm, LAMMPS *lmp) : GSMRolling(gm, lmp) {} + +/* ---------------------------------------------------------------------- + SDS rolling friction model +------------------------------------------------------------------------- */ + +GSMRollingSDS::GSMRollingSDS(GranularModel *gm, LAMMPS *lmp) : GSMRolling(gm, lmp) +{ + num_coeffs = 3; + size_history = 3; +} + +/* ---------------------------------------------------------------------- */ + +void GSMRollingSDS::coeffs_to_local() +{ + k = coeffs[0]; + gamma = coeffs[1]; + mu = coeffs[2]; + + if (k < 0.0 || mu < 0.0 || gamma < 0.0) + error->all(FLERR, "Illegal SDS rolling model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMRollingSDS::calculate_forces() +{ + int rhist0, rhist1, rhist2, frameupdate; + double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], scalefac, temp_array[3]; + double k_inv, magfr_inv; + + rhist0 = history_index; + rhist1 = rhist0 + 1; + rhist2 = rhist1 + 1; + + Frcrit = mu * gm->normal_model->Fncrit; + + if (gm->history_update) { + hist_temp[0] = gm->history[rhist0]; + hist_temp[1] = gm->history[rhist1]; + hist_temp[2] = gm->history[rhist2]; + rolldotn = dot3(hist_temp, gm->nx); + + frameupdate = (fabs(rolldotn) * k) > (EPSILON * Frcrit); + if (frameupdate) { // rotate into tangential plane + rollmag = len3(hist_temp); + // projection + scale3(rolldotn, gm->nx, temp_array); + sub3(hist_temp, temp_array, hist_temp); + + // also rescale to preserve magnitude + prjmag = len3(hist_temp); + if (prjmag > 0) scalefac = rollmag / prjmag; + else scalefac = 0; + scale3(scalefac, hist_temp); + } + scale3(gm->dt, gm->vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); + } + + scaleadd3(-k, hist_temp, -gamma, gm->vrl, gm->fr); + + // rescale frictional displacements and forces if needed + magfr = len3(gm->fr); + if (magfr > Frcrit) { + rollmag = len3(hist_temp); + if (rollmag != 0.0) { + k_inv = 1.0 / k; + magfr_inv = 1.0 / magfr; + scale3(-Frcrit * k_inv * magfr_inv, gm->fr, hist_temp); + scale3(-gamma * k_inv, gm->vrl, temp_array); + add3(hist_temp, temp_array, hist_temp); + + scale3(Frcrit * magfr_inv, gm->fr); + } else { + zero3(gm->fr); + } + } + + if (gm->history_update) { + gm->history[rhist0] = hist_temp[0]; + gm->history[rhist1] = hist_temp[1]; + gm->history[rhist2] = hist_temp[2]; + } +} diff --git a/src/GRANULAR/gsm_rolling.h b/src/GRANULAR/gsm_rolling.h new file mode 100644 index 0000000000..44f45b583d --- /dev/null +++ b/src/GRANULAR/gsm_rolling.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GSM_ROLLING_H_ +#define GSM_ROLLING_H_ + +#include "gsm.h" + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSMRolling : public GSM { + public: + GSMRolling(class GranularModel *, class LAMMPS *); + ~GSMRolling() {}; + virtual void coeffs_to_local() {}; + virtual void init() {}; + virtual void calculate_forces() = 0; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMRollingNone : public GSMRolling { + public: + GSMRollingNone(class GranularModel *, class LAMMPS *); + void calculate_forces() {}; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMRollingSDS : public GSMRolling { + public: + GSMRollingSDS(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void calculate_forces(); + protected: + double k, mu, gamma; +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif /*GSM_ROLLING_H_ */ diff --git a/src/GRANULAR/gsm_tangential.cpp b/src/GRANULAR/gsm_tangential.cpp new file mode 100644 index 0000000000..1f6213d708 --- /dev/null +++ b/src/GRANULAR/gsm_tangential.cpp @@ -0,0 +1,412 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "gsm_damping.h" +#include "gsm_normal.h" +#include "gsm_tangential.h" +#include "granular_model.h" +#include "error.h" +#include "math_const.h" +#include "math_extra.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; +using namespace MathConst; +using namespace MathExtra; + +/* ---------------------------------------------------------------------- + Default model +------------------------------------------------------------------------- */ + +GSMTangential::GSMTangential(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} + +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +GSMTangentialNone::GSMTangentialNone(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) {} + +/* ---------------------------------------------------------------------- + Linear model with no history +------------------------------------------------------------------------- */ + +GSMTangentialLinearNoHistory::GSMTangentialLinearNoHistory(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) +{ + num_coeffs = 2; + size_history = 3; +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialLinearNoHistory::coeffs_to_local() +{ + k = 0.0; // No tangential stiffness with no history + xt = coeffs[0]; + mu = coeffs[1]; + + if (k < 0.0 || xt < 0.0 || mu < 0.0) + error->all(FLERR, "Illegal linear no history tangential model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialLinearNoHistory::calculate_forces() +{ + // classic pair gran/hooke (no history) + damp = xt * gm->damping_model->damp_prefactor; + + double Fscrit = mu * gm->normal_model->Fncrit; + double fsmag = damp * gm->vrel; + + double Ft; + if (gm->vrel != 0.0) Ft = MIN(Fscrit, fsmag) / gm->vrel; + else Ft = 0.0; + + scale3(-Ft, gm->vtr, gm->fs); +} + +/* ---------------------------------------------------------------------- + Linear model with history +------------------------------------------------------------------------- */ + +GSMTangentialLinearHistory::GSMTangentialLinearHistory(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) +{ + num_coeffs = 3; + size_history = 3; +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialLinearHistory::coeffs_to_local() +{ + k = coeffs[0]; + xt = coeffs[1]; + mu = coeffs[2]; + + if (k < 0.0 || xt < 0.0 || mu < 0.0) + error->all(FLERR, "Illegal linear tangential model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialLinearHistory::calculate_forces() +{ + // Note: this is the same as the base Mindlin calculation except k isn't scaled by area + double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; + int frame_update = 0; + + damp = xt * gm->damping_model->damp_prefactor; + + double Fscrit = gm->normal_model->Fncrit * mu; + double *history = & gm->history[history_index]; + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (gm->history_update) { + rsht = dot3(history, gm->nx); + frame_update = (fabs(rsht) * k) > (EPSILON * Fscrit); + + if (frame_update) { + shrmag = len3(history); + + // projection + scale3(rsht, gm->nx, temp_array); + sub3(history, temp_array, history); + + // also rescale to preserve magnitude + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); + } + + // update history, tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + scale3(gm->dt, gm->vtr, temp_array); + add3(history, temp_array, history); + } + + + // tangential forces = history + tangential velocity damping + scale3(-k, history, gm->fs); + scale3(damp, gm->vtr, temp_array); + sub3(gm->fs, temp_array, gm->fs); + + // rescale frictional displacements and forces if needed + magfs = len3(gm->fs); + if (magfs > Fscrit) { + shrmag = len3(history); + if (shrmag != 0.0) { + magfs_inv = 1.0 / magfs; + scale3(Fscrit * magfs_inv, gm->fs, history); + scale3(damp, gm->vtr, temp_array); + add3(history, temp_array, history); + scale3(-1.0 / k, history); + scale3(Fscrit * magfs_inv, gm->fs); + } else { + zero3(gm->fs); + } + } +} + +/* ---------------------------------------------------------------------- + Linear model with history from pair gran/hooke/history +------------------------------------------------------------------------- */ + +GSMTangentialLinearHistoryClassic::GSMTangentialLinearHistoryClassic(GranularModel *gm, LAMMPS *lmp) : GSMTangentialLinearHistory(gm, lmp) +{ + scale_area = 0; // Sets gran/hooke/history behavior +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialLinearHistoryClassic::calculate_forces() +{ + double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; + double temp_array[3]; + int frame_update = 0; + + k_scaled = k; + if (scale_area) k_scaled *= gm->area; + + damp = xt * gm->damping_model->damp_prefactor; + + double Fscrit = gm->normal_model->Fncrit * mu; + double *history = & gm->history[history_index]; + + // update history + if (gm->history_update) { + scale3(gm->dt, gm->vtr, temp_array); + add3(history, temp_array, history); + } + + shrmag = len3(history); + + // rotate shear displacements + if (gm->history_update) { + rsht = dot3(history, gm->nx); + scale3(rsht, gm->nx, temp_array); + sub3(history, temp_array, history); + } + + // tangential forces = history + tangential velocity damping + scale3(-k_scaled, history, gm->fs); + scale3(damp, gm->vtr, temp_array); + sub3(gm->fs, temp_array, gm->fs); + + // rescale frictional displacements and forces if needed + magfs = len3(gm->fs); + if (magfs > Fscrit) { + if (shrmag != 0.0) { + magfs_inv = 1.0 / magfs; + scale3(Fscrit * magfs_inv, gm->fs, history); + scale3(damp, gm->vtr, temp_array); + add3(history, temp_array, history); + temp_dbl = -1.0 / k_scaled; + if (scale_area) temp_dbl /= gm->area; + scale3(temp_dbl, history); + scale3(Fscrit * magfs_inv, gm->fs); + } else { + zero3(gm->fs); + } + } +} + +/* ---------------------------------------------------------------------- + Mindlin from pair gran/hertz/history +------------------------------------------------------------------------- */ + +GSMTangentialMindlinClassic::GSMTangentialMindlinClassic(GranularModel *gm, LAMMPS *lmp) : GSMTangentialLinearHistoryClassic(gm, lmp) +{ + scale_area = 1; // Sets gran/hertz/history behavior +} + +/* ---------------------------------------------------------------------- + Mindlin model +------------------------------------------------------------------------- */ + +GSMTangentialMindlin::GSMTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) +{ + num_coeffs = 3; + size_history = 3; + mindlin_force = 0; + mindlin_rescale = 0; +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialMindlin::coeffs_to_local() +{ + k = coeffs[0]; + xt = coeffs[1]; + mu = coeffs[2]; + + if (k == -1) { + if (!gm->normal_model->material_properties) + error->all(FLERR, "Must either specify tangential stiffness or material properties for normal model for the Mindlin tangential style"); + + double Emod = gm->normal_model->Emod; + double poiss = gm->normal_model->poiss; + + if (gm->contact_type == PAIR) { + k = 8.0 * mix_stiffnessG(Emod, Emod, poiss, poiss); + } else { + k = 8.0 * mix_stiffnessG_wall(Emod, poiss); + } + } + + if (k < 0.0 || xt < 0.0 || mu < 0.0) + error->all(FLERR, "Illegal Mindlin tangential model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) +{ + if (icoeffs[0] == -1 || jcoeffs[0] == -1) coeffs[0] = -1; + else coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); + coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); + coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + coeffs_to_local(); +} + +/* ---------------------------------------------------------------------- */ + +void GSMTangentialMindlin::calculate_forces() +{ + double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; + double temp_array[3]; + int frame_update = 0; + + damp = xt * gm->damping_model->damp_prefactor; + + double *history = & gm->history[history_index]; + double Fscrit = gm->normal_model->Fncrit * mu; + + k_scaled = k * gm->area; + + // on unloading, rescale the shear displacements/force + if (mindlin_rescale) + if (gm->area < history[3]) + scale3(gm->area / history[3], history); + + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (gm->history_update) { + rsht = dot3(history, gm->nx); + if (mindlin_force) { + frame_update = fabs(rsht) > (EPSILON * Fscrit); + } else { + frame_update = (fabs(rsht) * k_scaled) > (EPSILON * Fscrit); + } + + if (frame_update) { + shrmag = len3(history); + // projection + scale3(rsht, gm->nx, temp_array); + sub3(history, temp_array, history); + // also rescale to preserve magnitude + prjmag = len3(history); + if (prjmag > 0) temp_dbl = shrmag / prjmag; + else temp_dbl = 0; + scale3(temp_dbl, history); + } + + // update history + if (mindlin_force) { + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + scale3(-k_scaled * gm->dt, gm->vtr, temp_array); + } else { + scale3(gm->dt, gm->vtr, temp_array); + } + add3(history, temp_array, history); + + if (mindlin_rescale) history[3] = gm->area; + } + + // tangential forces = history + tangential velocity damping + scale3(-damp, gm->vtr, gm->fs); + + if (!mindlin_force) { + scale3(k_scaled, history, temp_array); + sub3(gm->fs, temp_array, gm->fs); + } else { + add3(gm->fs, history, gm->fs); + } + + // rescale frictional displacements and forces if needed + magfs = len3(gm->fs); + if (magfs > Fscrit) { + shrmag = len3(history); + if (shrmag != 0.0) { + magfs_inv = 1.0 / magfs; + scale3(Fscrit * magfs_inv, gm->fs, history); + scale3(damp, gm->vtr, temp_array); + add3(history, temp_array, history); + + if (!mindlin_force) + scale3(-1.0 / k_scaled, history); + + scale3(Fscrit * magfs_inv, gm->fs); + } else { + zero3(gm->fs); + } + } +} + +/* ---------------------------------------------------------------------- + Mindlin force model +------------------------------------------------------------------------- */ + +GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) +{ + num_coeffs = 3; + size_history = 3; + mindlin_force = 1; + mindlin_rescale = 0; +} + +/* ---------------------------------------------------------------------- + Mindlin rescale model +------------------------------------------------------------------------- */ + +GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) +{ + num_coeffs = 3; + size_history = 4; + mindlin_force = 0; + mindlin_rescale = 1; + + nondefault_history_transfer = 1; + transfer_history_factor = new double[size_history]; + for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; + transfer_history_factor[3] = +1; +} + +/* ---------------------------------------------------------------------- + Mindlin rescale force model +------------------------------------------------------------------------- */ + +GSMTangentialMindlinRescaleForce::GSMTangentialMindlinRescaleForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) +{ + num_coeffs = 3; + size_history = 4; + mindlin_force = 1; + mindlin_rescale = 1; + + nondefault_history_transfer = 1; + transfer_history_factor = new double[size_history]; + for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; + transfer_history_factor[3] = +1; +} diff --git a/src/GRANULAR/gsm_tangential.h b/src/GRANULAR/gsm_tangential.h new file mode 100644 index 0000000000..8e1d644fea --- /dev/null +++ b/src/GRANULAR/gsm_tangential.h @@ -0,0 +1,113 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GSM_TANGENTIAL_H_ +#define GSM_TANGENTIAL_H_ + +#include "gsm.h" + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSMTangential : public GSM { + public: + GSMTangential(class GranularModel *, class LAMMPS *); + virtual ~GSMTangential() {}; + virtual void coeffs_to_local() {}; + virtual void init() {}; + virtual void calculate_forces() = 0; + int rescale_flag; + double k, damp, mu; // Used by Marshall twisting model + protected: + double xt; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialNone : public GSMTangential { + public: + GSMTangentialNone(class GranularModel *, class LAMMPS *); + void calculate_forces() {}; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialLinearNoHistory : public GSMTangential { + public: + GSMTangentialLinearNoHistory(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialLinearHistory : public GSMTangential { + public: + GSMTangentialLinearHistory(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void calculate_forces(); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory { + public: + GSMTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); + void calculate_forces(); + int scale_area; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialMindlinClassic : public GSMTangentialLinearHistoryClassic { + public: + GSMTangentialMindlinClassic(class GranularModel *, class LAMMPS *); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialMindlin : public GSMTangential { + public: + GSMTangentialMindlin(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void mix_coeffs(double*, double*) override; + void calculate_forces(); + protected: + int mindlin_rescale, mindlin_force; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialMindlinForce : public GSMTangentialMindlin { + public: + GSMTangentialMindlinForce(class GranularModel *, class LAMMPS *); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialMindlinRescale : public GSMTangentialMindlin { + public: + GSMTangentialMindlinRescale(class GranularModel *, class LAMMPS *); +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTangentialMindlinRescaleForce : public GSMTangentialMindlin { + public: + GSMTangentialMindlinRescaleForce(class GranularModel *, class LAMMPS *); +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif /*GSM_TANGENTIAL_H_ */ diff --git a/src/GRANULAR/gsm_twisting.cpp b/src/GRANULAR/gsm_twisting.cpp new file mode 100644 index 0000000000..3704ac4ec8 --- /dev/null +++ b/src/GRANULAR/gsm_twisting.cpp @@ -0,0 +1,124 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "gsm_normal.h" +#include "gsm_tangential.h" +#include "gsm_twisting.h" +#include "granular_model.h" +#include "error.h" +#include "math_const.h" + +using namespace LAMMPS_NS; +using namespace Granular_NS; +using namespace MathConst; + +/* ---------------------------------------------------------------------- + Default twisting model +------------------------------------------------------------------------- */ + +GSMTwisting::GSMTwisting(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} + +/* ---------------------------------------------------------------------- + No model +------------------------------------------------------------------------- */ + +GSMTwistingNone::GSMTwistingNone(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) {} + +/* ---------------------------------------------------------------------- + Marshall twisting model +------------------------------------------------------------------------- */ + +GSMTwistingMarshall::GSMTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) +{ + num_coeffs = 0; + size_history = 3; +} + +/* ---------------------------------------------------------------------- */ + + +void GSMTwistingMarshall::init() +{ + k_tang = gm->tangential_model->k; + mu_tang = gm->tangential_model->mu; +} + +/* ---------------------------------------------------------------------- */ + +void GSMTwistingMarshall::calculate_forces() +{ + double signtwist, Mtcrit; + + // Calculate twist coefficients from tangential model & contact geometry + // eq 32 of Marshall paper + double k = 0.5 * k_tang * gm->area * gm->area; + double damp = 0.5 * gm->tangential_model->damp * gm->area * gm->area; + double mu = TWOTHIRDS * mu_tang * gm->area; + + if (gm->history_update) { + gm->history[history_index] += gm->magtwist * gm->dt; + } + + // M_t torque (eq 30) + gm->magtortwist = -k * gm->history[history_index] - damp * gm->magtwist; + signtwist = (gm->magtwist > 0) - (gm->magtwist < 0); + Mtcrit = mu * gm->normal_model->Fncrit; // critical torque (eq 44) + + if (fabs(gm->magtortwist) > Mtcrit) { + gm->history[history_index] = (Mtcrit * signtwist - damp * gm->magtwist) / k; + gm->magtortwist = -Mtcrit * signtwist; // eq 34 + } +} + +/* ---------------------------------------------------------------------- + SDS twisting model +------------------------------------------------------------------------- */ + +GSMTwistingSDS::GSMTwistingSDS(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) +{ + num_coeffs = 3; + size_history = 3; +} + +/* ---------------------------------------------------------------------- */ + +void GSMTwistingSDS::coeffs_to_local() +{ + k = coeffs[0]; + damp = coeffs[1]; + mu = coeffs[2]; + + if (k < 0.0 || mu < 0.0 || damp < 0.0) + error->all(FLERR, "Illegal SDS twisting model"); +} + +/* ---------------------------------------------------------------------- */ + +void GSMTwistingSDS::calculate_forces() +{ + double signtwist, Mtcrit; + + if (gm->history_update) { + gm->history[history_index] += gm->magtwist * gm->dt; + } + + // M_t torque (eq 30) + gm->magtortwist = -k * gm->history[history_index] - damp * gm->magtwist; + signtwist = (gm->magtwist > 0) - (gm->magtwist < 0); + Mtcrit = mu * gm->normal_model->Fncrit; // critical torque (eq 44) + + if (fabs(gm->magtortwist) > Mtcrit) { + gm->history[history_index] = (Mtcrit * signtwist - damp * gm->magtwist) / k; + gm->magtortwist = -Mtcrit * signtwist; // eq 34 + } +} diff --git a/src/GRANULAR/gsm_twisting.h b/src/GRANULAR/gsm_twisting.h new file mode 100644 index 0000000000..9fb859df08 --- /dev/null +++ b/src/GRANULAR/gsm_twisting.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef GSM_TWISTING_H_ +#define GSM_TWISTING_H_ + +#include "gsm.h" + +namespace LAMMPS_NS { +namespace Granular_NS { + +class GSMTwisting : public GSM { + public: + GSMTwisting(class GranularModel *, class LAMMPS *); + virtual ~GSMTwisting() {}; + virtual void coeffs_to_local() {}; + virtual void init() {}; + virtual void calculate_forces() = 0; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTwistingNone : public GSMTwisting { + public: + GSMTwistingNone(class GranularModel *, class LAMMPS *); + void calculate_forces() {}; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTwistingMarshall : public GSMTwisting { + public: + GSMTwistingMarshall(class GranularModel *, class LAMMPS *); + void calculate_forces(); + void init(); + protected: + double k_tang, mu_tang; +}; + +/* ---------------------------------------------------------------------- */ + +class GSMTwistingSDS : public GSMTwisting { + public: + GSMTwistingSDS(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void calculate_forces(); + protected: + double k, mu, damp; +}; + +} // namespace Granular_NS +} // namespace LAMMPS_NS + +#endif /*GSM_TWISTING_H_ */ diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 63354a4eda..6264d8baeb 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -22,14 +22,8 @@ #include "atom.h" #include "comm.h" -#include "contact.h" -#include "contact_sub_models.h" -#include "contact_normal_models.h" -#include "contact_tangential_models.h" -#include "contact_damping_models.h" -#include "contact_rolling_models.h" -#include "contact_twisting_models.h" -#include "contact_heat_models.h" +#include "granular_model.h" +#include "gsm.h" #include "error.h" #include "fix.h" #include "fix_dummy.h" @@ -47,7 +41,7 @@ #include using namespace LAMMPS_NS; -using namespace Contact; +using namespace Granular_NS; using namespace MathExtra; /* ---------------------------------------------------------------------- */ @@ -250,7 +244,6 @@ void PairGranular::compute(int eflag, int vflag) models[itype][jtype]->Ti = temperature[i]; models[itype][jtype]->Tj = temperature[j]; } - models[itype][jtype]->prep_contact(); models[itype][jtype]->calculate_forces(); @@ -304,7 +297,7 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - models.resize(n+1, std::vector (n+1, nullptr)); + models.resize(n+1, std::vector (n+1, nullptr)); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -347,74 +340,37 @@ void PairGranular::coeff(int narg, char **arg) //Parse mandatory specification int iarg = 2; - vec_models.back().init_model(std::string(arg[iarg++]), NORMAL); - iarg = vec_models.back().normal_model->parse_coeffs(arg, iarg, narg); + iarg = vec_models.back().init_submodel(arg, iarg, narg, NORMAL); //Parse optional arguments while (iarg < narg) { if (strcmp(arg[iarg], "tangential") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR,"Illegal pair_coeff command, must specify " - "tangential model after tangential keyword"); - vec_models.back().init_model(std::string(arg[iarg++]), TANGENTIAL); - iarg = vec_models.back().tangential_model->parse_coeffs(arg, iarg, narg); - + iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "damping") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal pair_coeff command, must specify " - "damping model after damping keyword"); - vec_models.back().init_model(std::string(arg[iarg++]), DAMPING); - iarg = vec_models.back().damping_model->parse_coeffs(arg, iarg, narg); - + iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal pair_coeff command, must specify " - "rolling model after rolling keyword"); - vec_models.back().init_model(std::string(arg[iarg++]), ROLLING); - iarg = vec_models.back().rolling_model->parse_coeffs(arg, iarg, narg); - + iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal pair_coeff command, must specify " - "twisting model after twisting keyword"); - vec_models.back().init_model(std::string(arg[iarg++]), TWISTING); - iarg = vec_models.back().twisting_model->parse_coeffs(arg, iarg, narg); - + iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg++; - if (iarg >= narg) - error->all(FLERR, "Illegal pair_coeff command, must specify " - "heat model after heat keyword"); - vec_models.back().init_model(std::string(arg[iarg++]), HEAT); - iarg = vec_models.back().heat_model->parse_coeffs(arg, iarg, narg); + iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, HEAT); heat_flag = 1; - } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters for cutoff keyword"); - cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); + cutoff_one = utils::numeric(FLERR,arg[iarg + 1],false,lmp); iarg += 2; - } else if (strcmp(arg[iarg], "limit_damping") == 0) { vec_models.back().limit_damping = 1; iarg += 1; - } else error->all(FLERR, "Illegal pair_coeff command {}", arg[iarg]); } // Define default damping model if unspecified, has no coeffs if (!vec_models.back().damping_model) - vec_models.back().init_model("viscoelastic", DAMPING); - - if (vec_models.back().limit_damping && !vec_models.back().normal_model->allow_limit_damping) - error->all(FLERR,"Illegal pair_coeff command, " - "Cannot limit damping with specified normal contact model"); + vec_models.back().construct_submodel("viscoelastic", DAMPING); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -568,7 +524,7 @@ double PairGranular::init_one(int i, int j) if (setflag[i][j] == 0) { - vec_models.push_back(ContactModel(lmp)); + vec_models.push_back(GranularModel(lmp)); models[i][j] = models[j][i] = & vec_models.back(); int error_code = vec_models.back().mix_coeffs(models[i][i], models[j][j]); @@ -680,7 +636,7 @@ void PairGranular::read_restart(FILE *fp) MPI_Bcast(&nmodels,1,MPI_INT,0,world); for (i = 0; i < nmodels; i++) { - vec_models.push_back(ContactModel(lmp)); + vec_models.push_back(GranularModel(lmp)); vec_models.back().read_restart(fp); vec_models.back().init(); } @@ -737,7 +693,6 @@ double PairGranular::single(int i, int j, int itype, int jtype, if ((i >= nall) || (j >= nall)) error->all(FLERR,"Not enough atoms for pair granular single function"); - int touchflag; double **x = atom->x; double *radius = atom->radius; @@ -776,20 +731,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; - // Copy additional information and prepare force calculations - double **v = atom->v; - double **omega = atom->omega; - - models[itype][jtype]->meff = meff; - models[itype][jtype]->vi = v[i]; - models[itype][jtype]->vj = v[j]; - models[itype][jtype]->omegai = omega[i]; - models[itype][jtype]->omegaj = omega[j]; - models[itype][jtype]->history = history; - models[itype][jtype]->prep_contact(); - // if any history is needed - jnum = list->numneigh[i]; jlist = list->firstneigh[i]; @@ -805,6 +747,17 @@ double PairGranular::single(int i, int j, int itype, int jtype, history = &allhistory[size_history*neighprev]; } + // Copy additional information and calculate forces + double **v = atom->v; + double **omega = atom->omega; + + models[itype][jtype]->meff = meff; + models[itype][jtype]->vi = v[i]; + models[itype][jtype]->vj = v[j]; + models[itype][jtype]->omegai = omega[i]; + models[itype][jtype]->omegaj = omega[j]; + models[itype][jtype]->history = history; + double *forces, *torquesi, *torquesj; models[itype][jtype]->calculate_forces(); forces = models[itype][jtype]->forces; diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index ae85748488..be8b6402a5 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -20,7 +20,7 @@ PairStyle(granular,PairGranular); #ifndef LMP_PAIR_GRANULAR_H #define LMP_PAIR_GRANULAR_H -#include "contact.h" +#include "granular_model.h" #include "pair.h" #include @@ -71,9 +71,9 @@ class PairGranular : public Pair { int size_history; int heat_flag; - // contact models - std::vector vec_models; - std::vector > models; + // granular models + std::vector vec_models; + std::vector > models; // optional user-specified global cutoff, per-type user-specified cutoffs double **cutoff_type; diff --git a/src/GRANULAR/contact.cpp b/src/contact.cpp similarity index 100% rename from src/GRANULAR/contact.cpp rename to src/contact.cpp diff --git a/src/GRANULAR/contact.h b/src/contact.h similarity index 100% rename from src/GRANULAR/contact.h rename to src/contact.h diff --git a/src/GRANULAR/contact_damping_models.cpp b/src/contact_damping_models.cpp similarity index 100% rename from src/GRANULAR/contact_damping_models.cpp rename to src/contact_damping_models.cpp diff --git a/src/GRANULAR/contact_damping_models.h b/src/contact_damping_models.h similarity index 100% rename from src/GRANULAR/contact_damping_models.h rename to src/contact_damping_models.h diff --git a/src/GRANULAR/contact_heat_models.cpp b/src/contact_heat_models.cpp similarity index 100% rename from src/GRANULAR/contact_heat_models.cpp rename to src/contact_heat_models.cpp diff --git a/src/GRANULAR/contact_heat_models.h b/src/contact_heat_models.h similarity index 100% rename from src/GRANULAR/contact_heat_models.h rename to src/contact_heat_models.h diff --git a/src/GRANULAR/contact_normal_models.cpp b/src/contact_normal_models.cpp similarity index 100% rename from src/GRANULAR/contact_normal_models.cpp rename to src/contact_normal_models.cpp diff --git a/src/GRANULAR/contact_normal_models.h b/src/contact_normal_models.h similarity index 100% rename from src/GRANULAR/contact_normal_models.h rename to src/contact_normal_models.h diff --git a/src/GRANULAR/contact_rolling_models.cpp b/src/contact_rolling_models.cpp similarity index 100% rename from src/GRANULAR/contact_rolling_models.cpp rename to src/contact_rolling_models.cpp diff --git a/src/GRANULAR/contact_rolling_models.h b/src/contact_rolling_models.h similarity index 100% rename from src/GRANULAR/contact_rolling_models.h rename to src/contact_rolling_models.h diff --git a/src/GRANULAR/contact_sub_models.cpp b/src/contact_sub_models.cpp similarity index 100% rename from src/GRANULAR/contact_sub_models.cpp rename to src/contact_sub_models.cpp diff --git a/src/GRANULAR/contact_sub_models.h b/src/contact_sub_models.h similarity index 100% rename from src/GRANULAR/contact_sub_models.h rename to src/contact_sub_models.h diff --git a/src/GRANULAR/contact_tangential_models.cpp b/src/contact_tangential_models.cpp similarity index 100% rename from src/GRANULAR/contact_tangential_models.cpp rename to src/contact_tangential_models.cpp diff --git a/src/GRANULAR/contact_tangential_models.h b/src/contact_tangential_models.h similarity index 100% rename from src/GRANULAR/contact_tangential_models.h rename to src/contact_tangential_models.h diff --git a/src/GRANULAR/contact_twisting_models.cpp b/src/contact_twisting_models.cpp similarity index 100% rename from src/GRANULAR/contact_twisting_models.cpp rename to src/contact_twisting_models.cpp diff --git a/src/GRANULAR/contact_twisting_models.h b/src/contact_twisting_models.h similarity index 100% rename from src/GRANULAR/contact_twisting_models.h rename to src/contact_twisting_models.h From 1eb048ef935d9c784f0435168e3c9aa24056d8eb Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 28 Oct 2022 16:00:04 -0600 Subject: [PATCH 31/57] Adding granular sub model style creator --- src/GRANULAR/fix_wall_gran.cpp | 15 ++-- src/GRANULAR/granular_model.cpp | 145 ++++++++++++++++---------------- src/GRANULAR/granular_model.h | 11 ++- src/GRANULAR/gsm.cpp | 1 - src/GRANULAR/gsm_damping.h | 25 ++++++ src/GRANULAR/gsm_heat.h | 13 +++ src/GRANULAR/gsm_normal.h | 29 +++++++ src/GRANULAR/gsm_rolling.h | 13 +++ src/GRANULAR/gsm_tangential.cpp | 12 +-- src/GRANULAR/gsm_tangential.h | 41 +++++++++ src/GRANULAR/gsm_twisting.h | 17 ++++ src/GRANULAR/pair_granular.cpp | 12 +-- src/Make.sh | 1 + 13 files changed, 236 insertions(+), 99 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 31913c6061..e6bd894f1e 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -77,7 +77,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : int iarg; if (classic_flag) { - iarg = model->init_classic_model(arg, 3, narg); + iarg = model->define_classic_model(arg, 3, narg); if (iarg < narg) { if (strcmp(arg[iarg],"limit_damping") == 0) { @@ -88,19 +88,19 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } else { iarg = 4; - iarg = model->init_submodel(arg, iarg, narg, NORMAL); + iarg = model->add_submodel(arg, iarg, narg, NORMAL); while (iarg < narg) { if (strcmp(arg[iarg], "damping") == 0) { - iarg = model->init_submodel(arg, iarg + 1, narg, DAMPING); + iarg = model->add_submodel(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "tangential") == 0) { - iarg = model->init_submodel(arg, iarg + 1, narg, TANGENTIAL); + iarg = model->add_submodel(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg = model->init_submodel(arg, iarg + 1, narg, ROLLING); + iarg = model->add_submodel(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg = model->init_submodel(arg, iarg + 1, narg, TWISTING); + iarg = model->add_submodel(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg = model->init_submodel(arg, iarg + 1, narg, HEAT); + iarg = model->add_submodel(arg, iarg + 1, narg, HEAT); heat_flag = 1; } else if (strcmp(arg[iarg], "xplane") == 0 || strcmp(arg[iarg], "yplane") == 0 || @@ -120,7 +120,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // Define default damping model if unspecified, takes no args if (!model->damping_model) model->construct_submodel("viscoelastic", DAMPING); - if (!model->tangential_model) error->all(FLERR, "No tangential model specified"); model->init(); diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index b5987d222b..a7aaa1ed83 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -40,6 +40,17 @@ using namespace LAMMPS_NS; using namespace Granular_NS; using namespace MathExtra; +/* ---------------------------------------------------------------------- + one instance per GSM style in style_gsm.h +------------------------------------------------------------------------- */ + +template static GSM *gsm_creator(GranularModel *gm, LAMMPS *lmp) +{ + return new T(gm, lmp); +} + +/* ---------------------------------------------------------------------- */ + GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) { limit_damping = 0; @@ -57,6 +68,31 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) for (int i = 0; i < NSUBMODELS; i++) sub_models[i] = nullptr; transfer_history_factor = nullptr; + + // extract info from GSM classes listed in style_gsm.h + + nclass = 0; + +#define GSM_CLASS +#define GSMStyle(key,Class,type) nclass++; +#include "style_gsm.h" // IWYU pragma: keep +#undef GSMStyle +#undef GSM_CLASS + + gsmclass = new GSMCreator[nclass]; + gsmnames = new char*[nclass]; + gsmtypes = new int[nclass]; + nclass = 0; + +#define GSM_CLASS +#define GSMStyle(key,Class,type) \ + gsmclass[nclass] = &gsm_creator; \ + gsmnames[nclass] = (char *) #key; \ + gsmtypes[nclass++] = type; +#include "style_gsm.h" // IWYU pragma: keep +#undef GSMStyle +#undef GSM_CLASS + } /* ---------------------------------------------------------------------- */ @@ -75,7 +111,7 @@ GranularModel::~GranularModel() /* ---------------------------------------------------------------------- */ -int GranularModel::init_submodel(char **arg, int iarg, int narg, SubmodelType model_type) +int GranularModel::add_submodel(char **arg, int iarg, int narg, SubmodelType model_type) { if (iarg >= narg) error->all(FLERR, "Must specify granular submodel name"); @@ -92,6 +128,7 @@ int GranularModel::init_submodel(char **arg, int iarg, int narg, SubmodelType mo if (strcmp(arg[iarg + i], "NULL") == 0) sub_models[model_type]->coeffs[i] = -1; else sub_models[model_type]->coeffs[i] = utils::numeric(FLERR,arg[iarg + i],false,lmp); } + sub_models[model_type]->coeffs_to_local(); return iarg + num_coeffs; @@ -101,80 +138,34 @@ int GranularModel::init_submodel(char **arg, int iarg, int narg, SubmodelType mo void GranularModel::construct_submodel(std::string model_name, SubmodelType model_type) { -if (model_type == NORMAL) { - delete normal_model; - if (model_name == "none") normal_model = new GSMNormalNone(this, lmp); - else if (model_name == "hooke") normal_model = new GSMNormalHooke(this, lmp); - else if (model_name == "hertz") normal_model = new GSMNormalHertz(this, lmp); - else if (model_name == "hertz/material") normal_model = new GSMNormalHertzMaterial(this, lmp); - else if (model_name == "dmt") normal_model = new GSMNormalDMT(this, lmp); - else if (model_name == "jkr") normal_model = new GSMNormalJKR(this, lmp); - else error->all(FLERR, "Normal model name {} not recognized", model_name); - sub_models[model_type] = normal_model; - - } else if (model_type == TANGENTIAL) { - delete tangential_model; - if (model_name == "none") tangential_model = new GSMTangentialNone(this, lmp); - else if (model_name == "linear_nohistory") tangential_model = new GSMTangentialLinearNoHistory(this, lmp); - else if (model_name == "linear_history") tangential_model = new GSMTangentialLinearHistory(this, lmp); - else if (model_name == "linear_history_classic") tangential_model = new GSMTangentialLinearHistoryClassic(this, lmp); - else if (model_name == "mindlin") tangential_model = new GSMTangentialMindlin(this, lmp); - else if (model_name == "mindlin/force") tangential_model = new GSMTangentialMindlinForce(this, lmp); - else if (model_name == "mindlin_rescale") tangential_model = new GSMTangentialMindlinRescale(this, lmp); - else if (model_name == "mindlin_rescale/force") tangential_model = new GSMTangentialMindlinRescaleForce(this, lmp); - else error->all(FLERR, "Tangential model name {} not recognized", model_name); - sub_models[model_type] = tangential_model; - - } else if (model_type == DAMPING) { - delete damping_model; - if (model_name == "none") damping_model = new GSMDampingNone(this, lmp); - else if (model_name == "velocity") damping_model = new GSMDampingVelocity(this, lmp); - else if (model_name == "mass_velocity") damping_model = new GSMDampingMassVelocity(this, lmp); - else if (model_name == "viscoelastic") damping_model = new GSMDampingViscoelastic(this, lmp); - else if (model_name == "tsuji") damping_model = new GSMDampingTsuji(this, lmp); - else error->all(FLERR, "Damping model name {} not recognized", model_name); - sub_models[model_type] = damping_model; - - } else if (model_type == ROLLING) { - delete rolling_model; - rolling_defined = 1; - if (model_name == "none") { - rolling_model = new GSMRollingNone(this, lmp); - rolling_defined = 0; - } else if (model_name == "sds") rolling_model = new GSMRollingSDS(this, lmp); - else error->all(FLERR, "Rolling model name {} not recognized", model_name); - sub_models[model_type] = rolling_model; - - } else if (model_type == TWISTING) { - delete twisting_model; - twisting_defined = 1; - if (model_name == "none") { - twisting_model = new GSMTwistingNone(this, lmp); - twisting_defined = 0; - } else if (model_name == "sds") twisting_model = new GSMTwistingSDS(this, lmp); - else if (model_name == "marshall") twisting_model = new GSMTwistingMarshall(this, lmp); - else error->all(FLERR, "Twisting model name {} not recognized", model_name); - sub_models[model_type] = twisting_model; - - } else if (model_type == HEAT) { - delete heat_model; - heat_defined = 1; - if (model_name == "none") { - heat_model = new GSMHeatNone(this, lmp); - heat_defined = 0; - } else if (model_name == "area") heat_model = new GSMHeatArea(this, lmp); - else error->all(FLERR, "Heat model name not {} recognized", model_name); - sub_models[model_type] = heat_model; - } else { - error->all(FLERR, "Illegal model type {}", model_type); + int i; + for (i = 0; i < nclass; i++) { + if (gsmtypes[i] == model_type) { + if (strcmp(gsmnames[i], model_name.c_str()) == 0) { + GSMCreator &gsm_creator = gsmclass[i]; + sub_models[model_type] = gsm_creator(this, lmp); + break; + } + } } + if (i == nclass) + error->all(FLERR, "Illegal model type {}", model_type); + sub_models[model_type]->name.assign(model_name); + sub_models[model_type]->allocate_coeffs(); + + if (model_type == NORMAL) normal_model = dynamic_cast (sub_models[NORMAL]); + if (model_type == DAMPING) damping_model = dynamic_cast (sub_models[DAMPING]); + if (model_type == TANGENTIAL) tangential_model = dynamic_cast (sub_models[TANGENTIAL]); + if (model_type == ROLLING) rolling_model = dynamic_cast (sub_models[ROLLING]); + if (model_type == TWISTING) twisting_model = dynamic_cast (sub_models[TWISTING]); + if (model_type == HEAT) heat_model = dynamic_cast (sub_models[HEAT]); } /* ---------------------------------------------------------------------- */ -int GranularModel::init_classic_model(char **arg, int iarg, int narg) +int GranularModel::define_classic_model(char **arg, int iarg, int narg) { double kn, kt, gamman, gammat, xmu; @@ -212,7 +203,7 @@ int GranularModel::init_classic_model(char **arg, int iarg, int narg) kn /= force->nktv2p; kt /= force->nktv2p; construct_submodel("hertz", NORMAL); - construct_submodel("mindlin", TANGENTIAL); + construct_submodel("mindlin_classic", TANGENTIAL); construct_submodel("viscoelastic", DAMPING); } else error->all(FLERR,"Invalid classic gran model"); @@ -240,8 +231,7 @@ int GranularModel::init_classic_model(char **arg, int iarg, int narg) void GranularModel::init() { - int i, j; - for (i = 0; i < NSUBMODELS; i++) + for (int i = 0; i < NSUBMODELS; i++) if (!sub_models[i]) construct_submodel("none", (SubmodelType) i); // Must have valid normal, damping, and tangential models @@ -249,9 +239,15 @@ void GranularModel::init() if (damping_model->name == "none") error->all(FLERR, "Must specify damping granular model"); if (tangential_model->name == "none") error->all(FLERR, "Must specify tangential granular model"); + // Twisting, rolling, and heat are optional + twisting_defined = rolling_defined = heat_defined = 1; + if (twisting_model->name == "none") twisting_defined = 0; + if (rolling_model->name == "none") rolling_defined = 0; + if (heat_model->name == "none") heat_defined = 0; + int size_cumulative; size_history = 0; - for (i = 0; i < NSUBMODELS; i++) { + for (int i = 0; i < NSUBMODELS; i++) { if (sub_models[i]->nondefault_history_transfer) nondefault_history_transfer = 1; if (sub_models[i]->beyond_contact) @@ -264,7 +260,8 @@ void GranularModel::init() if (nondefault_history_transfer) { transfer_history_factor = new double[size_history]; - for (i = 0; i < size_history; i++) { + int j; + for (int i = 0; i < size_history; i++) { // Find which model owns this history value size_cumulative = 0; for (j = 0; j < NSUBMODELS; j++) { @@ -282,7 +279,7 @@ void GranularModel::init() } } - for (i = 0; i < NSUBMODELS; i++) sub_models[i]->init(); + for (int i = 0; i < NSUBMODELS; i++) sub_models[i]->init(); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index cc94f49a1e..afc8f61ddc 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -55,8 +55,8 @@ class GranularModel : protected Pointers { void calculate_forces(); double pulloff_distance(double, double); - int init_submodel(char **, int, int, SubmodelType); - int init_classic_model(char **, int, int); + int add_submodel(char **, int, int, SubmodelType); + int define_classic_model(char **, int, int); void construct_submodel(std::string, SubmodelType); int mix_coeffs(GranularModel*, GranularModel*); @@ -99,6 +99,13 @@ class GranularModel : protected Pointers { protected: int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels int classic_model; + + int nclass; + + typedef class GSM *(*GSMCreator)(class GranularModel *, class LAMMPS *); + GSMCreator *gsmclass; + char **gsmnames; + int *gsmtypes; }; } // namespace Granular_NS diff --git a/src/GRANULAR/gsm.cpp b/src/GRANULAR/gsm.cpp index 17b816ad21..6430fb7403 100644 --- a/src/GRANULAR/gsm.cpp +++ b/src/GRANULAR/gsm.cpp @@ -45,7 +45,6 @@ GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) nondefault_history_transfer = 0; transfer_history_factor = nullptr; - allocate_coeffs(); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_damping.h b/src/GRANULAR/gsm_damping.h index ab12cbc2d3..1904314cdc 100644 --- a/src/GRANULAR/gsm_damping.h +++ b/src/GRANULAR/gsm_damping.h @@ -11,6 +11,30 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef GSM_CLASS +// clang-format off +GSMStyle(none, + GSMDampingNone, + DAMPING); + +GSMStyle(velocity, + GSMDampingVelocity, + DAMPING); + +GSMStyle(mass_velocity, + GSMDampingMassVelocity, + DAMPING); + +GSMStyle(viscoelastic, + GSMDampingViscoelastic, + DAMPING); + +GSMStyle(tsuji, + GSMDampingTsuji, + DAMPING); +// clang-format on +#else + #ifndef GSM_DAMPING_H_ #define GSM_DAMPING_H_ @@ -77,3 +101,4 @@ class GSMDampingTsuji : public GSMDamping { } // namespace LAMMPS_NS #endif /*GSM_DAMPING_H_ */ +#endif /*GSM_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_heat.h b/src/GRANULAR/gsm_heat.h index f397d555b6..4b27979273 100644 --- a/src/GRANULAR/gsm_heat.h +++ b/src/GRANULAR/gsm_heat.h @@ -11,6 +11,18 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef GSM_CLASS +// clang-format off +GSMStyle(none, + GSMHeatNone, + HEAT); + +GSMStyle(area, + GSMHeatArea, + HEAT); +// clang-format on +#else + #ifndef GSM_HEAT_H_ #define GSM_HEAT_H_ @@ -51,3 +63,4 @@ class GSMHeatArea : public GSMHeat { } // namespace LAMMPS_NS #endif /*GSM_HEAT_H_ */ +#endif /*GSM_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_normal.h b/src/GRANULAR/gsm_normal.h index 31587dfd03..0c7ba30e41 100644 --- a/src/GRANULAR/gsm_normal.h +++ b/src/GRANULAR/gsm_normal.h @@ -11,6 +11,34 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef GSM_CLASS +// clang-format off +GSMStyle(none, + GSMNormalNone, + NORMAL); + +GSMStyle(hooke, + GSMNormalHooke, + NORMAL); + +GSMStyle(hertz, + GSMNormalHertz, + NORMAL); + +GSMStyle(hertz/material, + GSMNormalHertzMaterial, + NORMAL); + +GSMStyle(dmt, + GSMNormalDMT, + NORMAL); + +GSMStyle(jkr, + GSMNormalJKR, + NORMAL); +// clang-format on +#else + #ifndef GSM_NORMAL_H_ #define GSM_NORMAL_H_ @@ -116,3 +144,4 @@ class GSMNormalJKR : public GSMNormal { } // namespace LAMMPS_NS #endif /*GSM_NORMAL_H_ */ +#endif /*GSM_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_rolling.h b/src/GRANULAR/gsm_rolling.h index 44f45b583d..21e61ac4bc 100644 --- a/src/GRANULAR/gsm_rolling.h +++ b/src/GRANULAR/gsm_rolling.h @@ -11,6 +11,18 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef GSM_CLASS +// clang-format off +GSMStyle(none, + GSMRollingNone, + ROLLING); + +GSMStyle(sds, + GSMRollingSDS, + ROLLING); +// clang-format on +#else + #ifndef GSM_ROLLING_H_ #define GSM_ROLLING_H_ @@ -51,3 +63,4 @@ class GSMRollingSDS : public GSMRolling { } // namespace LAMMPS_NS #endif /*GSM_ROLLING_H_ */ +#endif /*GSM_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_tangential.cpp b/src/GRANULAR/gsm_tangential.cpp index 1f6213d708..b3e6266049 100644 --- a/src/GRANULAR/gsm_tangential.cpp +++ b/src/GRANULAR/gsm_tangential.cpp @@ -172,13 +172,10 @@ GSMTangentialLinearHistoryClassic::GSMTangentialLinearHistoryClassic(GranularMod void GSMTangentialLinearHistoryClassic::calculate_forces() { - double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; + double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; int frame_update = 0; - k_scaled = k; - if (scale_area) k_scaled *= gm->area; - damp = xt * gm->damping_model->damp_prefactor; double Fscrit = gm->normal_model->Fncrit * mu; @@ -200,7 +197,8 @@ void GSMTangentialLinearHistoryClassic::calculate_forces() } // tangential forces = history + tangential velocity damping - scale3(-k_scaled, history, gm->fs); + if (scale_area) scale3(-k * gm->area, history, gm->fs); + else scale3(-k, history, gm->fs); scale3(damp, gm->vtr, temp_array); sub3(gm->fs, temp_array, gm->fs); @@ -212,9 +210,7 @@ void GSMTangentialLinearHistoryClassic::calculate_forces() scale3(Fscrit * magfs_inv, gm->fs, history); scale3(damp, gm->vtr, temp_array); add3(history, temp_array, history); - temp_dbl = -1.0 / k_scaled; - if (scale_area) temp_dbl /= gm->area; - scale3(temp_dbl, history); + scale3(-1.0 / k, history); scale3(Fscrit * magfs_inv, gm->fs); } else { zero3(gm->fs); diff --git a/src/GRANULAR/gsm_tangential.h b/src/GRANULAR/gsm_tangential.h index 8e1d644fea..a420c7d314 100644 --- a/src/GRANULAR/gsm_tangential.h +++ b/src/GRANULAR/gsm_tangential.h @@ -11,6 +11,46 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef GSM_CLASS +// clang-format off +GSMStyle(none, + GSMTangentialNone, + TANGENTIAL); + +GSMStyle(linear_nohistory, + GSMTangentialLinearNoHistory, + TANGENTIAL); + +GSMStyle(linear_history, + GSMTangentialLinearHistory, + TANGENTIAL); + +GSMStyle(linear_history_classic, + GSMTangentialLinearHistoryClassic, + TANGENTIAL); + +GSMStyle(mindlin_classic, + GSMTangentialMindlinClassic, + TANGENTIAL); + +GSMStyle(mindlin, + GSMTangentialMindlin, + TANGENTIAL); + +GSMStyle(mindlin/force, + GSMTangentialMindlinForce, + TANGENTIAL); + +GSMStyle(mindlin_rescale, + GSMTangentialMindlinRescale, + TANGENTIAL); + +GSMStyle(mindlin_rescale/force, + GSMTangentialMindlinRescaleForce, + TANGENTIAL); +// clang-format on +#else + #ifndef GSM_TANGENTIAL_H_ #define GSM_TANGENTIAL_H_ @@ -111,3 +151,4 @@ class GSMTangentialMindlinRescaleForce : public GSMTangentialMindlin { } // namespace LAMMPS_NS #endif /*GSM_TANGENTIAL_H_ */ +#endif /*GSM_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_twisting.h b/src/GRANULAR/gsm_twisting.h index 9fb859df08..84759acce7 100644 --- a/src/GRANULAR/gsm_twisting.h +++ b/src/GRANULAR/gsm_twisting.h @@ -11,6 +11,22 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef GSM_CLASS +// clang-format off +GSMStyle(none, + GSMTwistingNone, + TWISTING); + +GSMStyle(marshall, + GSMTwistingMarshall, + TWISTING); + +GSMStyle(sds, + GSMTwistingSDS, + TWISTING); +// clang-format on +#else + #ifndef GSM_TWISTING_H_ #define GSM_TWISTING_H_ @@ -62,3 +78,4 @@ class GSMTwistingSDS : public GSMTwisting { } // namespace LAMMPS_NS #endif /*GSM_TWISTING_H_ */ +#endif /*GSM_CLASS_H_ */ diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 6264d8baeb..a6fcde4589 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -340,22 +340,22 @@ void PairGranular::coeff(int narg, char **arg) //Parse mandatory specification int iarg = 2; - iarg = vec_models.back().init_submodel(arg, iarg, narg, NORMAL); + iarg = vec_models.back().add_submodel(arg, iarg, narg, NORMAL); //Parse optional arguments while (iarg < narg) { if (strcmp(arg[iarg], "tangential") == 0) { - iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, TANGENTIAL); + iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "damping") == 0) { - iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, DAMPING); + iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, ROLLING); + iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, TWISTING); + iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg = vec_models.back().init_submodel(arg, iarg + 1, narg, HEAT); + iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, HEAT); heat_flag = 1; } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) diff --git a/src/Make.sh b/src/Make.sh index 0fe39f0224..da034f8226 100755 --- a/src/Make.sh +++ b/src/Make.sh @@ -104,6 +104,7 @@ if (test $cmd = "style") || (test $cmd = "packages") then $cmd DIHEDRAL_CLASS dihedral_ dihedral force $cmd DUMP_CLASS dump_ dump output write_dump $cmd FIX_CLASS fix_ fix modify + $cmd GSM_CLASS gsm_ gsm granular_model $cmd IMPROPER_CLASS improper_ improper force $cmd INTEGRATE_CLASS "" integrate update $cmd KSPACE_CLASS "" kspace force From f66179f3364d2df1fc034aaf37f84e95d7b31712 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 28 Oct 2022 16:38:32 -0600 Subject: [PATCH 32/57] Removing old contact files, fixing capitalization in dump_custom.cpp --- src/contact.cpp | 479 ------------------------------ src/contact.h | 107 ------- src/contact_damping_models.cpp | 113 ------- src/contact_damping_models.h | 79 ----- src/contact_heat_models.cpp | 63 ---- src/contact_heat_models.h | 53 ---- src/contact_normal_models.cpp | 377 ----------------------- src/contact_normal_models.h | 118 -------- src/contact_rolling_models.cpp | 121 -------- src/contact_rolling_models.h | 53 ---- src/contact_sub_models.cpp | 140 --------- src/contact_sub_models.h | 62 ---- src/contact_tangential_models.cpp | 412 ------------------------- src/contact_tangential_models.h | 113 ------- src/contact_twisting_models.cpp | 124 -------- src/contact_twisting_models.h | 64 ---- src/dump_custom.cpp | 6 +- 17 files changed, 3 insertions(+), 2481 deletions(-) delete mode 100644 src/contact.cpp delete mode 100644 src/contact.h delete mode 100644 src/contact_damping_models.cpp delete mode 100644 src/contact_damping_models.h delete mode 100644 src/contact_heat_models.cpp delete mode 100644 src/contact_heat_models.h delete mode 100644 src/contact_normal_models.cpp delete mode 100644 src/contact_normal_models.h delete mode 100644 src/contact_rolling_models.cpp delete mode 100644 src/contact_rolling_models.h delete mode 100644 src/contact_sub_models.cpp delete mode 100644 src/contact_sub_models.h delete mode 100644 src/contact_tangential_models.cpp delete mode 100644 src/contact_tangential_models.h delete mode 100644 src/contact_twisting_models.cpp delete mode 100644 src/contact_twisting_models.h diff --git a/src/contact.cpp b/src/contact.cpp deleted file mode 100644 index ae294d7db9..0000000000 --- a/src/contact.cpp +++ /dev/null @@ -1,479 +0,0 @@ -// clang-format off -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- - This class contains a series of tools for DEM contacts - Multiple models can be defined and used to calculate forces - and torques based on contact geometry - - Contributing authors: - Dan Bolintineanu (SNL), Joel Clemmer (SNL) ------------------------------------------------------------------------ */ - -#include "contact.h" -#include "contact_sub_models.h" -#include "contact_normal_models.h" -#include "contact_tangential_models.h" -#include "contact_damping_models.h" -#include "contact_rolling_models.h" -#include "contact_twisting_models.h" -#include "contact_heat_models.h" -#include "comm.h" -#include "error.h" -#include "force.h" -#include "math_extra.h" - -#include - -using namespace LAMMPS_NS; -using namespace Contact; -using namespace MathExtra; - -ContactModel::ContactModel(LAMMPS *lmp) : Pointers(lmp) -{ - limit_damping = 0; - beyond_contact = 0; - nondefault_history_transfer = 0; - classic_model = 0; - contact_type = PAIR; - - normal_model = nullptr; - damping_model = nullptr; - tangential_model = nullptr; - rolling_model = nullptr; - twisting_model = nullptr; - heat_model = nullptr; - - for (int i = 0; i < NSUBMODELS; i++) sub_models[i] = nullptr; - transfer_history_factor = nullptr; -} - -/* ---------------------------------------------------------------------- */ - -ContactModel::~ContactModel() -{ - delete [] transfer_history_factor; - - delete normal_model; - delete damping_model; - delete tangential_model; - delete rolling_model; - delete twisting_model; - delete heat_model; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::init_model(std::string model_name, ModelType model_type) -{ - if (model_type == NORMAL) { - delete normal_model; - if (model_name == "none") normal_model = new NormalNone(lmp); - else if (model_name == "hooke") normal_model = new NormalHooke(lmp); - else if (model_name == "hertz") normal_model = new NormalHertz(lmp); - else if (model_name == "hertz/material") normal_model = new NormalHertzMaterial(lmp); - else if (model_name == "dmt") normal_model = new NormalDMT(lmp); - else if (model_name == "jkr") normal_model = new NormalJKR(lmp); - else error->all(FLERR, "Normal model name {} not recognized", model_name); - sub_models[model_type] = normal_model; - - } else if (model_type == TANGENTIAL) { - delete tangential_model; - if (model_name == "none") tangential_model = new TangentialNone(lmp); - else if (model_name == "linear_nohistory") tangential_model = new TangentialLinearNoHistory(lmp); - else if (model_name == "linear_history") tangential_model = new TangentialLinearHistory(lmp); - else if (model_name == "linear_history_classic") tangential_model = new TangentialLinearHistoryClassic(lmp); - else if (model_name == "mindlin") tangential_model = new TangentialMindlin(lmp); - else if (model_name == "mindlin/force") tangential_model = new TangentialMindlinForce(lmp); - else if (model_name == "mindlin_rescale") tangential_model = new TangentialMindlinRescale(lmp); - else if (model_name == "mindlin_rescale/force") tangential_model = new TangentialMindlinRescaleForce(lmp); - else error->all(FLERR, "Tangential model name {} not recognized", model_name); - sub_models[model_type] = tangential_model; - - } else if (model_type == DAMPING) { - delete damping_model; - if (model_name == "none") damping_model = new DampingNone(lmp); - else if (model_name == "velocity") damping_model = new DampingVelocity(lmp); - else if (model_name == "mass_velocity") damping_model = new DampingMassVelocity(lmp); - else if (model_name == "viscoelastic") damping_model = new DampingViscoelastic(lmp); - else if (model_name == "tsuji") damping_model = new DampingTsuji(lmp); - else error->all(FLERR, "Damping model name {} not recognized", model_name); - sub_models[model_type] = damping_model; - - } else if (model_type == ROLLING) { - delete rolling_model; - rolling_defined = 1; - if (model_name == "none") { - rolling_model = new RollingNone(lmp); - rolling_defined = 0; - } else if (model_name == "sds") rolling_model = new RollingSDS(lmp); - else error->all(FLERR, "Rolling model name {} not recognized", model_name); - sub_models[model_type] = rolling_model; - - } else if (model_type == TWISTING) { - delete twisting_model; - twisting_defined = 1; - if (model_name == "none") { - twisting_model = new TwistingNone(lmp); - twisting_defined = 0; - } else if (model_name == "sds") twisting_model = new TwistingSDS(lmp); - else if (model_name == "marshall") twisting_model = new TwistingMarshall(lmp); - else error->all(FLERR, "Twisting model name {} not recognized", model_name); - sub_models[model_type] = twisting_model; - - } else if (model_type == HEAT) { - delete heat_model; - heat_defined = 1; - if (model_name == "none") { - heat_model = new HeatNone(lmp); - heat_defined = 0; - } else if (model_name == "area") heat_model = new HeatArea(lmp); - else error->all(FLERR, "Heat model name not {} recognized", model_name); - sub_models[model_type] = heat_model; - } else { - error->all(FLERR, "Illegal model type {}", model_type); - } - - sub_models[model_type]->name.assign(model_name); - sub_models[model_type]->contact = this; - sub_models[model_type]->allocate_coeffs(); -} - -/* ---------------------------------------------------------------------- */ - -int ContactModel::init_classic_model(char **arg, int iarg, int narg) -{ - double kn, kt, gamman, gammat, xmu; - - classic_model = 1; - - if (iarg + 6 >= narg) - error->all(FLERR,"Insufficient arguments provided for classic gran model command"); - - kn = utils::numeric(FLERR,arg[iarg + 1],false,lmp); - if (strcmp(arg[iarg + 2],"NULL") == 0) kt = kn * 2.0 / 7.0; - else kt = utils::numeric(FLERR,arg[iarg + 2],false,lmp); - - gamman = utils::numeric(FLERR,arg[iarg + 3],false,lmp); - if (strcmp(arg[iarg + 4],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = utils::numeric(FLERR,arg[iarg + 4],false,lmp); - - xmu = utils::numeric(FLERR,arg[iarg + 5],false,lmp); - int dampflag = utils::inumeric(FLERR,arg[iarg + 6],false,lmp); - if (dampflag == 0) gammat = 0.0; - - if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || - xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) - error->all(FLERR,"Illegal classic gran model command"); - - if (strcmp(arg[iarg],"hooke") == 0) { - init_model("hooke", NORMAL); - init_model("linear_nohistory", TANGENTIAL); - init_model("mass_velocity", DAMPING); - } else if (strcmp(arg[iarg],"hooke/history") == 0) { - init_model("hooke", NORMAL); - init_model("linear_history_classic", TANGENTIAL); - init_model("mass_velocity", DAMPING); - } else if (strcmp(arg[iarg],"hertz/history") == 0) { - // convert Kn and Kt from pressure units to force/distance^2 if Hertzian - kn /= force->nktv2p; - kt /= force->nktv2p; - init_model("hertz", NORMAL); - init_model("mindlin", TANGENTIAL); - init_model("viscoelastic", DAMPING); - } else error->all(FLERR,"Invalid classic gran model"); - - // ensure additional models are undefined - init_model("none", ROLLING); - init_model("none", TWISTING); - init_model("none", HEAT); - - // manually parse coeffs - normal_model->coeffs[0] = kn; - normal_model->coeffs[1] = gamman; - tangential_model->coeffs[0] = kt; - tangential_model->coeffs[1] = gammat / gamman; - tangential_model->coeffs[2] = xmu; - - normal_model->coeffs_to_local(); - tangential_model->coeffs_to_local(); - damping_model->coeffs_to_local(); - - iarg += 7; - return iarg; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::init() -{ - int i, j; - for (i = 0; i < NSUBMODELS; i++) - if (!sub_models[i]) init_model("none", (ModelType) i); - - // Must have valid normal, damping, and tangential models - if (normal_model->name == "none") error->all(FLERR, "Must specify normal contact model"); - if (damping_model->name == "none") error->all(FLERR, "Must specify damping contact model"); - if (tangential_model->name == "none") error->all(FLERR, "Must specify tangential contact model"); - - int size_cumulative; - size_history = 0; - for (i = 0; i < NSUBMODELS; i++) { - if (sub_models[i]->nondefault_history_transfer) - nondefault_history_transfer = 1; - if (sub_models[i]->beyond_contact) - beyond_contact = 1; - size_history += sub_models[i]->size_history; - } - - if (nondefault_history_transfer) { - transfer_history_factor = new double[size_history]; - - for (i = 0; i < size_history; i++) { - // Find which model owns this history value - size_cumulative = 0; - for (j = 0; j < NSUBMODELS; j++) { - if (size_cumulative + sub_models[j]->size_history > i) break; - size_cumulative += sub_models[j]->size_history; - } - - // Check if model has nondefault transfers, if so copy its array - transfer_history_factor[i] = -1; - if (j != NSUBMODELS) { - if (sub_models[j]->nondefault_history_transfer) { - transfer_history_factor[i] = sub_models[j]->transfer_history_factor[i - size_cumulative]; - } - } - } - } - - for (i = 0; i < NSUBMODELS; i++) sub_models[i]->init(); -} - -/* ---------------------------------------------------------------------- */ - -int ContactModel::mix_coeffs(ContactModel *c1, ContactModel *c2) -{ - int i; - for (i = 0; i < NSUBMODELS; i++) { - if (c1->sub_models[i]->name != c2->sub_models[i]->name) return i; - - init_model(c1->sub_models[i]->name, (ModelType) i); - sub_models[i]->mix_coeffs(c1->sub_models[i]->coeffs, c2->sub_models[i]->coeffs); - } - - limit_damping = MAX(c1->limit_damping, c2->limit_damping); - - return -1; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::write_restart(FILE *fp) -{ - int num_char, num_coeffs; - - for (int i = 0; i < NSUBMODELS; i++) { - num_char = sub_models[i]->name.length(); - num_coeffs = sub_models[i]->num_coeffs; - fwrite(&num_char, sizeof(int), 1, fp); - fwrite(sub_models[i]->name.data(), sizeof(char), num_char, fp); - fwrite(&num_coeffs, sizeof(int), 1, fp); - fwrite(sub_models[i]->coeffs, sizeof(double), num_coeffs, fp); - } -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::read_restart(FILE *fp) -{ - int num_char, num_coeff; - - for (int i = 0; i < NSUBMODELS; i++) { - if (comm->me == 0) - utils::sfread(FLERR, &num_char, sizeof(int), 1, fp, nullptr, error); - MPI_Bcast(&num_char, 1, MPI_INT, 0, world); - - std::string model_name (num_char, ' '); - if (comm->me == 0) - utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); - MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); - - init_model(model_name, (ModelType) i); - - if (comm->me == 0) { - utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); - if (num_coeff != sub_models[i]->num_coeffs) - error->one(FLERR, "Invalid contact model written to restart file"); - } - MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); - - if (comm->me == 0) { - utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(double), num_coeff, fp, nullptr, error); - } - MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); - sub_models[i]->coeffs_to_local(); - } -} - -/* ---------------------------------------------------------------------- */ - -bool ContactModel::check_contact() -{ - if (contact_type == WALL) { - // Used by fix_wall_gran.cpp - // radj = radius of wall - // dx already provided - rsq = lensq3(dx); - radsum = radi; - if (radj == 0) Reff = radi; - else Reff = radi * radj / (radi + radj); - } else if (contact_type == WALLREGION) { - // Used by fix_wall_gran_region.cpp - // radj = radius of wall - // dx and r already provided - rsq = r * r; - radsum = radi; - if (radj == 0) Reff = radi; - else Reff = radi * radj / (radi + radj); - } else { - sub3(xi, xj, dx); - rsq = lensq3(dx); - radsum = radi + radj; - Reff = radi * radj / radsum; - } - - touch = normal_model->touch(); - return touch; -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::prep_contact() -{ - double temp[3]; - - // Standard geometric quantities - if (contact_type != WALLREGION) r = sqrt(rsq); - rinv = 1.0 / r; - delta = radsum - r; - dR = delta * Reff; - scale3(rinv, dx, nx); - - // relative translational velocity - sub3(vi, vj, vr); - - // normal component - vnnr = dot3(vr, nx); //v_R . n - scale3(vnnr, nx, vn); - - // tangential component - sub3(vr, vn, vt); - - // relative rotational velocity - scaleadd3(radi, omegai, radj, omegaj, wr); - - // relative tangential velocities - cross3(wr, nx, temp); - sub3(vt, temp, vtr); - vrel = len3(vtr); - - if (rolling_defined || twisting_defined) - sub3(omegai, omegaj, relrot); - - if (rolling_defined) { - // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); - vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); - vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); - } - - if (twisting_defined) { - // omega_T (eq 29 of Marshall) - magtwist = dot3(relrot, nx); - } -} - -/* ---------------------------------------------------------------------- */ - -void ContactModel::calculate_forces() -{ - // calculate forces/torques - - forces[0] = 0.0; - double Fne, Fdamp, dist_to_contact; - area = normal_model->calculate_area(); - normal_model->set_knfac(); - Fne = normal_model->calculate_forces(); - - Fdamp = damping_model->calculate_forces(); - Fntot = Fne + Fdamp; - if (limit_damping && Fntot < 0.0) Fntot = 0.0; - - normal_model->set_fncrit(); // Needed for tangential, rolling, twisting - tangential_model->calculate_forces(); - if (rolling_defined) rolling_model->calculate_forces(); - if (twisting_defined) twisting_model->calculate_forces(); - - // sum contributions - - scale3(Fntot, nx, forces); - add3(forces, fs, forces); - - //May need to rethink eventually tris.. - cross3(nx, fs, torquesi); - scale3(-1, torquesi); - if (contact_type == PAIR) copy3(torquesi, torquesj); - - if (!classic_model && contact_type == PAIR) { - dist_to_contact = radi - 0.5 * delta; - scale3(dist_to_contact, torquesi); - dist_to_contact = radj - 0.5 * delta; - scale3(dist_to_contact, torquesj); - } else { - dist_to_contact = radi; - scale3(dist_to_contact, torquesi); - } - - double torroll[3]; - if (rolling_defined) { - cross3(nx, fr, torroll); - scale3(Reff, torroll); - add3(torquesi, torroll, torquesi); - if (contact_type == PAIR) sub3(torquesj, torroll, torquesj); - } - - double tortwist[3]; - if (twisting_defined) { - scale3(magtortwist, nx, tortwist); - add3(torquesi, tortwist, torquesi); - if (contact_type == PAIR) sub3(torquesj, tortwist, torquesj); - } - - if (heat_defined) { - dq = heat_model->calculate_heat(); - } -} - -/* ---------------------------------------------------------------------- - compute pull-off distance (beyond contact) for a given radius and atom type - use temporary variables since this does not use a specific contact geometry -------------------------------------------------------------------------- */ - -double ContactModel::pulloff_distance(double radi, double radj) -{ - return normal_model->pulloff_distance(radi, radj); -} diff --git a/src/contact.h b/src/contact.h deleted file mode 100644 index d1a13c5eb1..0000000000 --- a/src/contact.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef LMP_CONTACT_H -#define LMP_CONTACT_H - -#include "pointers.h" // IWYU pragma: export - -namespace LAMMPS_NS { -namespace Contact { - -#define EPSILON 1e-10 -#define NSUBMODELS 6 - -enum ModelType { - NORMAL = 0, - DAMPING = 1, - TANGENTIAL = 2, - ROLLING = 3, - TWISTING = 4, - HEAT = 5 -}; // Relative order matters since some derive coeffs from others - -enum ContactType { - PAIR = 0, - WALL = 1, - WALLREGION = 2 -}; - -// forward declaration -class NormalModel; -class DampingModel; -class TangentialModel; -class RollingModel; -class TwistingModel; -class HeatModel; -class SubModel; - -class ContactModel : protected Pointers { - public: - ContactModel(class LAMMPS *); - ~ContactModel(); - void init(); - bool check_contact(); - void prep_contact(); - void calculate_forces(); - double pulloff_distance(double, double); - - void init_model(std::string, ModelType); - int init_classic_model(char **, int, int); - int mix_coeffs(ContactModel*, ContactModel*); - - void write_restart(FILE *); - void read_restart(FILE *); - - // Sub models - NormalModel *normal_model; - DampingModel *damping_model; - TangentialModel *tangential_model; - RollingModel *rolling_model; - TwistingModel *twisting_model; - HeatModel *heat_model; - SubModel *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors - - // Extra options - int beyond_contact, limit_damping, history_update; - ContactType contact_type; - - // History variables - int size_history, nondefault_history_transfer; - double *transfer_history_factor; - double *history; - - // Contact properties/output - double forces[3], torquesi[3], torquesj[3], dq; - - double radi, radj, meff, dt, Ti, Tj, area; - double Fntot, magtortwist; - - int i, j; - double *xi, *xj, *vi, *vj, *omegai, *omegaj; - double fs[3], fr[3], ft[3]; - - double dx[3], nx[3], r, rsq, rinv, Reff, radsum, delta, dR; - double vr[3], vn[3], vnnr, vt[3], wr[3], vtr[3], vrl[3], relrot[3], vrel; - double magtwist; - bool touch; - - protected: - int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels - int classic_model; -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif diff --git a/src/contact_damping_models.cpp b/src/contact_damping_models.cpp deleted file mode 100644 index 07b6b88649..0000000000 --- a/src/contact_damping_models.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "contact_damping_models.h" -#include "contact_normal_models.h" -#include "contact.h" -#include "math_special.h" - -using namespace LAMMPS_NS; -using namespace Contact; -using namespace MathSpecial; - -/* ---------------------------------------------------------------------- - Default damping model -------------------------------------------------------------------------- */ - -DampingModel::DampingModel(LAMMPS *lmp) : SubModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -void DampingModel::init() -{ - damp = contact->normal_model->damp; -} - -/* ---------------------------------------------------------------------- - No model -------------------------------------------------------------------------- */ - -DampingNone::DampingNone(LAMMPS *lmp) : DampingModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -double DampingNone::calculate_forces() -{ - return 0.0; -} - -/* ---------------------------------------------------------------------- - Velocity damping -------------------------------------------------------------------------- */ - -DampingVelocity::DampingVelocity(LAMMPS *lmp) : DampingModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -double DampingVelocity::calculate_forces() -{ - damp_prefactor = damp; - return -damp_prefactor * contact->vnnr; -} - -/* ---------------------------------------------------------------------- - Mass velocity damping -------------------------------------------------------------------------- */ - -DampingMassVelocity::DampingMassVelocity(LAMMPS *lmp) : DampingModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -double DampingMassVelocity::calculate_forces() -{ - damp_prefactor = damp * contact->meff; - return -damp_prefactor * contact->vnnr; -} - -/* ---------------------------------------------------------------------- - Default, viscoelastic damping -------------------------------------------------------------------------- */ - -DampingViscoelastic::DampingViscoelastic(LAMMPS *lmp) : DampingModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -double DampingViscoelastic::calculate_forces() -{ - damp_prefactor = damp * contact->meff * contact->area; - return -damp_prefactor * contact->vnnr; -} - -/* ---------------------------------------------------------------------- - Tsuji damping -------------------------------------------------------------------------- */ - -DampingTsuji::DampingTsuji(LAMMPS *lmp) : DampingModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -void DampingTsuji::init() -{ - double tmp = contact->normal_model->damp; - damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); - damp += -22.348 * cube(tmp)+ 27.467 * powint(tmp, 4); - damp += -18.022 * powint(tmp, 5) + 4.8218 * powint(tmp,6); -} - -/* ---------------------------------------------------------------------- */ - -double DampingTsuji::calculate_forces() -{ - damp_prefactor = damp * sqrt(contact->meff * contact->normal_model->knfac); - return -damp_prefactor * contact->vnnr; -} diff --git a/src/contact_damping_models.h b/src/contact_damping_models.h deleted file mode 100644 index 222e901160..0000000000 --- a/src/contact_damping_models.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_DAMPING_MODELS_H_ -#define CONTACT_DAMPING_MODELS_H_ - -#include "contact_sub_models.h" -#include "pointers.h" - -namespace LAMMPS_NS { -namespace Contact { - -class DampingModel : public SubModel { - public: - DampingModel(class LAMMPS *); - ~DampingModel() {}; - virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; - virtual void init(); - virtual double calculate_forces() = 0; - double damp, damp_prefactor; -}; - -/* ---------------------------------------------------------------------- */ - -class DampingNone : public DampingModel { - public: - DampingNone(class LAMMPS *); - void init() override {}; - double calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class DampingVelocity : public DampingModel { - public: - DampingVelocity(class LAMMPS *); - double calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class DampingMassVelocity : public DampingModel { - public: - DampingMassVelocity(class LAMMPS *); - double calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class DampingViscoelastic : public DampingModel { - public: - DampingViscoelastic(class LAMMPS *); - double calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class DampingTsuji : public DampingModel { - public: - DampingTsuji(class LAMMPS *); - void init() override; - double calculate_forces(); -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /*CONTACT_DAMPING_MODELS_H_ */ diff --git a/src/contact_heat_models.cpp b/src/contact_heat_models.cpp deleted file mode 100644 index 1804ece9df..0000000000 --- a/src/contact_heat_models.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "contact_heat_models.h" -#include "contact.h" -#include "error.h" - -using namespace LAMMPS_NS; -using namespace Contact; - -/* ---------------------------------------------------------------------- - Default heat conduction -------------------------------------------------------------------------- */ - -HeatModel::HeatModel(LAMMPS *lmp) : SubModel(lmp) {} - -/* ---------------------------------------------------------------------- - Area-based heat conduction -------------------------------------------------------------------------- */ - -HeatNone::HeatNone(LAMMPS *lmp) : HeatModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -double HeatNone::calculate_heat() -{ - return 0.0; -} - -/* ---------------------------------------------------------------------- - Area-based heat conduction -------------------------------------------------------------------------- */ - -HeatArea::HeatArea(LAMMPS *lmp) : HeatModel(lmp) -{ - num_coeffs = 1; -} - -/* ---------------------------------------------------------------------- */ - -void HeatArea::coeffs_to_local() -{ - conductivity = coeffs[0]; - - if (conductivity < 0.0) error->all(FLERR, "Illegal area heat model"); -} - -/* ---------------------------------------------------------------------- */ - -double HeatArea::calculate_heat() -{ - return conductivity * contact->area * (contact->Tj - contact->Ti); -} diff --git a/src/contact_heat_models.h b/src/contact_heat_models.h deleted file mode 100644 index 5a0d495810..0000000000 --- a/src/contact_heat_models.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_HEAT_MODELS_H_ -#define CONTACT_HEAT_MODELS_H_ - -#include "contact_sub_models.h" - -namespace LAMMPS_NS { -namespace Contact { - -class HeatModel : public SubModel { - public: - HeatModel(class LAMMPS *); - ~HeatModel() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; - virtual double calculate_heat() = 0; -}; - -/* ---------------------------------------------------------------------- */ - -class HeatNone : public HeatModel { - public: - HeatNone(class LAMMPS *); - double calculate_heat(); -}; - -/* ---------------------------------------------------------------------- */ - -class HeatArea : public HeatModel { - public: - HeatArea(class LAMMPS *); - void coeffs_to_local() override; - double calculate_heat(); - protected: - double conductivity; -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /*CONTACT_HEAT_MODELS_H_ */ diff --git a/src/contact_normal_models.cpp b/src/contact_normal_models.cpp deleted file mode 100644 index b377d5d027..0000000000 --- a/src/contact_normal_models.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "contact_normal_models.h" -#include "contact.h" -#include "error.h" -#include "math_const.h" - -using namespace LAMMPS_NS; -using namespace Contact; -using namespace MathConst; - -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS (4.0/3.0) // 4/3 -#define ONETHIRD (1.0/3.0) // 1/3 -#define THREEQUARTERS 0.75 // 3/4 - -/* ---------------------------------------------------------------------- - Default normal model -------------------------------------------------------------------------- */ - -NormalModel::NormalModel(LAMMPS *lmp) : SubModel(lmp) -{ - material_properties = 0; -} - -/* ---------------------------------------------------------------------- */ - -bool NormalModel::touch() -{ - bool touchflag = (contact->rsq < contact->radsum * contact->radsum); - return touchflag; -} - -/* ---------------------------------------------------------------------- */ - -double NormalModel::pulloff_distance(double radi, double radj) -{ - //called outside of compute(), do not assume correct geometry defined in contact - return radi + radj; -} - -/* ---------------------------------------------------------------------- */ - -double NormalModel::calculate_area() -{ - return sqrt(contact->dR); -} - -/* ---------------------------------------------------------------------- */ - -void NormalModel::set_fncrit() -{ - Fncrit = fabs(contact->Fntot); -} - -/* ---------------------------------------------------------------------- - No model -------------------------------------------------------------------------- */ - -NormalNone::NormalNone(LAMMPS *lmp) : NormalModel(lmp) {} - -/* ---------------------------------------------------------------------- */ - -double NormalNone::calculate_forces() -{ - return 0.0; -} - -/* ---------------------------------------------------------------------- - Hookean normal force -------------------------------------------------------------------------- */ - -NormalHooke::NormalHooke(LAMMPS *lmp) : NormalModel(lmp) -{ - num_coeffs = 2; -} - -/* ---------------------------------------------------------------------- */ - -void NormalHooke::coeffs_to_local() -{ - k = coeffs[0]; - damp = coeffs[1]; - - if (k < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hooke normal model"); -} - -/* ---------------------------------------------------------------------- */ - -double NormalHooke::calculate_forces() -{ - Fne = knfac * contact->delta; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -void NormalHooke::set_knfac() -{ - knfac = k; -} - -/* ---------------------------------------------------------------------- - Hertzian normal force -------------------------------------------------------------------------- */ - -NormalHertz::NormalHertz(LAMMPS *lmp) : NormalModel(lmp) -{ - num_coeffs = 2; -} - -/* ---------------------------------------------------------------------- */ - -void NormalHertz::coeffs_to_local() -{ - k = coeffs[0]; - damp = coeffs[1]; - - if (k < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz normal model"); -} - -/* ---------------------------------------------------------------------- */ - -double NormalHertz::calculate_forces() -{ - Fne = knfac * contact->delta; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -void NormalHertz::set_knfac() -{ - knfac = k * contact->area; -} - -/* ---------------------------------------------------------------------- - Hertzian normal force with material properties -------------------------------------------------------------------------- */ - -NormalHertzMaterial::NormalHertzMaterial(LAMMPS *lmp) : NormalHertz(lmp) -{ - material_properties = 1; - num_coeffs = 3; -} - -/* ---------------------------------------------------------------------- */ - -void NormalHertzMaterial::coeffs_to_local() -{ - Emod = coeffs[0]; - damp = coeffs[1]; - poiss = coeffs[2]; - if (contact->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); - } - - if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); -} - -/* ---------------------------------------------------------------------- */ - -void NormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- - DMT normal force -------------------------------------------------------------------------- */ - -NormalDMT::NormalDMT(LAMMPS *lmp) : NormalModel(lmp) -{ - allow_limit_damping = 0; - material_properties = 1; - num_coeffs = 4; -} - -/* ---------------------------------------------------------------------- */ - -void NormalDMT::coeffs_to_local() -{ - Emod = coeffs[0]; - damp = coeffs[1]; - poiss = coeffs[2]; - cohesion = coeffs[3]; - if (contact->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); - } - - if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); -} - -/* ---------------------------------------------------------------------- */ - -void NormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - -double NormalDMT::calculate_forces() -{ - Fne = knfac * contact->delta; - F_pulloff = 4.0 * MathConst::MY_PI * cohesion * contact->Reff; - Fne -= F_pulloff; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -void NormalDMT::set_knfac() -{ - knfac = k * contact->area; -} - -/* ---------------------------------------------------------------------- */ - -void NormalDMT::set_fncrit() -{ - Fncrit = fabs(Fne + 2.0 * F_pulloff); -} - -/* ---------------------------------------------------------------------- - JKR normal force -------------------------------------------------------------------------- */ - -NormalJKR::NormalJKR(LAMMPS *lmp) : NormalModel(lmp) -{ - allow_limit_damping = 0; - material_properties = 1; - beyond_contact = 1; - num_coeffs = 4; -} - -/* ---------------------------------------------------------------------- */ - -void NormalJKR::coeffs_to_local() -{ - Emod = coeffs[0]; - damp = coeffs[1]; - poiss = coeffs[2]; - cohesion = coeffs[3]; - - if (contact->contact_type == PAIR) { - Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - Emix = mix_stiffnessE_wall(Emod, poiss); - } - - k = FOURTHIRDS * Emix; - - if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal JKR normal model"); -} - -/* ---------------------------------------------------------------------- */ - -void NormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - -bool NormalJKR::touch() -{ - double area_at_pulloff, R2, delta_pulloff, dist_pulloff; - bool touchflag; - - if (contact->touch) { - R2 = contact->Reff * contact->Reff; - area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * R2 / (4.0 * Emix)); - delta_pulloff = area_at_pulloff * area_at_pulloff / contact->Reff - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Emix); - dist_pulloff = contact->radsum - delta_pulloff; - touchflag = contact->rsq < (dist_pulloff * dist_pulloff); - } else { - touchflag = contact->rsq < (contact->radsum * contact->radsum); - } - - return touchflag; -} - -/* ---------------------------------------------------------------------- - called outside of compute(), do not assume geometry defined in contact -------------------------------------------------------------------------- */ - -double NormalJKR::pulloff_distance(double radi, double radj) -{ - double area_at_pulloff, Reff_tmp; - - Reff_tmp = radi * radj / (radi + radj); // May not be defined - if (Reff_tmp <= 0) return 0; - - area_at_pulloff = cbrt(9.0 * MY_PI * cohesion * Reff_tmp * Reff_tmp / (4.0 * Emix)); - return area_at_pulloff * area_at_pulloff / Reff_tmp - 2.0 * sqrt(MY_PI * cohesion * area_at_pulloff / Emix); -} - -/* ---------------------------------------------------------------------- */ - -double NormalJKR::calculate_area() -{ - double R2, dR2, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3; - - R2 = contact->Reff * contact->Reff; - dR2 = contact->dR * contact->dR; - t0 = cohesion * cohesion * R2 * R2 * Emix; - t1 = PI27SQ * t0; - t2 = 8.0 * contact->dR * dR2 * Emix * Emix * Emix; - t3 = 4.0 * dR2 * Emix; - - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0 * (t1 + 2.0 * t2)); - t4 = cbrt(t1 + t2 + THREEROOT3 * MY_PI * sqrt(sqrt1)); - t5 = t3 / t4 + t4 / Emix; - sqrt2 = MAX(0, 2.0 * contact->dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4.0 * contact->dR - t5 + SIXROOT6 * cohesion * MY_PI * R2 / (Emix * t6)); - - return INVROOT6 * (t6 + sqrt(sqrt3)); -} - -/* ---------------------------------------------------------------------- */ - -double NormalJKR::calculate_forces() -{ - double a2; - a2 = contact->area * contact->area; - Fne = knfac * a2 / contact->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Emix / (MY_PI * contact->area)); - F_pulloff = 3.0 * MY_PI * cohesion * contact->Reff; - - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -void NormalJKR::set_knfac() -{ - knfac = k * contact->area; -} - -/* ---------------------------------------------------------------------- */ - -void NormalJKR::set_fncrit() -{ - Fncrit = fabs(Fne + 2.0 * F_pulloff); -} diff --git a/src/contact_normal_models.h b/src/contact_normal_models.h deleted file mode 100644 index 8159a4c620..0000000000 --- a/src/contact_normal_models.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_NORMAL_MODELS_H_ -#define CONTACT_NORMAL_MODELS_H_ - -#include "contact_sub_models.h" - -namespace LAMMPS_NS { -namespace Contact { - -class NormalModel : public SubModel { - public: - NormalModel(class LAMMPS *); - ~NormalModel() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; - virtual bool touch(); - virtual double pulloff_distance(double, double); - virtual double calculate_area(); - virtual void set_knfac() = 0; - virtual double calculate_forces() = 0; - virtual void set_fncrit(); - double damp; // Vestigial argument needed by damping - double Emod, poiss; - double Fncrit, Fne, knfac; - int material_properties; -}; - -/* ---------------------------------------------------------------------- */ - -class NormalNone : public NormalModel { - public: - NormalNone(class LAMMPS *); - void set_knfac() {}; - double calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class NormalHooke : public NormalModel { - public: - NormalHooke(class LAMMPS *); - void coeffs_to_local() override; - void set_knfac(); - double calculate_forces(); - protected: - double k; -}; - -/* ---------------------------------------------------------------------- */ - -class NormalHertz : public NormalModel { - public: - NormalHertz(class LAMMPS *); - void coeffs_to_local() override; - void set_knfac(); - double calculate_forces(); - protected: - double k; -}; - -/* ---------------------------------------------------------------------- */ - -class NormalHertzMaterial : public NormalHertz { - public: - NormalHertzMaterial(class LAMMPS *); - void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; -}; - -/* ---------------------------------------------------------------------- */ - -class NormalDMT : public NormalModel { - public: - NormalDMT(class LAMMPS *); - void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; - void set_knfac(); - double calculate_forces(); - void set_fncrit() override; - protected: - double k, cohesion; - double F_pulloff; -}; - -/* ---------------------------------------------------------------------- */ - -class NormalJKR : public NormalModel { - public: - NormalJKR(class LAMMPS *); - void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; - bool touch() override; - double pulloff_distance(double, double) override; - double calculate_area() override; - void set_knfac(); - double calculate_forces(); - void set_fncrit() override; - protected: - double k, cohesion; - double Emix, F_pulloff; -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /*CONTACT_NORMAL_MODELS_H_ */ diff --git a/src/contact_rolling_models.cpp b/src/contact_rolling_models.cpp deleted file mode 100644 index 3ee80c0e48..0000000000 --- a/src/contact_rolling_models.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "contact_normal_models.h" -#include "contact_rolling_models.h" -#include "contact.h" -#include "error.h" -#include "math_const.h" -#include "math_extra.h" - -using namespace LAMMPS_NS; -using namespace Contact; -using namespace MathConst; -using namespace MathExtra; - -/* ---------------------------------------------------------------------- - Default rolling friction model -------------------------------------------------------------------------- */ - -RollingModel::RollingModel(LAMMPS *lmp) : SubModel(lmp) {} - -/* ---------------------------------------------------------------------- - No model -------------------------------------------------------------------------- */ - -RollingNone::RollingNone(LAMMPS *lmp) : RollingModel(lmp) {} - -/* ---------------------------------------------------------------------- - SDS rolling friction model -------------------------------------------------------------------------- */ - -RollingSDS::RollingSDS(LAMMPS *lmp) : RollingModel(lmp) -{ - num_coeffs = 3; - size_history = 3; -} - -/* ---------------------------------------------------------------------- */ - -void RollingSDS::coeffs_to_local() -{ - k = coeffs[0]; - gamma = coeffs[1]; - mu = coeffs[2]; - - if (k < 0.0 || mu < 0.0 || gamma < 0.0) - error->all(FLERR, "Illegal SDS rolling model"); -} - -/* ---------------------------------------------------------------------- */ - -void RollingSDS::calculate_forces() -{ - int rhist0, rhist1, rhist2, frameupdate; - double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], scalefac, temp_array[3]; - double k_inv, magfr_inv; - - rhist0 = history_index; - rhist1 = rhist0 + 1; - rhist2 = rhist1 + 1; - - Frcrit = mu * contact->normal_model->Fncrit; - - if (contact->history_update) { - hist_temp[0] = contact->history[rhist0]; - hist_temp[1] = contact->history[rhist1]; - hist_temp[2] = contact->history[rhist2]; - rolldotn = dot3(hist_temp, contact->nx); - - frameupdate = (fabs(rolldotn) * k) > (EPSILON * Frcrit); - if (frameupdate) { // rotate into tangential plane - rollmag = len3(hist_temp); - // projection - scale3(rolldotn, contact->nx, temp_array); - sub3(hist_temp, temp_array, hist_temp); - - // also rescale to preserve magnitude - prjmag = len3(hist_temp); - if (prjmag > 0) scalefac = rollmag / prjmag; - else scalefac = 0; - scale3(scalefac, hist_temp); - } - scale3(contact->dt, contact->vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - } - - scaleadd3(-k, hist_temp, -gamma, contact->vrl, contact->fr); - - // rescale frictional displacements and forces if needed - magfr = len3(contact->fr); - if (magfr > Frcrit) { - rollmag = len3(hist_temp); - if (rollmag != 0.0) { - k_inv = 1.0 / k; - magfr_inv = 1.0 / magfr; - scale3(-Frcrit * k_inv * magfr_inv, contact->fr, hist_temp); - scale3(-gamma * k_inv, contact->vrl, temp_array); - add3(hist_temp, temp_array, hist_temp); - - scale3(Frcrit * magfr_inv, contact->fr); - } else { - zero3(contact->fr); - } - } - - if (contact->history_update) { - contact->history[rhist0] = hist_temp[0]; - contact->history[rhist1] = hist_temp[1]; - contact->history[rhist2] = hist_temp[2]; - } -} diff --git a/src/contact_rolling_models.h b/src/contact_rolling_models.h deleted file mode 100644 index f5af08c1b0..0000000000 --- a/src/contact_rolling_models.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_ROLLING_MODELS_H_ -#define CONTACT_ROLLING_MODELS_H_ - -#include "contact_sub_models.h" - -namespace LAMMPS_NS { -namespace Contact { - -class RollingModel : public SubModel { - public: - RollingModel(class LAMMPS *); - ~RollingModel() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; - virtual void calculate_forces() = 0; -}; - -/* ---------------------------------------------------------------------- */ - -class RollingNone : public RollingModel { - public: - RollingNone(class LAMMPS *); - void calculate_forces() {}; -}; - -/* ---------------------------------------------------------------------- */ - -class RollingSDS : public RollingModel { - public: - RollingSDS(class LAMMPS *); - void coeffs_to_local() override; - void calculate_forces(); - protected: - double k, mu, gamma; -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /*CONTACT_ROLLING_MODELS_H_ */ diff --git a/src/contact_sub_models.cpp b/src/contact_sub_models.cpp deleted file mode 100644 index 1c9fe6b4f5..0000000000 --- a/src/contact_sub_models.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// clang-format off -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. --------------------------------------------------------------------------*/ - -/* ---------------------------------------------------------------------- - This class contains a framework for normal, damping, tangential, - rolling, twisting, and heat models used to calculate forces - and torques based on contact geometry - - Contributing authors: - Dan Bolintineanu (SNL), Joel Clemmer (SNL) ------------------------------------------------------------------------ */ - -#include "contact_sub_models.h" -#include "error.h" -#include "utils.h" - -using namespace LAMMPS_NS; -using namespace Contact; - -/* ---------------------------------------------------------------------- - Parent class for all types of contact forces -------------------------------------------------------------------------- */ - -SubModel::SubModel(LAMMPS *lmp) : Pointers(lmp) -{ - allocated = 0; - size_history = 0; - history_index = 0; - allow_limit_damping = 1; - beyond_contact = 0; - num_coeffs = 0; - - nondefault_history_transfer = 0; - transfer_history_factor = nullptr; -} - -/* ---------------------------------------------------------------------- */ - -SubModel::~SubModel() -{ - if (allocated) delete [] coeffs; - delete [] transfer_history_factor; -} - -/* ---------------------------------------------------------------------- */ - -void SubModel::allocate_coeffs() -{ - allocated = 1; - coeffs = new double[num_coeffs]; -} - -/* ---------------------------------------------------------------------- */ - -int SubModel::parse_coeffs(char **arg, int iarg, int narg) -{ - if (iarg + num_coeffs > narg) - error->all(FLERR, "Insufficient arguments provided for {} model", name); - for (int i = 0; i < num_coeffs; i++) { - // A few parameters (eg.g kt for tangential mindlin) allow null - if (strcmp(arg[iarg+i], "NULL") == 0) coeffs[i] = -1; - else coeffs[i] = utils::numeric(FLERR,arg[iarg+i],false,lmp); - } - coeffs_to_local(); - - return iarg + num_coeffs; -} - -/* ---------------------------------------------------------------------- */ - -void SubModel::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - for (int i = 0; i < num_coeffs; i++) - coeffs[i] = mix_geom(icoeffs[i], jcoeffs[i]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- - mixing of Young's modulus (E) -------------------------------------------------------------------------- */ - -double SubModel::mix_stiffnessE(double E1, double E2, - double pois1, double pois2) -{ - double factor1 = (1 - pois1 * pois1) / E1; - double factor2 = (1 - pois2 * pois2) / E2; - return 1 / (factor1 + factor2); -} - -/* ---------------------------------------------------------------------- - mixing of shear modulus (G) ------------------------------------------------------------------------- */ - -double SubModel::mix_stiffnessG(double E1, double E2, - double pois1, double pois2) -{ - double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; - double factor2 = 2 * (2 - pois2) * (1 + pois2) / E2; - return 1 / (factor1 + factor2); -} - -/* ---------------------------------------------------------------------- - mixing of Young's modulus (E) for walls -------------------------------------------------------------------------- */ - -double SubModel::mix_stiffnessE_wall(double E, double pois) -{ - double factor = 2 * (1 - pois); - return E / factor; -} - -/* ---------------------------------------------------------------------- - mixing of shear modulus (G) for walls ------------------------------------------------------------------------- */ - -double SubModel::mix_stiffnessG_wall(double E, double pois) -{ - double factor = 32.0 * (2 - pois) * (1 + pois); - return E / factor; -} - -/* ---------------------------------------------------------------------- - mixing of everything else -------------------------------------------------------------------------- */ - -double SubModel::mix_geom(double val1, double val2) -{ - return sqrt(val1 * val2); -} diff --git a/src/contact_sub_models.h b/src/contact_sub_models.h deleted file mode 100644 index 0f577bf08e..0000000000 --- a/src/contact_sub_models.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_SUB_MODEL_H_ -#define CONTACT_SUB_MODEL_H_ - -#include "contact.h" -#include "pointers.h" // IWYU pragma: export - -namespace LAMMPS_NS { -namespace Contact { - -class SubModel : protected Pointers { - public: - SubModel(class LAMMPS *); - virtual ~SubModel(); - - int num_coeffs; - double *coeffs; - void read_restart(); - int parse_coeffs(char **, int, int); - virtual void mix_coeffs(double*, double*); - virtual void coeffs_to_local() = 0; - virtual void init() = 0; // called after all other submodel coeffs defined - - void allocate_coeffs(); - std::string name; - - int size_history; - int nondefault_history_transfer; - double *transfer_history_factor; - - int history_index; - int beyond_contact; - int allow_limit_damping; - - ContactModel *contact; - - protected: - int allocated; - - double mix_stiffnessE(double, double, double, double); - double mix_stiffnessG(double, double, double, double); - double mix_stiffnessE_wall(double, double); - double mix_stiffnessG_wall(double, double); - double mix_geom(double, double); -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /* CONTACT_SUB_MODEL_H_ */ diff --git a/src/contact_tangential_models.cpp b/src/contact_tangential_models.cpp deleted file mode 100644 index ca95d1d00b..0000000000 --- a/src/contact_tangential_models.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "contact_damping_models.h" -#include "contact_normal_models.h" -#include "contact_tangential_models.h" -#include "contact.h" -#include "error.h" -#include "math_const.h" -#include "math_extra.h" - -using namespace LAMMPS_NS; -using namespace Contact; -using namespace MathConst; -using namespace MathExtra; - -/* ---------------------------------------------------------------------- - Default model -------------------------------------------------------------------------- */ - -TangentialModel::TangentialModel(LAMMPS *lmp) : SubModel(lmp) {} - -/* ---------------------------------------------------------------------- - No model -------------------------------------------------------------------------- */ - -TangentialNone::TangentialNone(LAMMPS *lmp) : TangentialModel(lmp) {} - -/* ---------------------------------------------------------------------- - Linear model with no history -------------------------------------------------------------------------- */ - -TangentialLinearNoHistory::TangentialLinearNoHistory(LAMMPS *lmp) : TangentialModel(lmp) -{ - num_coeffs = 2; - size_history = 3; -} - -/* ---------------------------------------------------------------------- */ - -void TangentialLinearNoHistory::coeffs_to_local() -{ - k = 0.0; // No tangential stiffness with no history - xt = coeffs[0]; - mu = coeffs[1]; - - if (k < 0.0 || xt < 0.0 || mu < 0.0) - error->all(FLERR, "Illegal linear no history tangential model"); -} - -/* ---------------------------------------------------------------------- */ - -void TangentialLinearNoHistory::calculate_forces() -{ - // classic pair gran/hooke (no history) - damp = xt * contact->damping_model->damp_prefactor; - - double Fscrit = mu * contact->normal_model->Fncrit; - double fsmag = damp * contact->vrel; - - double Ft; - if (contact->vrel != 0.0) Ft = MIN(Fscrit, fsmag) / contact->vrel; - else Ft = 0.0; - - scale3(-Ft, contact->vtr, contact->fs); -} - -/* ---------------------------------------------------------------------- - Linear model with history -------------------------------------------------------------------------- */ - -TangentialLinearHistory::TangentialLinearHistory(LAMMPS *lmp) : TangentialModel(lmp) -{ - num_coeffs = 3; - size_history = 3; -} - -/* ---------------------------------------------------------------------- */ - -void TangentialLinearHistory::coeffs_to_local() -{ - k = coeffs[0]; - xt = coeffs[1]; - mu = coeffs[2]; - - if (k < 0.0 || xt < 0.0 || mu < 0.0) - error->all(FLERR, "Illegal linear tangential model"); -} - -/* ---------------------------------------------------------------------- */ - -void TangentialLinearHistory::calculate_forces() -{ - // Note: this is the same as the base Mindlin calculation except k isn't scaled by area - double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; - int frame_update = 0; - - damp = xt * contact->damping_model->damp_prefactor; - - double Fscrit = contact->normal_model->Fncrit * mu; - double *history = & contact->history[history_index]; - - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (contact->history_update) { - rsht = dot3(history, contact->nx); - frame_update = (fabs(rsht) * k) > (EPSILON * Fscrit); - - if (frame_update) { - shrmag = len3(history); - - // projection - scale3(rsht, contact->nx, temp_array); - sub3(history, temp_array, history); - - // also rescale to preserve magnitude - prjmag = len3(history); - if (prjmag > 0) temp_dbl = shrmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, history); - } - - // update history, tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - scale3(contact->dt, contact->vtr, temp_array); - add3(history, temp_array, history); - } - - - // tangential forces = history + tangential velocity damping - scale3(-k, history, contact->fs); - scale3(damp, contact->vtr, temp_array); - sub3(contact->fs, temp_array, contact->fs); - - // rescale frictional displacements and forces if needed - magfs = len3(contact->fs); - if (magfs > Fscrit) { - shrmag = len3(history); - if (shrmag != 0.0) { - magfs_inv = 1.0 / magfs; - scale3(Fscrit * magfs_inv, contact->fs, history); - scale3(damp, contact->vtr, temp_array); - add3(history, temp_array, history); - scale3(-1.0 / k, history); - scale3(Fscrit * magfs_inv, contact->fs); - } else { - zero3(contact->fs); - } - } -} - -/* ---------------------------------------------------------------------- - Linear model with history from pair gran/hooke/history -------------------------------------------------------------------------- */ - -TangentialLinearHistoryClassic::TangentialLinearHistoryClassic(LAMMPS *lmp) : TangentialLinearHistory(lmp) -{ - scale_area = 0; // Sets gran/hooke/history behavior -} - -/* ---------------------------------------------------------------------- */ - -void TangentialLinearHistoryClassic::calculate_forces() -{ - double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; - double temp_array[3]; - int frame_update = 0; - - k_scaled = k; - if (scale_area) k_scaled *= contact->area; - - damp = xt * contact->damping_model->damp_prefactor; - - double Fscrit = contact->normal_model->Fncrit * mu; - double *history = & contact->history[history_index]; - - // update history - if (contact->history_update) { - scale3(contact->dt, contact->vtr, temp_array); - add3(history, temp_array, history); - } - - shrmag = len3(history); - - // rotate shear displacements - if (contact->history_update) { - rsht = dot3(history, contact->nx); - scale3(rsht, contact->nx, temp_array); - sub3(history, temp_array, history); - } - - // tangential forces = history + tangential velocity damping - scale3(-k_scaled, history, contact->fs); - scale3(damp, contact->vtr, temp_array); - sub3(contact->fs, temp_array, contact->fs); - - // rescale frictional displacements and forces if needed - magfs = len3(contact->fs); - if (magfs > Fscrit) { - if (shrmag != 0.0) { - magfs_inv = 1.0 / magfs; - scale3(Fscrit * magfs_inv, contact->fs, history); - scale3(damp, contact->vtr, temp_array); - add3(history, temp_array, history); - temp_dbl = -1.0 / k_scaled; - if (scale_area) temp_dbl /= contact->area; - scale3(temp_dbl, history); - scale3(Fscrit * magfs_inv, contact->fs); - } else { - zero3(contact->fs); - } - } -} - -/* ---------------------------------------------------------------------- - Mindlin from pair gran/hertz/history -------------------------------------------------------------------------- */ - -TangentialMindlinClassic::TangentialMindlinClassic(LAMMPS *lmp) : TangentialLinearHistoryClassic(lmp) -{ - scale_area = 1; // Sets gran/hertz/history behavior -} - -/* ---------------------------------------------------------------------- - Mindlin model -------------------------------------------------------------------------- */ - -TangentialMindlin::TangentialMindlin(LAMMPS *lmp) : TangentialModel(lmp) -{ - num_coeffs = 3; - size_history = 3; - mindlin_force = 0; - mindlin_rescale = 0; -} - -/* ---------------------------------------------------------------------- */ - -void TangentialMindlin::coeffs_to_local() -{ - k = coeffs[0]; - xt = coeffs[1]; - mu = coeffs[2]; - - if (k == -1) { - if (!contact->normal_model->material_properties) - error->all(FLERR, "Must either specify tangential stiffness or material properties for normal model for the Mindlin tangential style"); - - double Emod = contact->normal_model->Emod; - double poiss = contact->normal_model->poiss; - - if (contact->contact_type == PAIR) { - k = 8.0 * mix_stiffnessG(Emod, Emod, poiss, poiss); - } else { - k = 8.0 * mix_stiffnessG_wall(Emod, poiss); - } - } - - if (k < 0.0 || xt < 0.0 || mu < 0.0) - error->all(FLERR, "Illegal Mindlin tangential model"); -} - -/* ---------------------------------------------------------------------- */ - -void TangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) -{ - if (icoeffs[0] == -1 || jcoeffs[0] == -1) coeffs[0] = -1; - else coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); - coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); - coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); - coeffs_to_local(); -} - -/* ---------------------------------------------------------------------- */ - -void TangentialMindlin::calculate_forces() -{ - double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; - double temp_array[3]; - int frame_update = 0; - - damp = xt * contact->damping_model->damp_prefactor; - - double *history = & contact->history[history_index]; - double Fscrit = contact->normal_model->Fncrit * mu; - - k_scaled = k * contact->area; - - // on unloading, rescale the shear displacements/force - if (mindlin_rescale) - if (contact->area < history[3]) - scale3(contact->area / history[3], history); - - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (contact->history_update) { - rsht = dot3(history, contact->nx); - if (mindlin_force) { - frame_update = fabs(rsht) > (EPSILON * Fscrit); - } else { - frame_update = (fabs(rsht) * k_scaled) > (EPSILON * Fscrit); - } - - if (frame_update) { - shrmag = len3(history); - // projection - scale3(rsht, contact->nx, temp_array); - sub3(history, temp_array, history); - // also rescale to preserve magnitude - prjmag = len3(history); - if (prjmag > 0) temp_dbl = shrmag / prjmag; - else temp_dbl = 0; - scale3(temp_dbl, history); - } - - // update history - if (mindlin_force) { - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - scale3(-k_scaled * contact->dt, contact->vtr, temp_array); - } else { - scale3(contact->dt, contact->vtr, temp_array); - } - add3(history, temp_array, history); - - if (mindlin_rescale) history[3] = contact->area; - } - - // tangential forces = history + tangential velocity damping - scale3(-damp, contact->vtr, contact->fs); - - if (!mindlin_force) { - scale3(k_scaled, history, temp_array); - sub3(contact->fs, temp_array, contact->fs); - } else { - add3(contact->fs, history, contact->fs); - } - - // rescale frictional displacements and forces if needed - magfs = len3(contact->fs); - if (magfs > Fscrit) { - shrmag = len3(history); - if (shrmag != 0.0) { - magfs_inv = 1.0 / magfs; - scale3(Fscrit * magfs_inv, contact->fs, history); - scale3(damp, contact->vtr, temp_array); - add3(history, temp_array, history); - - if (!mindlin_force) - scale3(-1.0 / k_scaled, history); - - scale3(Fscrit * magfs_inv, contact->fs); - } else { - zero3(contact->fs); - } - } -} - -/* ---------------------------------------------------------------------- - Mindlin force model -------------------------------------------------------------------------- */ - -TangentialMindlinForce::TangentialMindlinForce(LAMMPS *lmp) : TangentialMindlin(lmp) -{ - num_coeffs = 3; - size_history = 3; - mindlin_force = 1; - mindlin_rescale = 0; -} - -/* ---------------------------------------------------------------------- - Mindlin rescale model -------------------------------------------------------------------------- */ - -TangentialMindlinRescale::TangentialMindlinRescale(LAMMPS *lmp) : TangentialMindlin(lmp) -{ - num_coeffs = 3; - size_history = 4; - mindlin_force = 0; - mindlin_rescale = 1; - - nondefault_history_transfer = 1; - transfer_history_factor = new double[size_history]; - for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; - transfer_history_factor[3] = +1; -} - -/* ---------------------------------------------------------------------- - Mindlin rescale force model -------------------------------------------------------------------------- */ - -TangentialMindlinRescaleForce::TangentialMindlinRescaleForce(LAMMPS *lmp) : TangentialMindlin(lmp) -{ - num_coeffs = 3; - size_history = 4; - mindlin_force = 1; - mindlin_rescale = 1; - - nondefault_history_transfer = 1; - transfer_history_factor = new double[size_history]; - for (int i = 0; i < size_history; i++) transfer_history_factor[i] = -1.0; - transfer_history_factor[3] = +1; -} diff --git a/src/contact_tangential_models.h b/src/contact_tangential_models.h deleted file mode 100644 index a54d03c495..0000000000 --- a/src/contact_tangential_models.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_TANGENTIAL_MODELS_H_ -#define CONTACT_TANGENTIAL_MODELS_H_ - -#include "contact_sub_models.h" - -namespace LAMMPS_NS { -namespace Contact { - -class TangentialModel : public SubModel { - public: - TangentialModel(class LAMMPS *); - virtual ~TangentialModel() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; - virtual void calculate_forces() = 0; - int rescale_flag; - double k, damp, mu; // Used by Marshall twisting model - protected: - double xt; -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialNone : public TangentialModel { - public: - TangentialNone(class LAMMPS *); - void calculate_forces() {}; -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialLinearNoHistory : public TangentialModel { - public: - TangentialLinearNoHistory(class LAMMPS *); - void coeffs_to_local() override; - void calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialLinearHistory : public TangentialModel { - public: - TangentialLinearHistory(class LAMMPS *); - void coeffs_to_local() override; - void calculate_forces(); -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialLinearHistoryClassic : public TangentialLinearHistory { - public: - TangentialLinearHistoryClassic(class LAMMPS *); - void calculate_forces(); - int scale_area; -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialMindlinClassic : public TangentialLinearHistoryClassic { - public: - TangentialMindlinClassic(class LAMMPS *); -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialMindlin : public TangentialModel { - public: - TangentialMindlin(class LAMMPS *); - void coeffs_to_local() override; - void mix_coeffs(double*, double*) override; - void calculate_forces(); - protected: - int mindlin_rescale, mindlin_force; -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialMindlinForce : public TangentialMindlin { - public: - TangentialMindlinForce(class LAMMPS *); -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialMindlinRescale : public TangentialMindlin { - public: - TangentialMindlinRescale(class LAMMPS *); -}; - -/* ---------------------------------------------------------------------- */ - -class TangentialMindlinRescaleForce : public TangentialMindlin { - public: - TangentialMindlinRescaleForce(class LAMMPS *); -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /*CONTACT_TANGENTIAL_MODELS_H_ */ diff --git a/src/contact_twisting_models.cpp b/src/contact_twisting_models.cpp deleted file mode 100644 index 94a88161f3..0000000000 --- a/src/contact_twisting_models.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "contact_normal_models.h" -#include "contact_tangential_models.h" -#include "contact_twisting_models.h" -#include "contact.h" -#include "error.h" -#include "math_const.h" - -using namespace LAMMPS_NS; -using namespace Contact; -using namespace MathConst; - -/* ---------------------------------------------------------------------- - Default twisting model -------------------------------------------------------------------------- */ - -TwistingModel::TwistingModel(LAMMPS *lmp) : SubModel(lmp) {} - -/* ---------------------------------------------------------------------- - No model -------------------------------------------------------------------------- */ - -TwistingNone::TwistingNone(LAMMPS *lmp) : TwistingModel(lmp) {} - -/* ---------------------------------------------------------------------- - Marshall twisting model -------------------------------------------------------------------------- */ - -TwistingMarshall::TwistingMarshall(LAMMPS *lmp) : TwistingModel(lmp) -{ - num_coeffs = 0; - size_history = 3; -} - -/* ---------------------------------------------------------------------- */ - - -void TwistingMarshall::init() -{ - k_tang = contact->tangential_model->k; - mu_tang = contact->tangential_model->mu; -} - -/* ---------------------------------------------------------------------- */ - -void TwistingMarshall::calculate_forces() -{ - double signtwist, Mtcrit; - - // Calculate twist coefficients from tangential model & contact geometry - // eq 32 of Marshall paper - double k = 0.5 * k_tang * contact->area * contact->area; - double damp = 0.5 * contact->tangential_model->damp * contact->area * contact->area; - double mu = TWOTHIRDS * mu_tang * contact->area; - - if (contact->history_update) { - contact->history[history_index] += contact->magtwist * contact->dt; - } - - // M_t torque (eq 30) - contact->magtortwist = -k * contact->history[history_index] - damp * contact->magtwist; - signtwist = (contact->magtwist > 0) - (contact->magtwist < 0); - Mtcrit = mu * contact->normal_model->Fncrit; // critical torque (eq 44) - - if (fabs(contact->magtortwist) > Mtcrit) { - contact->history[history_index] = (Mtcrit * signtwist - damp * contact->magtwist) / k; - contact->magtortwist = -Mtcrit * signtwist; // eq 34 - } -} - -/* ---------------------------------------------------------------------- - SDS twisting model -------------------------------------------------------------------------- */ - -TwistingSDS::TwistingSDS(LAMMPS *lmp) : TwistingModel(lmp) -{ - num_coeffs = 3; - size_history = 3; -} - -/* ---------------------------------------------------------------------- */ - -void TwistingSDS::coeffs_to_local() -{ - k = coeffs[0]; - damp = coeffs[1]; - mu = coeffs[2]; - - if (k < 0.0 || mu < 0.0 || damp < 0.0) - error->all(FLERR, "Illegal SDS twisting model"); -} - -/* ---------------------------------------------------------------------- */ - -void TwistingSDS::calculate_forces() -{ - double signtwist, Mtcrit; - - if (contact->history_update) { - contact->history[history_index] += contact->magtwist * contact->dt; - } - - // M_t torque (eq 30) - contact->magtortwist = -k * contact->history[history_index] - damp * contact->magtwist; - signtwist = (contact->magtwist > 0) - (contact->magtwist < 0); - Mtcrit = mu * contact->normal_model->Fncrit; // critical torque (eq 44) - - if (fabs(contact->magtortwist) > Mtcrit) { - contact->history[history_index] = (Mtcrit * signtwist - damp * contact->magtwist) / k; - contact->magtortwist = -Mtcrit * signtwist; // eq 34 - } -} diff --git a/src/contact_twisting_models.h b/src/contact_twisting_models.h deleted file mode 100644 index 1fa5aa2c6a..0000000000 --- a/src/contact_twisting_models.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef CONTACT_TWISTING_MODELS_H_ -#define CONTACT_TWISTING_MODELS_H_ - -#include "contact_sub_models.h" - -namespace LAMMPS_NS { -namespace Contact { - -class TwistingModel : public SubModel { - public: - TwistingModel(class LAMMPS *); - virtual ~TwistingModel() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; - virtual void calculate_forces() = 0; -}; - -/* ---------------------------------------------------------------------- */ - -class TwistingNone : public TwistingModel { - public: - TwistingNone(class LAMMPS *); - void calculate_forces() {}; -}; - -/* ---------------------------------------------------------------------- */ - -class TwistingMarshall : public TwistingModel { - public: - TwistingMarshall(class LAMMPS *); - void calculate_forces(); - void init(); - protected: - double k_tang, mu_tang; -}; - -/* ---------------------------------------------------------------------- */ - -class TwistingSDS : public TwistingModel { - public: - TwistingSDS(class LAMMPS *); - void coeffs_to_local() override; - void calculate_forces(); - protected: - double k, mu, damp; -}; - -} // namespace Contact -} // namespace LAMMPS_NS - -#endif /*CONTACT_TWISTING_MODELS_H_ */ diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index cc4fdbe20b..f5b86b6069 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -41,7 +41,7 @@ enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS, XSU,YSU,ZSU,XSUTRI,YSUTRI,ZSUTRI, IX,IY,IZ, VX,VY,VZ,FX,FY,FZ, - Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,heatflow,TEMPERATURE, + Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,HEATFLOW,TEMPERATURE, OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ, TQX,TQY,TQZ, COMPUTE,FIX,VARIABLE,IVEC,DVEC,IARRAY,DARRAY}; @@ -930,7 +930,7 @@ int DumpCustom::count() for (i = 0; i < nlocal; i++) dchoose[i] = 2.0*radius[i]; ptr = dchoose; nstride = 1; - } else if (thresh_array[ithresh] == heatflow) { + } else if (thresh_array[ithresh] == HEATFLOW) { if (!atom->heatflow_flag) error->all(FLERR, "Threshold for an atom property that isn't allocated"); @@ -1867,7 +1867,7 @@ int DumpCustom::modify_param(int narg, char **arg) else if (strcmp(arg[1],"radius") == 0) thresh_array[nthresh] = RADIUS; else if (strcmp(arg[1],"diameter") == 0) thresh_array[nthresh] = DIAMETER; - else if (strcmp(arg[1],"heatflow") == 0) thresh_array[nthresh] = heatflow; + else if (strcmp(arg[1],"heatflow") == 0) thresh_array[nthresh] = HEATFLOW; else if (strcmp(arg[1],"temperature") == 0) thresh_array[nthresh] = TEMPERATURE; else if (strcmp(arg[1],"omegax") == 0) thresh_array[nthresh] = OMEGAX; else if (strcmp(arg[1],"omegay") == 0) thresh_array[nthresh] = OMEGAY; From 5dcbbc084ba0c42f8ed2be3f0f07ac6b9f575cb6 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 1 Nov 2022 13:30:24 -0600 Subject: [PATCH 33/57] Adding developers documentation page --- doc/src/Howto_granular.rst | 11 +++ doc/src/Modify_gsm.rst | 183 +++++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 doc/src/Modify_gsm.rst diff --git a/doc/src/Howto_granular.rst b/doc/src/Howto_granular.rst index 9492e5755e..af52904204 100644 --- a/doc/src/Howto_granular.rst +++ b/doc/src/Howto_granular.rst @@ -43,6 +43,14 @@ The fix style *freeze* zeroes both the force and torque of frozen atoms, and should be used for granular system instead of the fix style *setforce*\ . +To model heat conduction, one must use the atom style: +* :doc:`atom_style sphere/temp ` +a temperature integration fix +* :doc:`fix temp/integrate ` +and a heat conduction option defined in both +* :doc:`pair_style granular ` +* :doc:`fix wall/gran ` + For computational efficiency, you can eliminate needless pairwise computations between frozen atoms by using this command: @@ -55,3 +63,6 @@ computations between frozen atoms by using this command: will be the same as in 3d. If you wish to model granular particles in 2d as 2d discs, see the note on this topic on the :doc:`Howto 2d ` doc page, where 2d simulations are discussed. + +To add custom granular contact models, see the +:doc:`modifying granular submodels page `. diff --git a/doc/src/Modify_gsm.rst b/doc/src/Modify_gsm.rst new file mode 100644 index 0000000000..06172b4dec --- /dev/null +++ b/doc/src/Modify_gsm.rst @@ -0,0 +1,183 @@ +Granular Submodel (GSM) styles +=========== + +In granular models, particles are spheres with a finite radius and rotational +degrees of freedom as further described in the +:doc:`Howto granular page `. Interactions between pair of +particles or particles and walls may therefore depend on many different modes +of motion as described in :doc:`pair granular ` and +:doc:`fix wall/gran `. In both cases, the exchange of forces, +torques, and heat flow between two types of bodies is defined using a +GranularModel class. The GranularModel class organizes the details of an +interaction using a series of granular submodels each of which describe a +particular interaction mode (e.g. normal forces or rolling friction). From a +parent GSM class, several types of submodel classes are derived: + +* GSMNormal: normal force submodel +* GSMDamping: normal damping submodel +* GSMTangential: tangential forces and sliding friction submodel +* GSMRolling: rolling friction submodel +* GSMTwisting: twisting friction submodel +* GSMHeat: heat conduction submodel + +For each type of submodel, more classes are further derived, each describing +a specific implementation. For instance, from the GSMNormal class the +GSMNormalHooke, GSMNormalHertz, and GSMNormalJKR classes are derived which +calculate Hookean, Hertzian, or JKR normal forces, respectively. This modular +structure simplifies the addition of new granualar contact models as as one only +needs to create a new GSM class without having to modify the more complex +PairGranular, FixGranWall, and GranularModel classes. Most GSM methods are also +already defined by the parent classes so new contact models typically only require +edits to a few relevant methods (e.g. methods that define coefficients and +calculate forces). + +Each GSM class has a pointer to both the LAMMPS class and the GranularModel +class which owns it, ``lmp`` and ``gm``, respectively. The GranularModel class +includes several public variables that describe the geometry/dynamics of the +contact such as + +.. list-table:: + + * - ``xi`` and ``xj`` + - Positions of the two contacting bodies + * - ``vi`` and ``vj`` + - Velocities of the two contacting bodies + * - ``omegai`` and ``omegaj`` + - Angular velocities of the two contacting bodies + * - ``dx`` and ``nx`` + - The displacement and normalized displacement vectors + * - ``r``, ``rsq``, and ``rinv`` + - The distance, distance squared, and inverse distance + * - ``radsum`` + - The sum of particle radii + * - ``vr``, ``vn``, and ``vt`` + - The relative velocity vector and its normal and tangential components + * - ``wr`` + - The relative rotational velocity + +These quantities, among others, are calculated in the ``GranularModel->check_contact()`` +and ``GranularModel->calculate_forces()`` methods which can be referred to for more +details. + +To create a new GSM class, it is recommended that one first looks at similar GSM +classes. All GSM classes share several general methods which may need to be defined + +.. list-table:: + + * - ``GSM->mix_coeff()`` + - Optional method to define how coefficients are mixed for different atom types. By default, coefficients are mixed using a geometric mean. + * - ``GSM->coeffs_to_local()`` + - Parses coefficients to define local variables, run once at model construction. + * - ``GSM->init()`` + - Optional method to define local variables after other GSM types were created. For instance, this method may be used by a tangential model that derives parameters from the normal stiffness. + +There are also several type-specific methods + +.. list-table:: + + * - ``GSMNormal->touch()`` + - Optional method to test when particles are in contact. By default, this is when particles overlap. + * - ``GSMNormal->pulloff_distance()`` + - Optional method to return the distance at which particles stop interacting. By default, this is when particles no longer overlap. + * - ``GSMNormal->calculate_area()`` + - Optional method to return the surface area of the contact. By default, this returns the geometric cross section. + * - ``GSMNormal->set_fncrit()`` + - Optional method that defines the critical force to break the contact used by some tangential, rolling, and twisting submodels. By default, this is the current total normal force, including damping. + * - ``GSMNormal->calculate_forces()`` + - Required method that returns the normal contact force + * - ``GSMDamping->calculate_forces()`` + - Required method that returns the normal damping force + * - ``GSMTangential->calculate_forces()`` + - Required method that calculates tangential forces/torques + * - ``GSMTwisting->calculate_forces()`` + - Required method that calculates twisting friction forces/torques + * - ``GSMRolling->calculate_forces()`` + - Required method that calculates rolling friction forces/torques + * - ``GSMHeat->calculate_heat()`` + - Required method that returns the rate of heat flow + +As an example, say one wanted to create a new normal force option that consisted +of a Hookean force with a piecewise stiffness. This could be done by adding a new +set of files ``gsm_custom.h``: + +.. code-block:: c++ + + #ifdef GSM_CLASS + // clang-format off + GSMStyle(hooke/piecewise, + GSMNormalHookePiecewise, + NORMAL); + // clang-format on + #else + + #ifndef GSM_CUSTOM_H_ + #define GSM_CUSTOM_H_ + + #include "gsm.h" + #include "gsm_normal.h" + + namespace LAMMPS_NS { + namespace Granular_NS { + + class GSMNormalHookePiecewise : public GSMNormal { + public: + GSMNormalHookePiecewise(class GranularModel *, class LAMMPS *); + void coeffs_to_local() override; + void set_knfac(); + double calculate_forces(); + protected: + double k1, k2, delta_switch; + }; + + } // namespace Granular_NS + } // namespace LAMMPS_NS + + #endif /*GSM_CUSTOM_H_ */ + #endif /*GSM_CLASS_H_ */ + + +and ``gsm_custom.cpp`` + +.. code-block:: c++ + + #include "gsm_custom.h" + #include "gsm_normal.h" + #include "granular_model.h" + + using namespace LAMMPS_NS; + using namespace Granular_NS; + + GSMNormalHookePiecewise::GSMNormalHookePiecewise(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) + { + num_coeffs = 4; + } + + /* ---------------------------------------------------------------------- */ + + void GSMNormalHookePiecewise::coeffs_to_local() + { + k1 = coeffs[0]; + k2 = coeffs[1]; + damp = coeffs[2]; + delta_switch = coeffs[3]; + } + + /* ---------------------------------------------------------------------- */ + + double GSMNormalHookePiecewise::calculate_forces() + { + if (gm->delta >= delta_switch { + Fne = k1 * delta_switch + k2 * (gm->delta - delta_switch); + } else { + Fne = k1 * gm->delta; + } + return Fne; + } + + /* ---------------------------------------------------------------------- */ + + void GSMNormalHookePiecewise::set_knfac() + { + if (gm->delta < delta_switch) knfac = k1; + else knfac = k2; + } From dca901617eb6c177ed3ec362e4d9ac9ba7d0c72a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 1 Nov 2022 13:30:57 -0600 Subject: [PATCH 34/57] Removing knfac, removing unnecessary global variables, updating dev ref text --- src/GRANULAR/atom_vec_sphere_temp.cpp | 4 +-- src/GRANULAR/atom_vec_sphere_temp.h | 2 +- src/GRANULAR/fix_temp_integrate.cpp | 4 +-- src/GRANULAR/fix_temp_integrate.h | 2 +- src/GRANULAR/granular_model.cpp | 25 +++++++-------- src/GRANULAR/granular_model.h | 4 +-- src/GRANULAR/gsm.cpp | 8 ++--- src/GRANULAR/gsm.h | 4 +-- src/GRANULAR/gsm_damping.cpp | 5 +-- src/GRANULAR/gsm_damping.h | 6 ++-- src/GRANULAR/gsm_heat.cpp | 3 +- src/GRANULAR/gsm_heat.h | 2 +- src/GRANULAR/gsm_normal.cpp | 46 ++++++--------------------- src/GRANULAR/gsm_normal.h | 18 ++++------- src/GRANULAR/gsm_rolling.cpp | 3 +- src/GRANULAR/gsm_rolling.h | 2 +- src/GRANULAR/gsm_tangential.cpp | 4 +-- src/GRANULAR/gsm_tangential.h | 12 ++++--- src/GRANULAR/gsm_twisting.cpp | 3 +- src/GRANULAR/gsm_twisting.h | 2 +- 20 files changed, 66 insertions(+), 93 deletions(-) diff --git a/src/GRANULAR/atom_vec_sphere_temp.cpp b/src/GRANULAR/atom_vec_sphere_temp.cpp index bc3dcb7a2d..283a55e2da 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.cpp +++ b/src/GRANULAR/atom_vec_sphere_temp.cpp @@ -1,7 +1,7 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/atom_vec_sphere_temp.h b/src/GRANULAR/atom_vec_sphere_temp.h index c93b0ee4dd..de6d5266a5 100644 --- a/src/GRANULAR/atom_vec_sphere_temp.h +++ b/src/GRANULAR/atom_vec_sphere_temp.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/fix_temp_integrate.cpp b/src/GRANULAR/fix_temp_integrate.cpp index e5fbae63dc..ab9739e874 100644 --- a/src/GRANULAR/fix_temp_integrate.cpp +++ b/src/GRANULAR/fix_temp_integrate.cpp @@ -1,8 +1,8 @@ // clang-format off -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/fix_temp_integrate.h b/src/GRANULAR/fix_temp_integrate.h index 738cb28a6f..8356d00433 100644 --- a/src/GRANULAR/fix_temp_integrate.h +++ b/src/GRANULAR/fix_temp_integrate.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index a7aaa1ed83..3f500d0431 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -1,8 +1,8 @@ // clang-format off -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -23,16 +23,11 @@ #include "granular_model.h" #include "gsm.h" -#include "gsm_normal.h" -#include "gsm_tangential.h" -#include "gsm_damping.h" -#include "gsm_rolling.h" -#include "gsm_twisting.h" -#include "gsm_heat.h" #include "comm.h" #include "error.h" #include "force.h" #include "math_extra.h" +#include "style_gsm.h" // IWYU pragma: keep #include @@ -253,10 +248,13 @@ void GranularModel::init() if (sub_models[i]->beyond_contact) beyond_contact = 1; size_history += sub_models[i]->size_history; - if (limit_damping && (!sub_models[i]->allow_limit_damping)) - error->all(FLERR,"Cannot limit damping with {} model", sub_models[i]->name); + if (!sub_models[i]->allow_cohesion && normal_model->cohesive_flag) + error->all(FLERR,"Cannot use {} model with a cohesive normal model, {}", sub_models[i]->name, normal_model->name); } + if (limit_damping && (normal_model->cohesive_flag)) + error->all(FLERR,"Cannot limit damping with a cohesive normal model, {}", normal_model->name); + if (nondefault_history_transfer) { transfer_history_factor = new double[size_history]; @@ -430,13 +428,12 @@ void GranularModel::calculate_forces() // calculate forces/torques forces[0] = 0.0; - double Fne, Fdamp, dist_to_contact; + double Fdamp, dist_to_contact; area = normal_model->calculate_area(); - normal_model->set_knfac(); - Fne = normal_model->calculate_forces(); + Fnormal = normal_model->calculate_forces(); Fdamp = damping_model->calculate_forces(); - Fntot = Fne + Fdamp; + Fntot = Fnormal + Fdamp; if (limit_damping && Fntot < 0.0) Fntot = 0.0; normal_model->set_fncrit(); // Needed for tangential, rolling, twisting diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index afc8f61ddc..b45c916580 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -82,7 +82,7 @@ class GranularModel : protected Pointers { double *history; // Contact properties/output - double forces[3], torquesi[3], torquesj[3], dq; + double Fnormal, forces[3], torquesi[3], torquesj[3], dq; double radi, radj, meff, dt, Ti, Tj, area; double Fntot, magtortwist; diff --git a/src/GRANULAR/gsm.cpp b/src/GRANULAR/gsm.cpp index 6430fb7403..fb0ae48615 100644 --- a/src/GRANULAR/gsm.cpp +++ b/src/GRANULAR/gsm.cpp @@ -1,8 +1,8 @@ // clang-format off -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -10,7 +10,7 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. --------------------------------------------------------------------------*/ +------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- This class contains a framework for granular submodels (GSM) including: @@ -39,7 +39,7 @@ GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) allocated = 0; size_history = 0; history_index = 0; - allow_limit_damping = 1; + allow_cohesion = 1; beyond_contact = 0; num_coeffs = 0; diff --git a/src/GRANULAR/gsm.h b/src/GRANULAR/gsm.h index b2df6bef2b..4695749d64 100644 --- a/src/GRANULAR/gsm.h +++ b/src/GRANULAR/gsm.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -41,7 +41,7 @@ class GSM : protected Pointers { int history_index; int beyond_contact; - int allow_limit_damping; + int allow_cohesion; GranularModel *gm; diff --git a/src/GRANULAR/gsm_damping.cpp b/src/GRANULAR/gsm_damping.cpp index 9b51651f30..0280f61771 100644 --- a/src/GRANULAR/gsm_damping.cpp +++ b/src/GRANULAR/gsm_damping.cpp @@ -1,7 +1,8 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -108,6 +109,6 @@ void GSMDampingTsuji::init() double GSMDampingTsuji::calculate_forces() { - damp_prefactor = damp * sqrt(gm->meff * gm->normal_model->knfac); + damp_prefactor = damp * sqrt(gm->meff * gm->Fnormal / gm->delta); return -damp_prefactor * gm->vnnr; } diff --git a/src/GRANULAR/gsm_damping.h b/src/GRANULAR/gsm_damping.h index 1904314cdc..75c0f96356 100644 --- a/src/GRANULAR/gsm_damping.h +++ b/src/GRANULAR/gsm_damping.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -52,7 +52,9 @@ class GSMDamping : public GSM { virtual void mix_coeffs(double*, double*) {}; virtual void init(); virtual double calculate_forces() = 0; - double damp, damp_prefactor; + double damp_prefactor; // Used by tangential models + protected: + double damp; }; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_heat.cpp b/src/GRANULAR/gsm_heat.cpp index 449df5520b..7512e372a0 100644 --- a/src/GRANULAR/gsm_heat.cpp +++ b/src/GRANULAR/gsm_heat.cpp @@ -1,7 +1,8 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/gsm_heat.h b/src/GRANULAR/gsm_heat.h index 4b27979273..c913593f19 100644 --- a/src/GRANULAR/gsm_heat.h +++ b/src/GRANULAR/gsm_heat.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/gsm_normal.cpp b/src/GRANULAR/gsm_normal.cpp index 2b029ece6a..0ae288f6fd 100644 --- a/src/GRANULAR/gsm_normal.cpp +++ b/src/GRANULAR/gsm_normal.cpp @@ -1,7 +1,8 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -35,6 +36,7 @@ using namespace MathConst; GSMNormal::GSMNormal(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) { material_properties = 0; + cohesive_flag = 0; } /* ---------------------------------------------------------------------- */ @@ -103,15 +105,7 @@ void GSMNormalHooke::coeffs_to_local() double GSMNormalHooke::calculate_forces() { - Fne = knfac * gm->delta; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -void GSMNormalHooke::set_knfac() -{ - knfac = k; + return k * gm->delta; } /* ---------------------------------------------------------------------- @@ -137,15 +131,7 @@ void GSMNormalHertz::coeffs_to_local() double GSMNormalHertz::calculate_forces() { - Fne = knfac * gm->delta; - return Fne; -} - -/* ---------------------------------------------------------------------- */ - -void GSMNormalHertz::set_knfac() -{ - knfac = k * gm->area; + return k * gm->area * gm->delta; } /* ---------------------------------------------------------------------- @@ -190,8 +176,8 @@ void GSMNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) GSMNormalDMT::GSMNormalDMT(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) { - allow_limit_damping = 0; material_properties = 1; + cohesive_flag = 1; num_coeffs = 4; } @@ -227,7 +213,7 @@ void GSMNormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) double GSMNormalDMT::calculate_forces() { - Fne = knfac * gm->delta; + Fne = k * gm->area * gm->delta; F_pulloff = 4.0 * MathConst::MY_PI * cohesion * gm->Reff; Fne -= F_pulloff; return Fne; @@ -235,13 +221,6 @@ double GSMNormalDMT::calculate_forces() /* ---------------------------------------------------------------------- */ -void GSMNormalDMT::set_knfac() -{ - knfac = k * gm->area; -} - -/* ---------------------------------------------------------------------- */ - void GSMNormalDMT::set_fncrit() { Fncrit = fabs(Fne + 2.0 * F_pulloff); @@ -253,8 +232,8 @@ void GSMNormalDMT::set_fncrit() GSMNormalJKR::GSMNormalJKR(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) { - allow_limit_damping = 0; material_properties = 1; + cohesive_flag = 1; beyond_contact = 1; num_coeffs = 4; } @@ -356,7 +335,7 @@ double GSMNormalJKR::calculate_forces() { double a2; a2 = gm->area * gm->area; - Fne = knfac * a2 / gm->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Emix / (MY_PI * gm->area)); + Fne = k * gm->area * a2 / gm->Reff - MY_2PI * a2 * sqrt(4.0 * cohesion * Emix / (MY_PI * gm->area)); F_pulloff = 3.0 * MY_PI * cohesion * gm->Reff; return Fne; @@ -364,13 +343,6 @@ double GSMNormalJKR::calculate_forces() /* ---------------------------------------------------------------------- */ -void GSMNormalJKR::set_knfac() -{ - knfac = k * gm->area; -} - -/* ---------------------------------------------------------------------- */ - void GSMNormalJKR::set_fncrit() { Fncrit = fabs(Fne + 2.0 * F_pulloff); diff --git a/src/GRANULAR/gsm_normal.h b/src/GRANULAR/gsm_normal.h index 0c7ba30e41..2d7391f3c8 100644 --- a/src/GRANULAR/gsm_normal.h +++ b/src/GRANULAR/gsm_normal.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -56,13 +56,12 @@ class GSMNormal : public GSM { virtual bool touch(); virtual double pulloff_distance(double, double); virtual double calculate_area(); - virtual void set_knfac() = 0; virtual double calculate_forces() = 0; virtual void set_fncrit(); - double damp; // Vestigial argument needed by damping + double damp; // argument historically needed by damping double Emod, poiss; - double Fncrit, Fne, knfac; - int material_properties; + double Fncrit, knfac; + int material_properties, cohesive_flag; }; /* ---------------------------------------------------------------------- */ @@ -70,7 +69,6 @@ class GSMNormal : public GSM { class GSMNormalNone : public GSMNormal { public: GSMNormalNone(class GranularModel *, class LAMMPS *); - void set_knfac() {}; double calculate_forces(); }; @@ -80,7 +78,6 @@ class GSMNormalHooke : public GSMNormal { public: GSMNormalHooke(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; - void set_knfac(); double calculate_forces(); protected: double k; @@ -92,7 +89,6 @@ class GSMNormalHertz : public GSMNormal { public: GSMNormalHertz(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; - void set_knfac(); double calculate_forces(); protected: double k; @@ -114,12 +110,11 @@ class GSMNormalDMT : public GSMNormal { GSMNormalDMT(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; - void set_knfac(); double calculate_forces(); void set_fncrit() override; protected: double k, cohesion; - double F_pulloff; + double F_pulloff, Fne; }; /* ---------------------------------------------------------------------- */ @@ -132,12 +127,11 @@ class GSMNormalJKR : public GSMNormal { bool touch() override; double pulloff_distance(double, double) override; double calculate_area() override; - void set_knfac(); double calculate_forces(); void set_fncrit() override; protected: double k, cohesion; - double Emix, F_pulloff; + double Emix, F_pulloff, Fne; }; } // namespace Granular_NS diff --git a/src/GRANULAR/gsm_rolling.cpp b/src/GRANULAR/gsm_rolling.cpp index efb0ea423b..ceda262853 100644 --- a/src/GRANULAR/gsm_rolling.cpp +++ b/src/GRANULAR/gsm_rolling.cpp @@ -1,7 +1,8 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/gsm_rolling.h b/src/GRANULAR/gsm_rolling.h index 21e61ac4bc..054b22954f 100644 --- a/src/GRANULAR/gsm_rolling.h +++ b/src/GRANULAR/gsm_rolling.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/gsm_tangential.cpp b/src/GRANULAR/gsm_tangential.cpp index b3e6266049..b2e7ca8762 100644 --- a/src/GRANULAR/gsm_tangential.cpp +++ b/src/GRANULAR/gsm_tangential.cpp @@ -1,7 +1,8 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -136,7 +137,6 @@ void GSMTangentialLinearHistory::calculate_forces() add3(history, temp_array, history); } - // tangential forces = history + tangential velocity damping scale3(-k, history, gm->fs); scale3(damp, gm->vtr, temp_array); diff --git a/src/GRANULAR/gsm_tangential.h b/src/GRANULAR/gsm_tangential.h index a420c7d314..1d6dfa3d04 100644 --- a/src/GRANULAR/gsm_tangential.h +++ b/src/GRANULAR/gsm_tangential.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -66,10 +66,7 @@ class GSMTangential : public GSM { virtual void coeffs_to_local() {}; virtual void init() {}; virtual void calculate_forces() = 0; - int rescale_flag; double k, damp, mu; // Used by Marshall twisting model - protected: - double xt; }; /* ---------------------------------------------------------------------- */ @@ -87,6 +84,8 @@ class GSMTangentialLinearNoHistory : public GSMTangential { GSMTangentialLinearNoHistory(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void calculate_forces(); + protected: + double xt; }; /* ---------------------------------------------------------------------- */ @@ -96,6 +95,8 @@ class GSMTangentialLinearHistory : public GSMTangential { GSMTangentialLinearHistory(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void calculate_forces(); + protected: + double xt; }; /* ---------------------------------------------------------------------- */ @@ -104,7 +105,9 @@ class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory { public: GSMTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); void calculate_forces(); + protected: int scale_area; + double xt; }; /* ---------------------------------------------------------------------- */ @@ -124,6 +127,7 @@ class GSMTangentialMindlin : public GSMTangential { void calculate_forces(); protected: int mindlin_rescale, mindlin_force; + double xt; }; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_twisting.cpp b/src/GRANULAR/gsm_twisting.cpp index 3704ac4ec8..73149b099b 100644 --- a/src/GRANULAR/gsm_twisting.cpp +++ b/src/GRANULAR/gsm_twisting.cpp @@ -1,7 +1,8 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains diff --git a/src/GRANULAR/gsm_twisting.h b/src/GRANULAR/gsm_twisting.h index 84759acce7..b9ab7826a6 100644 --- a/src/GRANULAR/gsm_twisting.h +++ b/src/GRANULAR/gsm_twisting.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains From c8347df494efde32a2556d8b671eabfb568092ae Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 1 Nov 2022 13:34:07 -0600 Subject: [PATCH 35/57] Removing knfac from documentation --- doc/src/Modify_gsm.rst | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/doc/src/Modify_gsm.rst b/doc/src/Modify_gsm.rst index 06172b4dec..56b38fd573 100644 --- a/doc/src/Modify_gsm.rst +++ b/doc/src/Modify_gsm.rst @@ -82,7 +82,7 @@ There are also several type-specific methods * - ``GSMNormal->calculate_area()`` - Optional method to return the surface area of the contact. By default, this returns the geometric cross section. * - ``GSMNormal->set_fncrit()`` - - Optional method that defines the critical force to break the contact used by some tangential, rolling, and twisting submodels. By default, this is the current total normal force, including damping. + - Optional method that defines the critical force to break the contact used by some tangential, rolling, and twisting submodels. By default, this is the current total normal force including damping. * - ``GSMNormal->calculate_forces()`` - Required method that returns the normal contact force * - ``GSMDamping->calculate_forces()`` @@ -123,7 +123,6 @@ set of files ``gsm_custom.h``: public: GSMNormalHookePiecewise(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; - void set_knfac(); double calculate_forces(); protected: double k1, k2, delta_switch; @@ -166,6 +165,7 @@ and ``gsm_custom.cpp`` double GSMNormalHookePiecewise::calculate_forces() { + double Fne; if (gm->delta >= delta_switch { Fne = k1 * delta_switch + k2 * (gm->delta - delta_switch); } else { @@ -174,10 +174,3 @@ and ``gsm_custom.cpp`` return Fne; } - /* ---------------------------------------------------------------------- */ - - void GSMNormalHookePiecewise::set_knfac() - { - if (gm->delta < delta_switch) knfac = k1; - else knfac = k2; - } From 88be5a37812186ce989f2ca55cc5ad2cceeed3bd Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 1 Nov 2022 14:01:07 -0600 Subject: [PATCH 36/57] Minor fixes to doc pages --- doc/src/Modify_gsm.rst | 6 +++--- doc/src/dump.rst | 2 +- doc/src/pair_granular.rst | 13 ++++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/src/Modify_gsm.rst b/doc/src/Modify_gsm.rst index 56b38fd573..f549a9bb45 100644 --- a/doc/src/Modify_gsm.rst +++ b/doc/src/Modify_gsm.rst @@ -67,9 +67,9 @@ classes. All GSM classes share several general methods which may need to be defi * - ``GSM->mix_coeff()`` - Optional method to define how coefficients are mixed for different atom types. By default, coefficients are mixed using a geometric mean. * - ``GSM->coeffs_to_local()`` - - Parses coefficients to define local variables, run once at model construction. + - Parses coefficients to define local variables. Run once at model construction. * - ``GSM->init()`` - - Optional method to define local variables after other GSM types were created. For instance, this method may be used by a tangential model that derives parameters from the normal stiffness. + - Optional method to define local variables after other GSM types were created. For instance, this method may be used by a tangential model that derives parameters from the normal model. There are also several type-specific methods @@ -166,7 +166,7 @@ and ``gsm_custom.cpp`` double GSMNormalHookePiecewise::calculate_forces() { double Fne; - if (gm->delta >= delta_switch { + if (gm->delta >= delta_switch) { Fne = k1 * delta_switch + k2 * (gm->delta - delta_switch); } else { Fne = k1 * gm->delta; diff --git a/doc/src/dump.rst b/doc/src/dump.rst index c324c945ee..f5a121517a 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -108,7 +108,7 @@ Syntax omegax,omegay,omegaz = angular velocity of spherical particle angmomx,angmomy,angmomz = angular momentum of aspherical particle tqx,tqy,tqz = torque on finite-size particles - heatflow = flow of heat into particle + heatflow = rate of heat flow into particle temperature = temperature of particle c_ID = per-atom vector calculated by a compute with ID c_ID[I] = Ith column of per-atom array calculated by a compute with ID, I can include wildcard (see below) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index bc365814cd..8109e6709a 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -226,16 +226,19 @@ for all models except *jkr*, for which it is given implicitly according to :math:`\delta = a^2/R - 2\sqrt{\pi \gamma a/E}`. For *damping viscoelastic*, :math:`\eta_{n0}` is in units of 1/(\ *time*\ \*\ *distance*\ ). -The *tsuji* model is based on the work of :ref:`(Tsuji et al) `. Here, the damping coefficient specified as part of -the normal model is interpreted as a restitution coefficient -:math:`e`. The damping constant :math:`\eta_n` is given by: +The *tsuji* model is based on the work of :ref:`(Tsuji et al) `. +Here, the damping coefficient specified as part of the normal model is interpreted +as a restitution coefficient :math:`e`. The damping constant :math:`\eta_n` is +given by: .. math:: \eta_n = \alpha (m_{eff}k_n)^{1/2} -For normal contact models based on material parameters, :math:`k_n = 4/3Ea`. The parameter :math:`\alpha` is related to the restitution -coefficient *e* according to: +For normal contact models based on material parameters, :math:`k_n = 4/3Ea`. This +damping model is not compatible with cohesive normal models such as *JKR* or *DMT*. +The parameter :math:`\alpha` is related to the restitution coefficient *e* +according to: .. math:: From 95a8d2cc25d7686e8d5f0319523ca0fba1fa743f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 2 Nov 2022 15:38:12 -0600 Subject: [PATCH 37/57] Patching pair tracker --- src/MISC/pair_tracker.cpp | 2 +- src/MISC/pair_tracker.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MISC/pair_tracker.cpp b/src/MISC/pair_tracker.cpp index c994b02df5..adbd832eae 100644 --- a/src/MISC/pair_tracker.cpp +++ b/src/MISC/pair_tracker.cpp @@ -514,7 +514,7 @@ double PairTracker::single(int /*i*/, int /*j*/, int /*itype*/, int /*jtype*/, d only needed if any history entries i-j are not just negative of j-i entries ------------------------------------------------------------------------- */ -void PairTracker::transfer_history(double *source, double *target) +void PairTracker::transfer_history(double *source, double *target, int itype, int jtype) { for (int i = 0; i < size_history; i++) target[i] = source[i]; } diff --git a/src/MISC/pair_tracker.h b/src/MISC/pair_tracker.h index 47128b8073..e072f51f21 100644 --- a/src/MISC/pair_tracker.h +++ b/src/MISC/pair_tracker.h @@ -40,7 +40,7 @@ class PairTracker : public Pair { double single(int, int, int, int, double, double, double, double &) override; double atom2cut(int) override; double radii2cut(double, double) override; - void transfer_history(double *, double *) override; + void transfer_history(double *, double *, int, int) override; protected: int sizeflag; From 74122040a392de78a4b04ca2cf2142c79fe32892 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 2 Nov 2022 20:20:06 -0400 Subject: [PATCH 38/57] add cmake support for generating gsm style header file --- cmake/Modules/StyleHeaderUtils.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index 7590d822eb..2bc84252d3 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -104,6 +104,7 @@ function(RegisterStyles search_path) FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify + FindStyleHeaders(${search_path} GSM_CLASS gsm_ GSM ) # gsm ) # granular_model FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force @@ -127,6 +128,7 @@ function(RegisterStylesExt search_path extension sources) FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources}) FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources}) FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources}) + FindStyleHeadersExt(${search_path} GSM_CLASS ${extension} GSM ${sources}) FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources}) FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources}) FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources}) @@ -151,6 +153,7 @@ function(GenerateStyleHeaders output_path) GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump GenerateStyleHeader(${output_path} FIX fix ) # modify + GenerateStyleHeader(${output_path} GSM gsm ) # granular_model GenerateStyleHeader(${output_path} IMPROPER improper ) # force GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update GenerateStyleHeader(${output_path} KSPACE kspace ) # force From 3561bbe88724834718be98b11eef2dfc6f07fb03 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 2 Nov 2022 20:20:56 -0400 Subject: [PATCH 39/57] simplify --- src/GRANULAR/granular_model.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index b45c916580..d3ce11b799 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -20,15 +20,15 @@ namespace LAMMPS_NS { namespace Granular_NS { #define EPSILON 1e-10 -#define NSUBMODELS 6 enum SubmodelType { NORMAL = 0, - DAMPING = 1, - TANGENTIAL = 2, - ROLLING = 3, - TWISTING = 4, - HEAT = 5 + DAMPING, + TANGENTIAL, + ROLLING, + TWISTING, + HEAT, + NSUBMODELS }; // Relative order matters since some derive coeffs from others enum ContactType { @@ -37,7 +37,7 @@ enum ContactType { WALLREGION = 2 }; -// forward declaration +// forward declarations class GSM; class GSMNormal; class GSMDamping; From b5d57531d930b328cca9e0a94b5bdae513c37fbd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 2 Nov 2022 20:38:43 -0400 Subject: [PATCH 40/57] complete integration into the manual build process --- doc/src/Commands_fix.rst | 1 + doc/src/Modify.rst | 1 + doc/src/fix.rst | 1 + 3 files changed, 3 insertions(+) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index c5c2fb7cba..ec8174a370 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -235,6 +235,7 @@ OPT. * :doc:`temp/berendsen ` * :doc:`temp/csld ` * :doc:`temp/csvr ` + * :doc:`temp/integrate ` * :doc:`temp/rescale ` * :doc:`temp/rescale/eff ` * :doc:`tfmc ` diff --git a/doc/src/Modify.rst b/doc/src/Modify.rst index e42da61387..39a1faeb87 100644 --- a/doc/src/Modify.rst +++ b/doc/src/Modify.rst @@ -34,5 +34,6 @@ style requirements and recommendations `. Modify_min Modify_region Modify_body + Modify_gsm Modify_thermo Modify_variable diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 333e920bd9..461cfc1465 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -382,6 +382,7 @@ accelerated styles exist. * :doc:`temp/berendsen ` - temperature control by Berendsen thermostat * :doc:`temp/csld ` - canonical sampling thermostat with Langevin dynamics * :doc:`temp/csvr ` - canonical sampling thermostat with Hamiltonian dynamics +* :doc:`temp/integrate ` - plain time integration with per-atom temperature updates * :doc:`temp/rescale ` - temperature control by velocity rescaling * :doc:`temp/rescale/eff ` - temperature control by velocity rescaling in the electron force field model * :doc:`tfmc ` - perform force-bias Monte Carlo with time-stamped method From 871efda589c4c7119a1f1738e53a02e217439ffa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 2 Nov 2022 20:39:10 -0400 Subject: [PATCH 41/57] a few formal changes and spelling updates --- doc/src/Modify_gsm.rst | 26 ++++++++-------- doc/src/fix_temp_integrate.rst | 6 ---- doc/src/pair_granular.rst | 33 +++++++++++---------- doc/utils/sphinx-config/false_positives.txt | 1 + 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/doc/src/Modify_gsm.rst b/doc/src/Modify_gsm.rst index f549a9bb45..515c776c6c 100644 --- a/doc/src/Modify_gsm.rst +++ b/doc/src/Modify_gsm.rst @@ -1,5 +1,5 @@ -Granular Submodel (GSM) styles -=========== +Granular Sub-model (GSM) styles +=============================== In granular models, particles are spheres with a finite radius and rotational degrees of freedom as further described in the @@ -9,22 +9,22 @@ of motion as described in :doc:`pair granular ` and :doc:`fix wall/gran `. In both cases, the exchange of forces, torques, and heat flow between two types of bodies is defined using a GranularModel class. The GranularModel class organizes the details of an -interaction using a series of granular submodels each of which describe a +interaction using a series of granular sub-models each of which describe a particular interaction mode (e.g. normal forces or rolling friction). From a -parent GSM class, several types of submodel classes are derived: +parent GSM class, several types of sub-model classes are derived: -* GSMNormal: normal force submodel -* GSMDamping: normal damping submodel -* GSMTangential: tangential forces and sliding friction submodel -* GSMRolling: rolling friction submodel -* GSMTwisting: twisting friction submodel -* GSMHeat: heat conduction submodel +* GSMNormal: normal force sub-model +* GSMDamping: normal damping sub-model +* GSMTangential: tangential forces and sliding friction sub-model +* GSMRolling: rolling friction sub-model +* GSMTwisting: twisting friction sub-model +* GSMHeat: heat conduction sub-model -For each type of submodel, more classes are further derived, each describing +For each type of sub-model, more classes are further derived, each describing a specific implementation. For instance, from the GSMNormal class the GSMNormalHooke, GSMNormalHertz, and GSMNormalJKR classes are derived which calculate Hookean, Hertzian, or JKR normal forces, respectively. This modular -structure simplifies the addition of new granualar contact models as as one only +structure simplifies the addition of new granular contact models as as one only needs to create a new GSM class without having to modify the more complex PairGranular, FixGranWall, and GranularModel classes. Most GSM methods are also already defined by the parent classes so new contact models typically only require @@ -82,7 +82,7 @@ There are also several type-specific methods * - ``GSMNormal->calculate_area()`` - Optional method to return the surface area of the contact. By default, this returns the geometric cross section. * - ``GSMNormal->set_fncrit()`` - - Optional method that defines the critical force to break the contact used by some tangential, rolling, and twisting submodels. By default, this is the current total normal force including damping. + - Optional method that defines the critical force to break the contact used by some tangential, rolling, and twisting sub-models. By default, this is the current total normal force including damping. * - ``GSMNormal->calculate_forces()`` - Required method that returns the normal contact force * - ``GSMDamping->calculate_forces()`` diff --git a/doc/src/fix_temp_integrate.rst b/doc/src/fix_temp_integrate.rst index 03fae7a872..efcf450d8f 100644 --- a/doc/src/fix_temp_integrate.rst +++ b/doc/src/fix_temp_integrate.rst @@ -41,12 +41,6 @@ the *constant* or *type* keywords. For style *constant*, the specific heat is a constant value *cp* for all atoms. For style *type*, *N* different values of the specific heat are defined, one for each of the *N* types of atoms. - - ----------- - -.. include:: accel_styles.rst - ---------- Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index a6533957df..cb044252da 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -766,26 +766,29 @@ These extra quantities can be accessed by the :doc:`compute pair/local ` page for more info. +This pair style is part of the GRANULAR package. It is +only enabled if LAMMPS was built with that package. +See the :doc:`Build package ` page for more info. -These pair styles require that atoms store torque and angular velocity -(omega) as defined by the :doc:`atom_style `. They also -require a per-particle radius is stored. The *sphere* atom style does -all of this. +This pair style requires that atoms store per-particle radius, +torque, and angular velocity (omega) as defined by the +:doc:`atom_style sphere `. -This pair style requires you to use the :doc:`comm_modify vel yes ` command so that velocities are stored by ghost -atoms. +This pair style requires you to use the :doc:`comm_modify vel yes ` +command so that velocities are stored by ghost atoms. -These pair styles will not restart exactly when using the -:doc:`read_restart ` command, though they should provide -statistically similar results. This is because the forces they -compute depend on atom velocities. See the -:doc:`read_restart ` command for more details. +This pair style will not restart exactly when using the +:doc:`read_restart ` command, though it should provide +statistically similar results. This is because the forces it +computes depend on atom velocities and the atom velocities have +been propagated half a timestep between the force computation and +when the restart is written, due to using Velocity Verlet time +integration. See the :doc:`read_restart ` command +for more details. -Accumulated values for individual contacts are saved to to restart +Accumulated values for individual contacts are saved to restart files but are not saved to data files. Therefore, forces may -differ significantly when a system is reloaded using A +differ significantly when a system is reloaded using the :doc:`read_data ` command. Related commands diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 61c1d45ba7..5aeb259ee6 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1336,6 +1336,7 @@ hdnnp HDNNP Hearn heatconduction +heatflow Hebbeker Hebenstreit Hecht From bc74fef3f4f51f9691b1135e9420d638c1363cd2 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 2 Nov 2022 21:11:30 -0600 Subject: [PATCH 42/57] Fixing memory leaks, misc clean ups, adding cohesive flag to Tsuji --- src/GRANULAR/granular_model.cpp | 25 ++++++++++++------------- src/GRANULAR/granular_model.h | 2 +- src/GRANULAR/gsm.cpp | 1 + src/GRANULAR/gsm_damping.cpp | 5 ++++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index 3f500d0431..10113cdf78 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -95,13 +95,11 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) GranularModel::~GranularModel() { delete [] transfer_history_factor; + delete [] gsmclass; + delete [] gsmnames; + delete [] gsmtypes; - delete normal_model; - delete damping_model; - delete tangential_model; - delete rolling_model; - delete twisting_model; - delete heat_model; + for (int i = 0; i < NSUBMODELS; i ++) delete sub_models[i]; } /* ---------------------------------------------------------------------- */ @@ -119,7 +117,7 @@ int GranularModel::add_submodel(char **arg, int iarg, int narg, SubmodelType mod error->all(FLERR, "Insufficient arguments provided for {} model", model_name); for (int i = 0; i < num_coeffs; i++) { - // A few parameters (eg.g kt for tangential mindlin) allow null + // A few parameters (e.g. kt for tangential mindlin) allow null if (strcmp(arg[iarg + i], "NULL") == 0) sub_models[model_type]->coeffs[i] = -1; else sub_models[model_type]->coeffs[i] = utils::numeric(FLERR,arg[iarg + i],false,lmp); } @@ -138,6 +136,7 @@ void GranularModel::construct_submodel(std::string model_name, SubmodelType mode if (gsmtypes[i] == model_type) { if (strcmp(gsmnames[i], model_name.c_str()) == 0) { GSMCreator &gsm_creator = gsmclass[i]; + delete sub_models[model_type]; sub_models[model_type] = gsm_creator(this, lmp); break; } @@ -145,7 +144,7 @@ void GranularModel::construct_submodel(std::string model_name, SubmodelType mode } if (i == nclass) - error->all(FLERR, "Illegal model type {}", model_type); + error->all(FLERR, "Illegal model type {}", model_name); sub_models[model_type]->name.assign(model_name); sub_models[model_type]->allocate_coeffs(); @@ -252,7 +251,7 @@ void GranularModel::init() error->all(FLERR,"Cannot use {} model with a cohesive normal model, {}", sub_models[i]->name, normal_model->name); } - if (limit_damping && (normal_model->cohesive_flag)) + if (limit_damping && normal_model->cohesive_flag) error->all(FLERR,"Cannot limit damping with a cohesive normal model, {}", normal_model->name); if (nondefault_history_transfer) { @@ -263,7 +262,7 @@ void GranularModel::init() // Find which model owns this history value size_cumulative = 0; for (j = 0; j < NSUBMODELS; j++) { - if (size_cumulative + sub_models[j]->size_history > i) break; + if ((size_cumulative + sub_models[j]->size_history) > i) break; size_cumulative += sub_models[j]->size_history; } @@ -451,7 +450,7 @@ void GranularModel::calculate_forces() scale3(-1, torquesi); if (contact_type == PAIR) copy3(torquesi, torquesj); - if (!classic_model && contact_type == PAIR) { + if (!classic_model && (contact_type == PAIR)) { dist_to_contact = radi - 0.5 * delta; scale3(dist_to_contact, torquesi); dist_to_contact = radj - 0.5 * delta; @@ -461,16 +460,16 @@ void GranularModel::calculate_forces() scale3(dist_to_contact, torquesi); } - double torroll[3]; if (rolling_defined) { + double torroll[3]; cross3(nx, fr, torroll); scale3(Reff, torroll); add3(torquesi, torroll, torquesi); if (contact_type == PAIR) sub3(torquesj, torroll, torquesj); } - double tortwist[3]; if (twisting_defined) { + double tortwist[3]; scale3(magtortwist, nx, tortwist); add3(torquesi, tortwist, torquesi); if (contact_type == PAIR) sub3(torquesj, tortwist, torquesj); diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index d3ce11b799..b5a4d9ef4b 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -29,7 +29,7 @@ enum SubmodelType { TWISTING, HEAT, NSUBMODELS -}; // Relative order matters since some derive coeffs from others +}; enum ContactType { PAIR = 0, diff --git a/src/GRANULAR/gsm.cpp b/src/GRANULAR/gsm.cpp index fb0ae48615..1848a1743a 100644 --- a/src/GRANULAR/gsm.cpp +++ b/src/GRANULAR/gsm.cpp @@ -45,6 +45,7 @@ GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) nondefault_history_transfer = 0; transfer_history_factor = nullptr; + coeffs = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_damping.cpp b/src/GRANULAR/gsm_damping.cpp index 0280f61771..ed4bfd8ae1 100644 --- a/src/GRANULAR/gsm_damping.cpp +++ b/src/GRANULAR/gsm_damping.cpp @@ -93,7 +93,10 @@ double GSMDampingViscoelastic::calculate_forces() Tsuji damping ------------------------------------------------------------------------- */ -GSMDampingTsuji::GSMDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} +GSMDampingTsuji::GSMDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) +{ + allow_cohesion = 0; +} /* ---------------------------------------------------------------------- */ From cd658e67794ba9b102f3d690220f255f984d6f6f Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 7 Nov 2022 10:41:09 -0700 Subject: [PATCH 43/57] Fixing few bugs with histories, removing indices from granular model --- src/GRANULAR/fix_wall_gran.cpp | 1 - src/GRANULAR/fix_wall_gran_region.cpp | 1 - src/GRANULAR/granular_model.h | 1 - src/GRANULAR/gsm_tangential.cpp | 2 +- src/GRANULAR/pair_granular.cpp | 50 ++++++++++++++------------- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index e0bb941525..4956e9d900 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -492,7 +492,6 @@ void FixWallGran::post_force(int /*vflag*/) } // Reset model and copy initial geometric data - model->i = i; model->dx[0] = dx; model->dx[1] = dy; model->dx[2] = dz; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index ad58d3e624..7ee794133c 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -229,7 +229,6 @@ void FixWallGranRegion::post_force(int /*vflag*/) for (int ic = 0; ic < nc; ic++) { // Reset model and copy initial geometric data - model->i = i; model->dx[0] = region->contact[ic].delx; model->dx[1] = region->contact[ic].dely; model->dx[2] = region->contact[ic].delz; diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index b5a4d9ef4b..dc404b332c 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -87,7 +87,6 @@ class GranularModel : protected Pointers { double radi, radj, meff, dt, Ti, Tj, area; double Fntot, magtortwist; - int i, j; double *xi, *xj, *vi, *vj, *omegai, *omegaj; double fs[3], fr[3], ft[3]; diff --git a/src/GRANULAR/gsm_tangential.cpp b/src/GRANULAR/gsm_tangential.cpp index b2e7ca8762..862159c386 100644 --- a/src/GRANULAR/gsm_tangential.cpp +++ b/src/GRANULAR/gsm_tangential.cpp @@ -44,7 +44,7 @@ GSMTangentialNone::GSMTangentialNone(GranularModel *gm, LAMMPS *lmp) : GSMTangen GSMTangentialLinearNoHistory::GSMTangentialLinearNoHistory(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) { num_coeffs = 2; - size_history = 3; + size_history = 0; } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index aa93dd7a0b..973daff5c9 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -122,6 +122,9 @@ void PairGranular::compute(int eflag, int vflag) bool touchflag = false; const bool history_update = update->setupflag == 0; + for (int i = 0; i < vec_models.size(); i++) + vec_models[i].history_update = history_update; + ev_init(eflag,vflag); // update rigid body info for owned & ghost atoms if using FixRigid masses @@ -190,13 +193,12 @@ void PairGranular::compute(int eflag, int vflag) jtype = type[j]; // Reset model and copy initial geometric data - models[itype][jtype]->i = i; - models[itype][jtype]->j = j; models[itype][jtype]->xi = x[i]; models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; models[itype][jtype]->radj = radius[j]; - models[itype][jtype]->touch = touch[jj]; + if (use_history || models[itype][jtype]->beyond_contact) + models[itype][jtype]->touch = touch[jj]; touchflag = models[itype][jtype]->check_contact(); @@ -234,12 +236,11 @@ void PairGranular::compute(int eflag, int vflag) models[itype][jtype]->vj = v[j]; models[itype][jtype]->omegai = omega[i]; models[itype][jtype]->omegaj = omega[j]; - models[itype][jtype]->history_update = history_update; if (use_history) { history = &allhistory[size_history*jj]; models[itype][jtype]->history = history; } -; + if (heat_flag) { models[itype][jtype]->Ti = temperature[i]; models[itype][jtype]->Tj = temperature[j]; @@ -411,7 +412,10 @@ void PairGranular::init_style() for (auto &model : vec_models) { model.init(); - if (model.beyond_contact) beyond_contact = 1; + if (model.beyond_contact) { + beyond_contact = 1; + use_history = 1; // Need to track if in contact + } if (model.size_history != 0) use_history = 1; for (i = 0; i < NSUBMODELS; i++) @@ -700,14 +704,28 @@ double PairGranular::single(int i, int j, int itype, int jtype, double *radius = atom->radius; // Reset model and copy initial geometric data - models[itype][jtype]->i = i; - models[itype][jtype]->j = j; models[itype][jtype]->xi = x[i]; models[itype][jtype]->xj = x[j]; models[itype][jtype]->radi = radius[i]; models[itype][jtype]->radj = radius[j]; models[i][j]->history_update = 0; // Don't update history + // If history is needed + jnum = list->numneigh[i]; + jlist = list->firstneigh[i]; + if (use_history) { + if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) + error->one(FLERR,"Pair granular single computation needs history"); + allhistory = fix_history->firstvalue[i]; + for (int jj = 0; jj < jnum; jj++) { + neighprev++; + if (neighprev >= jnum) neighprev = 0; + if (jlist[neighprev] == j) break; + } + history = &allhistory[size_history*neighprev]; + models[itype][jtype]->touch = fix_history->firstflag[i][neighprev]; + } + touchflag = models[itype][jtype]->check_contact(); if (!touchflag) { @@ -733,22 +751,6 @@ double PairGranular::single(int i, int j, int itype, int jtype, if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; - // if any history is needed - jnum = list->numneigh[i]; - jlist = list->firstneigh[i]; - - if (use_history) { - if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) - error->one(FLERR,"Pair granular single computation needs history"); - allhistory = fix_history->firstvalue[i]; - for (int jj = 0; jj < jnum; jj++) { - neighprev++; - if (neighprev >= jnum) neighprev = 0; - if (jlist[neighprev] == j) break; - } - history = &allhistory[size_history*neighprev]; - } - // Copy additional information and calculate forces double **v = atom->v; double **omega = atom->omega; From a1db5fda70e04c8a1c925a677f7dc354ab9e62ec Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 7 Nov 2022 11:30:12 -0700 Subject: [PATCH 44/57] Simplifying variables and logic --- src/GRANULAR/granular_model.cpp | 56 +++++++------- src/GRANULAR/pair_granular.cpp | 128 ++++++++++++++++---------------- 2 files changed, 91 insertions(+), 93 deletions(-) diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index 10113cdf78..f8a53c5cf2 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -380,9 +380,8 @@ bool GranularModel::check_contact() void GranularModel::calculate_forces() { - double temp[3]; - // Standard geometric quantities + if (contact_type != WALLREGION) r = sqrt(rsq); rinv = 1.0 / r; delta = radsum - r; @@ -403,29 +402,12 @@ void GranularModel::calculate_forces() scaleadd3(radi, omegai, radj, omegaj, wr); // relative tangential velocities + double temp[3]; cross3(wr, nx, temp); sub3(vt, temp, vtr); vrel = len3(vtr); - if (rolling_defined || twisting_defined) - sub3(omegai, omegaj, relrot); - - if (rolling_defined) { - // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); - vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); - vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); - } - - if (twisting_defined) { - // omega_T (eq 29 of Marshall) - magtwist = dot3(relrot, nx); - } - // calculate forces/torques - forces[0] = 0.0; double Fdamp, dist_to_contact; area = normal_model->calculate_area(); @@ -437,30 +419,43 @@ void GranularModel::calculate_forces() normal_model->set_fncrit(); // Needed for tangential, rolling, twisting tangential_model->calculate_forces(); - if (rolling_defined) rolling_model->calculate_forces(); - if (twisting_defined) twisting_model->calculate_forces(); - // sum contributions + // sum normal + tangential contributions scale3(Fntot, nx, forces); add3(forces, fs, forces); - //May need to rethink eventually tris.. + // May need to eventually rethink tris.. cross3(nx, fs, torquesi); scale3(-1, torquesi); - if (contact_type == PAIR) copy3(torquesi, torquesj); - if (!classic_model && (contact_type == PAIR)) { + if (contact_type == PAIR) { + copy3(torquesi, torquesj); + + // Classic pair styles wouldn't scale, but classic option is only used by walls dist_to_contact = radi - 0.5 * delta; scale3(dist_to_contact, torquesi); dist_to_contact = radj - 0.5 * delta; scale3(dist_to_contact, torquesj); } else { - dist_to_contact = radi; - scale3(dist_to_contact, torquesi); + scale3(radi, torquesi); } + // Extra modes + + if (rolling_defined || twisting_defined) + sub3(omegai, omegaj, relrot); + if (rolling_defined) { + // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) + vrl[0] = Reff * (relrot[1] * nx[2] - relrot[2] * nx[1]); + vrl[1] = Reff * (relrot[2] * nx[0] - relrot[0] * nx[2]); + vrl[2] = Reff * (relrot[0] * nx[1] - relrot[1] * nx[0]); + + rolling_model->calculate_forces(); + double torroll[3]; cross3(nx, fr, torroll); scale3(Reff, torroll); @@ -469,6 +464,11 @@ void GranularModel::calculate_forces() } if (twisting_defined) { + // omega_T (eq 29 of Marshall) + magtwist = dot3(relrot, nx); + + twisting_model->calculate_forces(); + double tortwist[3]; scale3(magtortwist, nx, tortwist); add3(torquesi, tortwist, torquesi); diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 973daff5c9..9601b87382 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -112,7 +112,7 @@ PairGranular::~PairGranular() void PairGranular::compute(int eflag, int vflag) { int i,j,k,ii,jj,inum,jnum,itype,jtype; - double factor_lj,mi,mj,meff,delx,dely,delz; + double factor_lj,mi,mj,meff; double *forces, *torquesi, *torquesj, dq; int *ilist,*jlist,*numneigh,**firstneigh; @@ -122,6 +122,8 @@ void PairGranular::compute(int eflag, int vflag) bool touchflag = false; const bool history_update = update->setupflag == 0; + class GranularModel* model; + for (int i = 0; i < vec_models.size(); i++) vec_models[i].history_update = history_update; @@ -191,31 +193,29 @@ void PairGranular::compute(int eflag, int vflag) if (factor_lj == 0) continue; jtype = type[j]; + model = models[itype][jtype]; // Reset model and copy initial geometric data - models[itype][jtype]->xi = x[i]; - models[itype][jtype]->xj = x[j]; - models[itype][jtype]->radi = radius[i]; - models[itype][jtype]->radj = radius[j]; - if (use_history || models[itype][jtype]->beyond_contact) - models[itype][jtype]->touch = touch[jj]; + model->xi = x[i]; + model->xj = x[j]; + model->radi = radius[i]; + model->radj = radius[j]; + if (use_history) model->touch = touch[jj]; - touchflag = models[itype][jtype]->check_contact(); + touchflag = model->check_contact(); if (!touchflag) { // unset non-touching neighbors if (use_history) { touch[jj] = 0; - history = &allhistory[size_history*jj]; + history = &allhistory[size_history * jj]; for (k = 0; k < size_history; k++) history[k] = 0.0; } continue; } // if any history is needed - if (use_history || models[itype][jtype]->beyond_contact) { - touch[jj] = 1; - } + if (use_history) touch[jj] = 1; // meff = effective mass of pair of particles // if I or J part of rigid body, use body mass @@ -231,27 +231,26 @@ void PairGranular::compute(int eflag, int vflag) if (mask[j] & freeze_group_bit) meff = mi; // Copy additional information and prepare force calculations - models[itype][jtype]->meff = meff; - models[itype][jtype]->vi = v[i]; - models[itype][jtype]->vj = v[j]; - models[itype][jtype]->omegai = omega[i]; - models[itype][jtype]->omegaj = omega[j]; + model->meff = meff; + model->vi = v[i]; + model->vj = v[j]; + model->omegai = omega[i]; + model->omegaj = omega[j]; if (use_history) { - history = &allhistory[size_history*jj]; - models[itype][jtype]->history = history; + history = &allhistory[size_history * jj]; + model->history = history; } if (heat_flag) { - models[itype][jtype]->Ti = temperature[i]; - models[itype][jtype]->Tj = temperature[j]; + model->Ti = temperature[i]; + model->Tj = temperature[j]; } - models[itype][jtype]->calculate_forces(); + model->calculate_forces(); - forces = models[itype][jtype]->forces; - torquesi = models[itype][jtype]->torquesi; - torquesj = models[itype][jtype]->torquesj; - if (heat_flag) dq = models[itype][jtype]->dq; + forces = model->forces; + torquesi = model->torquesi; + torquesj = model->torquesj; // apply forces & torques scale3(factor_lj, forces); @@ -259,21 +258,22 @@ void PairGranular::compute(int eflag, int vflag) scale3(factor_lj, torquesi); add3(torque[i], torquesi, torque[i]); - if (heat_flag) heatflow[i] += dq; if (force->newton_pair || j < nlocal) { sub3(f[j], forces, f[j]); scale3(factor_lj, torquesj); add3(torque[j], torquesj, torque[j]); - if (heat_flag) heatflow[j] -= dq; + } + + if (heat_flag) { + dq = model->dq; + heatflow[i] += dq; + if (force->newton_pair || j < nlocal) heatflow[j] -= dq; } if (evflag) { - delx = x[i][0] - x[j][0]; - dely = x[i][1] - x[j][1]; - delz = x[i][2] - x[j][2]; ev_tally_xyz(i,j,nlocal,force->newton_pair, - 0.0,0.0,forces[0],forces[1],forces[2],delx,dely,delz); + 0.0,0.0,forces[0],forces[1],forces[2],model->dx[0],model->dx[1],model->dx[2]); } } } @@ -703,12 +703,14 @@ double PairGranular::single(int i, int j, int itype, int jtype, double **x = atom->x; double *radius = atom->radius; + class GranularModel* model = models[itype][jtype]; + // Reset model and copy initial geometric data - models[itype][jtype]->xi = x[i]; - models[itype][jtype]->xj = x[j]; - models[itype][jtype]->radi = radius[i]; - models[itype][jtype]->radj = radius[j]; - models[i][j]->history_update = 0; // Don't update history + model->xi = x[i]; + model->xj = x[j]; + model->radi = radius[i]; + model->radj = radius[j]; + model->history_update = 0; // Don't update history // If history is needed jnum = list->numneigh[i]; @@ -723,10 +725,10 @@ double PairGranular::single(int i, int j, int itype, int jtype, if (jlist[neighprev] == j) break; } history = &allhistory[size_history*neighprev]; - models[itype][jtype]->touch = fix_history->firstflag[i][neighprev]; + model->touch = fix_history->firstflag[i][neighprev]; } - touchflag = models[itype][jtype]->check_contact(); + touchflag = model->check_contact(); if (!touchflag) { fforce = 0.0; @@ -755,18 +757,18 @@ double PairGranular::single(int i, int j, int itype, int jtype, double **v = atom->v; double **omega = atom->omega; - models[itype][jtype]->meff = meff; - models[itype][jtype]->vi = v[i]; - models[itype][jtype]->vj = v[j]; - models[itype][jtype]->omegai = omega[i]; - models[itype][jtype]->omegaj = omega[j]; - models[itype][jtype]->history = history; + model->meff = meff; + model->vi = v[i]; + model->vj = v[j]; + model->omegai = omega[i]; + model->omegaj = omega[j]; + model->history = history; double *forces, *torquesi, *torquesj; - models[itype][jtype]->calculate_forces(); - forces = models[itype][jtype]->forces; - torquesi = models[itype][jtype]->torquesi; - torquesj = models[itype][jtype]->torquesj; + model->calculate_forces(); + forces = model->forces; + torquesi = model->torquesi; + torquesj = model->torquesj; // apply forces & torques @@ -774,22 +776,18 @@ double PairGranular::single(int i, int j, int itype, int jtype, // set single_extra quantities - double delx = x[i][0] - x[j][0]; - double dely = x[i][1] - x[j][1]; - double delz = x[i][2] - x[j][2]; - - svector[0] = models[itype][jtype]->fs[0]; - svector[1] = models[itype][jtype]->fs[1]; - svector[2] = models[itype][jtype]->fs[2]; - svector[3] = MathExtra::len3(models[itype][jtype]->fs); - svector[4] = models[itype][jtype]->fr[0]; - svector[5] = models[itype][jtype]->fr[1]; - svector[6] = models[itype][jtype]->fr[2]; - svector[7] = MathExtra::len3(models[itype][jtype]->fr); - svector[8] = models[itype][jtype]->magtortwist; - svector[9] = delx; - svector[10] = dely; - svector[11] = delz; + svector[0] = model->fs[0]; + svector[1] = model->fs[1]; + svector[2] = model->fs[2]; + svector[3] = MathExtra::len3(model->fs); + svector[4] = model->fr[0]; + svector[5] = model->fr[1]; + svector[6] = model->fr[2]; + svector[7] = MathExtra::len3(model->fr); + svector[8] = model->magtortwist; + svector[9] = model->dx[0]; + svector[10] = model->dx[1]; + svector[11] = model->dx[2]; return 0.0; } From 971b932387a841c3b4e283ebb1b6b79b24049fd1 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 7 Nov 2022 17:39:40 -0700 Subject: [PATCH 45/57] Adding area flag for submodels --- src/GRANULAR/granular_model.cpp | 6 ++++-- src/GRANULAR/granular_model.h | 1 + src/GRANULAR/gsm.cpp | 1 + src/GRANULAR/gsm.h | 5 +++-- src/GRANULAR/gsm_damping.cpp | 6 +++++- src/GRANULAR/gsm_heat.cpp | 1 + src/GRANULAR/gsm_normal.cpp | 4 ++++ src/GRANULAR/gsm_tangential.cpp | 13 ++++--------- src/GRANULAR/gsm_tangential.h | 1 - src/GRANULAR/gsm_twisting.cpp | 1 + 10 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index f8a53c5cf2..66e34386ed 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -87,7 +87,6 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) #include "style_gsm.h" // IWYU pragma: keep #undef GSMStyle #undef GSM_CLASS - } /* ---------------------------------------------------------------------- */ @@ -241,6 +240,7 @@ void GranularModel::init() int size_cumulative; size_history = 0; + area_flag = 0; for (int i = 0; i < NSUBMODELS; i++) { if (sub_models[i]->nondefault_history_transfer) nondefault_history_transfer = 1; @@ -249,6 +249,7 @@ void GranularModel::init() size_history += sub_models[i]->size_history; if (!sub_models[i]->allow_cohesion && normal_model->cohesive_flag) error->all(FLERR,"Cannot use {} model with a cohesive normal model, {}", sub_models[i]->name, normal_model->name); + if (sub_models[i]->area_flag) area_flag = 1; } if (limit_damping && normal_model->cohesive_flag) @@ -410,7 +411,8 @@ void GranularModel::calculate_forces() // calculate forces/torques forces[0] = 0.0; double Fdamp, dist_to_contact; - area = normal_model->calculate_area(); + if (area_flag) + area = normal_model->calculate_area(); Fnormal = normal_model->calculate_forces(); Fdamp = damping_model->calculate_forces(); diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index dc404b332c..3ea3d9e4b3 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -98,6 +98,7 @@ class GranularModel : protected Pointers { protected: int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels int classic_model; + int area_flag; int nclass; diff --git a/src/GRANULAR/gsm.cpp b/src/GRANULAR/gsm.cpp index 1848a1743a..4ac7473504 100644 --- a/src/GRANULAR/gsm.cpp +++ b/src/GRANULAR/gsm.cpp @@ -42,6 +42,7 @@ GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) allow_cohesion = 1; beyond_contact = 0; num_coeffs = 0; + area_flag = 0; nondefault_history_transfer = 0; transfer_history_factor = nullptr; diff --git a/src/GRANULAR/gsm.h b/src/GRANULAR/gsm.h index 4695749d64..3c19179d52 100644 --- a/src/GRANULAR/gsm.h +++ b/src/GRANULAR/gsm.h @@ -40,8 +40,9 @@ class GSM : protected Pointers { double *transfer_history_factor; int history_index; - int beyond_contact; - int allow_cohesion; + int beyond_contact; // If the submodel contact extends beyond overlap + int allow_cohesion; // If the submodel works with a cohesive normal force + int area_flag; // If the submodel requires area GranularModel *gm; diff --git a/src/GRANULAR/gsm_damping.cpp b/src/GRANULAR/gsm_damping.cpp index ed4bfd8ae1..db7f0f3371 100644 --- a/src/GRANULAR/gsm_damping.cpp +++ b/src/GRANULAR/gsm_damping.cpp @@ -44,6 +44,7 @@ GSMDampingNone::GSMDampingNone(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, double GSMDampingNone::calculate_forces() { + damp_prefactor = 0.0; return 0.0; } @@ -79,7 +80,10 @@ double GSMDampingMassVelocity::calculate_forces() Default, viscoelastic damping ------------------------------------------------------------------------- */ -GSMDampingViscoelastic::GSMDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} +GSMDampingViscoelastic::GSMDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) +{ + area_flag = 1; +} /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_heat.cpp b/src/GRANULAR/gsm_heat.cpp index 7512e372a0..1a0cff5301 100644 --- a/src/GRANULAR/gsm_heat.cpp +++ b/src/GRANULAR/gsm_heat.cpp @@ -45,6 +45,7 @@ double GSMHeatNone::calculate_heat() GSMHeatArea::GSMHeatArea(GranularModel *gm, LAMMPS *lmp) : GSMHeat(gm, lmp) { num_coeffs = 1; + area_flag = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_normal.cpp b/src/GRANULAR/gsm_normal.cpp index 0ae288f6fd..28e4d7af79 100644 --- a/src/GRANULAR/gsm_normal.cpp +++ b/src/GRANULAR/gsm_normal.cpp @@ -115,6 +115,7 @@ double GSMNormalHooke::calculate_forces() GSMNormalHertz::GSMNormalHertz(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) { num_coeffs = 2; + area_flag = 1; } /* ---------------------------------------------------------------------- */ @@ -142,6 +143,7 @@ GSMNormalHertzMaterial::GSMNormalHertzMaterial(GranularModel *gm, LAMMPS *lmp) : { material_properties = 1; num_coeffs = 3; + area_flag = 1; } /* ---------------------------------------------------------------------- */ @@ -179,6 +181,7 @@ GSMNormalDMT::GSMNormalDMT(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) material_properties = 1; cohesive_flag = 1; num_coeffs = 4; + area_flag = 1; } /* ---------------------------------------------------------------------- */ @@ -236,6 +239,7 @@ GSMNormalJKR::GSMNormalJKR(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) cohesive_flag = 1; beyond_contact = 1; num_coeffs = 4; + area_flag = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gsm_tangential.cpp b/src/GRANULAR/gsm_tangential.cpp index 862159c386..a5dabde8fd 100644 --- a/src/GRANULAR/gsm_tangential.cpp +++ b/src/GRANULAR/gsm_tangential.cpp @@ -165,7 +165,7 @@ void GSMTangentialLinearHistory::calculate_forces() GSMTangentialLinearHistoryClassic::GSMTangentialLinearHistoryClassic(GranularModel *gm, LAMMPS *lmp) : GSMTangentialLinearHistory(gm, lmp) { - scale_area = 0; // Sets gran/hooke/history behavior + area_flag = 1; // Sets gran/hooke/history behavior } /* ---------------------------------------------------------------------- */ @@ -197,7 +197,7 @@ void GSMTangentialLinearHistoryClassic::calculate_forces() } // tangential forces = history + tangential velocity damping - if (scale_area) scale3(-k * gm->area, history, gm->fs); + if (area_flag) scale3(-k * gm->area, history, gm->fs); else scale3(-k, history, gm->fs); scale3(damp, gm->vtr, temp_array); sub3(gm->fs, temp_array, gm->fs); @@ -224,7 +224,7 @@ void GSMTangentialLinearHistoryClassic::calculate_forces() GSMTangentialMindlinClassic::GSMTangentialMindlinClassic(GranularModel *gm, LAMMPS *lmp) : GSMTangentialLinearHistoryClassic(gm, lmp) { - scale_area = 1; // Sets gran/hertz/history behavior + area_flag = 1; // Sets gran/hertz/history behavior } /* ---------------------------------------------------------------------- @@ -237,6 +237,7 @@ GSMTangentialMindlin::GSMTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GSM size_history = 3; mindlin_force = 0; mindlin_rescale = 0; + area_flag = 1; } /* ---------------------------------------------------------------------- */ @@ -367,10 +368,7 @@ void GSMTangentialMindlin::calculate_forces() GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) { - num_coeffs = 3; - size_history = 3; mindlin_force = 1; - mindlin_rescale = 0; } /* ---------------------------------------------------------------------- @@ -379,9 +377,7 @@ GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS * GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) { - num_coeffs = 3; size_history = 4; - mindlin_force = 0; mindlin_rescale = 1; nondefault_history_transfer = 1; @@ -396,7 +392,6 @@ GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMM GSMTangentialMindlinRescaleForce::GSMTangentialMindlinRescaleForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) { - num_coeffs = 3; size_history = 4; mindlin_force = 1; mindlin_rescale = 1; diff --git a/src/GRANULAR/gsm_tangential.h b/src/GRANULAR/gsm_tangential.h index 1d6dfa3d04..e755f63304 100644 --- a/src/GRANULAR/gsm_tangential.h +++ b/src/GRANULAR/gsm_tangential.h @@ -106,7 +106,6 @@ class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory { GSMTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); void calculate_forces(); protected: - int scale_area; double xt; }; diff --git a/src/GRANULAR/gsm_twisting.cpp b/src/GRANULAR/gsm_twisting.cpp index 73149b099b..42609bf632 100644 --- a/src/GRANULAR/gsm_twisting.cpp +++ b/src/GRANULAR/gsm_twisting.cpp @@ -43,6 +43,7 @@ GSMTwistingMarshall::GSMTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GSMTw { num_coeffs = 0; size_history = 3; + area_flag = 1; } /* ---------------------------------------------------------------------- */ From ea8ded470bf0b62a886c7b3a8d15b3e14a53b556 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 9 Nov 2022 10:17:07 -0700 Subject: [PATCH 46/57] Removing vectors to avoid resizing issues with coeff redefinitions --- src/GRANULAR/fix_wall_gran.cpp | 1 + src/GRANULAR/pair_granular.cpp | 212 ++++++++++++++++++++------------- src/GRANULAR/pair_granular.h | 7 +- 3 files changed, 131 insertions(+), 89 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 4956e9d900..583cbba62e 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -721,4 +721,5 @@ int FixWallGran::size_restart(int /*nlocal*/) void FixWallGran::reset_dt() { dt = update->dt; + model->dt = dt; } diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 9601b87382..dcac8e32c3 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -57,7 +57,8 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) svector = new double[single_extra]; neighprev = 0; - + nmodels = 0; + maxmodels = 0; nmax = 0; mass_rigid = nullptr; @@ -66,8 +67,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) maxrad_dynamic = nullptr; maxrad_frozen = nullptr; - dt = update->dt; - // set comm size needed by this Pair if used with fix rigid comm_forward = 1; @@ -97,6 +96,9 @@ PairGranular::~PairGranular() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cutoff_type); + memory->destroy(types_indices); + for (int i = 0; i < nmodels; i++) delete models_list[i]; + memory->sfree(models_list); delete [] onerad_dynamic; delete [] onerad_frozen; @@ -124,8 +126,8 @@ void PairGranular::compute(int eflag, int vflag) class GranularModel* model; - for (int i = 0; i < vec_models.size(); i++) - vec_models[i].history_update = history_update; + for (int i = 0; i < nmodels; i++) + models_list[i]->history_update = history_update; ev_init(eflag,vflag); @@ -193,7 +195,7 @@ void PairGranular::compute(int eflag, int vflag) if (factor_lj == 0) continue; jtype = type[j]; - model = models[itype][jtype]; + model = models_list[types_indices[itype][jtype]]; // Reset model and copy initial geometric data model->xi = x[i]; @@ -288,9 +290,6 @@ void PairGranular::allocate() allocated = 1; int n = atom->ntypes; - // Reserve enough memory for vector to avoid reallocation/changing pointers - vec_models.reserve(atom->ntypes * atom->ntypes); - memory->create(setflag,n+1,n+1,"pair:setflag"); for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) @@ -298,7 +297,11 @@ void PairGranular::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - models.resize(n+1, std::vector (n+1, nullptr)); + memory->create(types_indices,n+1,n+1,"pair:types_indices"); + + maxmodels = n * n + 1; // should never need any more space + models_list = (GranularModel **) memory->smalloc(maxmodels * sizeof(GranularModel *), "pair:models_list"); + for (int i = 0; i < maxmodels; i++) models_list[i] = nullptr; onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -336,27 +339,29 @@ void PairGranular::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - // Construct new model within vector - vec_models.emplace_back(lmp); + + // Construct new model + models_list[nmodels] = new GranularModel(lmp); + class GranularModel* model = models_list[nmodels]; + nmodels += 1; //Parse mandatory specification int iarg = 2; - iarg = vec_models.back().add_submodel(arg, iarg, narg, NORMAL); + iarg = model->add_submodel(arg, iarg, narg, NORMAL); //Parse optional arguments - while (iarg < narg) { if (strcmp(arg[iarg], "tangential") == 0) { - iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, TANGENTIAL); + iarg = model->add_submodel(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "damping") == 0) { - iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, DAMPING); + iarg = model->add_submodel(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, ROLLING); + iarg = model->add_submodel(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, TWISTING); + iarg = model->add_submodel(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg = vec_models.back().add_submodel(arg, iarg + 1, narg, HEAT); + iarg = model->add_submodel(arg, iarg + 1, narg, HEAT); heat_flag = 1; } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) @@ -364,25 +369,28 @@ void PairGranular::coeff(int narg, char **arg) cutoff_one = utils::numeric(FLERR,arg[iarg + 1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "limit_damping") == 0) { - vec_models.back().limit_damping = 1; + model->limit_damping = 1; iarg += 1; } else error->all(FLERR, "Illegal pair_coeff command {}", arg[iarg]); } // Define default damping model if unspecified, has no coeffs - if (!vec_models.back().damping_model) - vec_models.back().construct_submodel("viscoelastic", DAMPING); + if (!model->damping_model) + model->construct_submodel("viscoelastic", DAMPING); int count = 0; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { - models[i][j] = & vec_models.back(); + types_indices[i][j] = nmodels - 1; cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; setflag[i][j] = 1; count++; } } + // If there are > ntype^2 models, delete unused ones + if (nmodels == maxmodels) prune_models(); + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -392,7 +400,6 @@ void PairGranular::coeff(int narg, char **arg) void PairGranular::init_style() { - int i; // error and warning checks if (!atom->radius_flag || !atom->rmass_flag) @@ -408,30 +415,33 @@ void PairGranular::init_style() } // allocate history and initialize models + class GranularModel* model; int size_max[NSUBMODELS] = {0}; + for (int n = 0; n < nmodels; n++) { + model = models_list[n]; + model->init(); - for (auto &model : vec_models) { - model.init(); - if (model.beyond_contact) { + if (model->beyond_contact) { beyond_contact = 1; use_history = 1; // Need to track if in contact } - if (model.size_history != 0) use_history = 1; + if (model->size_history != 0) use_history = 1; - for (i = 0; i < NSUBMODELS; i++) - if (model.sub_models[i]->size_history > size_max[i]) - size_max[i] = model.sub_models[i]->size_history; + for (int i = 0; i < NSUBMODELS; i++) + if (model->sub_models[i]->size_history > size_max[i]) + size_max[i] = model->sub_models[i]->size_history; - if (model.nondefault_history_transfer) nondefault_history_transfer = 1; + if (model->nondefault_history_transfer) nondefault_history_transfer = 1; } size_history = 0; - for (i = 0; i < NSUBMODELS; i++) size_history += size_max[i]; + for (int i = 0; i < NSUBMODELS; i++) size_history += size_max[i]; - for (auto &model : vec_models) { + for (int n = 0; n < nmodels; n++) { + model = models_list[n]; int next_index = 0; - for (i = 0; i < NSUBMODELS; i++) { - model.sub_models[i]->history_index = next_index; + for (int i = 0; i < NSUBMODELS; i++) { + model->sub_models[i]->history_index = next_index; next_index += size_max[i]; } } @@ -439,8 +449,6 @@ void PairGranular::init_style() if (use_history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY); else neighbor->add_request(this, NeighConst::REQ_SIZE); - dt = update->dt; - // if history is stored and first init, create Fix to store history // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved @@ -483,7 +491,7 @@ void PairGranular::init_style() // include future FixPour and FixDeposit particles as dynamic int itype; - for (i = 1; i <= atom->ntypes; i++) { + for (int i = 1; i <= atom->ntypes; i++) { onerad_dynamic[i] = onerad_frozen[i] = 0.0; for (auto &ipour : pours) { itype = i; @@ -502,7 +510,7 @@ void PairGranular::init_style() int *type = atom->type; int nlocal = atom->nlocal; - for (i = 0; i < nlocal; i++) { + for (int i = 0; i < nlocal; i++) { if (mask[i] & freeze_group_bit) onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]], radius[i]); else @@ -527,32 +535,42 @@ void PairGranular::init_style() double PairGranular::init_one(int i, int j) { double cutoff = 0.0; + class GranularModel* model; if (setflag[i][j] == 0) { - vec_models.push_back(GranularModel(lmp)); - models[i][j] = models[j][i] = & vec_models.back(); + models_list[nmodels] = new GranularModel(lmp); + types_indices[i][j] = nmodels; + model = models_list[nmodels]; - int error_code = vec_models.back().mix_coeffs(models[i][i], models[j][j]); + nmodels += 1; + if (nmodels == maxmodels) prune_models(); + + class GranularModel* model1 = models_list[types_indices[i][i]]; + class GranularModel* model2 = models_list[types_indices[j][j]]; + + int error_code = model->mix_coeffs(model1, model2); if (error_code != -1) error->all(FLERR,"Granular pair style functional forms are different, " "cannot mix coefficients for types {} and {} \n" "with submodels {} and {}. \n" "This combination must be set explicitly via a " "pair_coeff command",i,j, - models[i][i]->sub_models[error_code]->name, - models[j][j]->sub_models[error_code]->name); + model1->sub_models[error_code]->name, + model2->sub_models[error_code]->name); - vec_models.back().init(); // Calculates cumulative properties of sub models + // Initialize new model, init_one() occurs after init_style + model->init(); for (int k = 0; k < NSUBMODELS; k++) - vec_models.back().sub_models[k]->history_index = models[i][i]->sub_models[k]->history_index; + model->sub_models[k]->history_index = model1->sub_models[k]->history_index; cutoff_type[i][j] = cutoff_type[j][i] = MAX(cutoff_type[i][i], cutoff_type[j][j]); } + model = models_list[types_indices[i][j]]; // Check if heat model is defined for all type combinations - if (heat_flag && !models[i][j]->heat_model) + if (heat_flag && !model->heat_model) error->all(FLERR, "Must specify a heat model for all pair types"); // It is possible that cut[i][j] at this point is still 0.0. @@ -571,14 +589,14 @@ double PairGranular::init_one(int i, int j) ((maxrad_frozen[i] > 0.0) && (maxrad_dynamic[j] > 0.0))) { cutoff = maxrad_dynamic[i] + maxrad_dynamic[j]; pulloff = 0.0; - if (models[i][j]->beyond_contact) { - pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); + if (model->beyond_contact) { + pulloff = model->pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j]); cutoff += pulloff; - pulloff = models[i][j]->pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); + pulloff = model->pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j]); cutoff = MAX(cutoff, maxrad_frozen[i] + maxrad_dynamic[j] + pulloff); - pulloff = models[i][j]->pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); + pulloff = model->pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j]); cutoff = MAX(cutoff,maxrad_dynamic[i] + maxrad_frozen[j] + pulloff); } } else { @@ -599,9 +617,8 @@ double PairGranular::init_one(int i, int j) cutoff = cutoff_global; } - // Copy global options - models[i][j]->dt = dt; - models[j][i] = models[i][j]; + model->dt = update->dt; + types_indices[j][i] = types_indices[i][j]; return cutoff; } @@ -611,18 +628,16 @@ double PairGranular::init_one(int i, int j) void PairGranular::write_restart(FILE *fp) { - int i,j,index; - int nmodels = vec_models.size(); + int i,j; fwrite(&nmodels,sizeof(int),1,fp); - for (auto &model : vec_models) model.write_restart(fp); + for (i = 0; i < nmodels; i++) models_list[i]->write_restart(fp); for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { fwrite(&cutoff_type[i][j],sizeof(double),1,fp); - index = models[i][j] - &vec_models[0]; - fwrite(&index,sizeof(int),1,fp); // save index of model + fwrite(&types_indices[i][j],sizeof(int),1,fp); } } } @@ -635,16 +650,15 @@ void PairGranular::write_restart(FILE *fp) void PairGranular::read_restart(FILE *fp) { allocate(); - int i,j,index,nmodels; + int i,j; int me = comm->me; if (me == 0) utils::sfread(FLERR,&nmodels,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nmodels,1,MPI_INT,0,world); for (i = 0; i < nmodels; i++) { - vec_models.push_back(GranularModel(lmp)); - vec_models.back().read_restart(fp); - vec_models.back().init(); + models_list[i] = new GranularModel(lmp); + models_list[i]->read_restart(fp); } for (i = 1; i <= atom->ntypes; i++) { @@ -654,12 +668,10 @@ void PairGranular::read_restart(FILE *fp) if (setflag[i][j]) { if (me == 0) { utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&index,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&types_indices[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cutoff_type[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&index,1,MPI_INT,0,world); - - models[i][j] = & vec_models[index]; + MPI_Bcast(&types_indices[i][j],1,MPI_INT,0,world); } } } @@ -669,13 +681,7 @@ void PairGranular::read_restart(FILE *fp) void PairGranular::reset_dt() { - dt = update->dt; - - for (int i = 1; i <= atom->ntypes; i++) { - for (int j = i; j <= atom->ntypes; j++) { - models[i][j]->dt = dt; - } - } + for (int i = 0; i < nmodels; i++) models_list[i]->dt = update->dt; } /* ---------------------------------------------------------------------- */ @@ -703,7 +709,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, double **x = atom->x; double *radius = atom->radius; - class GranularModel* model = models[itype][jtype]; + class GranularModel* model = models_list[types_indices[itype][jtype]]; // Reset model and copy initial geometric data model->xi = x[i]; @@ -771,11 +777,9 @@ double PairGranular::single(int i, int j, int itype, int jtype, torquesj = model->torquesj; // apply forces & torques - fforce = MathExtra::len3(forces); // set single_extra quantities - svector[0] = model->fs[0]; svector[1] = model->fs[1]; svector[2] = model->fs[2]; @@ -836,9 +840,10 @@ double PairGranular::memory_usage() void PairGranular::transfer_history(double* source, double* target, int itype, int jtype) { - if (models[itype][jtype]->nondefault_history_transfer) { + class GranularModel* model = models_list[types_indices[itype][jtype]]; + if (model->nondefault_history_transfer) { for (int i = 0; i < size_history; i++) { - target[i] = models[itype][jtype]->transfer_history_factor[i] * source [i]; + target[i] = model->transfer_history_factor[i] * source [i]; } } else { for (int i = 0; i < size_history; i++) { @@ -858,8 +863,9 @@ double PairGranular::atom2cut(int i) cut = atom->radius[i] * 2; if (beyond_contact) { int itype = atom->type[i]; - if (models[itype][itype]->beyond_contact) { - cut += models[itype][itype]->pulloff_distance(cut, cut); + class GranularModel* model = models_list[types_indices[itype][itype]]; + if (model->beyond_contact) { + cut += model->pulloff_distance(cut, cut); } } @@ -879,10 +885,12 @@ double PairGranular::radii2cut(double r1, double r2) double temp; // Check all combinations of i and j to find theoretical maximum pull off distance - for (int i = 0; i < n; i++){ - for (int j = 0; j < n; j++){ - if (models[i][j]->beyond_contact) { - temp = models[i][j]->pulloff_distance(r1, r2); + class GranularModel* model; + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= n; j++) { + model = models_list[types_indices[i][j]]; + if (model->beyond_contact) { + temp = model->pulloff_distance(r1, r2); if (temp > cut) cut = temp; } } @@ -893,3 +901,35 @@ double PairGranular::radii2cut(double r1, double r2) return cut; } + +/* ---------------------------------------------------------------------- + remove unused models +------------------------------------------------------------------------- */ + +void PairGranular::prune_models() +{ + int ntypes = atom->ntypes; + for (int n = nmodels-1; n >= 0; n--) { + + // Find and delete unused models + int in_use = 0; + for (int i = 1; i <= ntypes; i++) + for (int j = 1; j <= ntypes; j++) + if (types_indices[i][j] == n) in_use = 1; + + if (in_use) continue; + delete models_list[n]; + + // Shift models if needed + if (n != nmodels - 1) { + models_list[n] = models_list[nmodels-1]; + for (int i = 1; i <= ntypes; i++) + for (int j = 1; j <= ntypes; j++) + if (types_indices[i][j] == nmodels-1) + types_indices[i][j] = n; + } + + models_list[nmodels-1] = nullptr; + nmodels -= 1; + } +} diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index ae09e37f5e..9ae02a200a 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -46,7 +46,6 @@ class PairGranular : public Pair { double radii2cut(double, double) override; protected: - double dt; int freeze_group_bit; int use_history; @@ -66,14 +65,16 @@ class PairGranular : public Pair { void allocate(); void transfer_history(double *, double *, int, int) override; + void prune_models(); private: int size_history; int heat_flag; // granular models - std::vector vec_models; - std::vector > models; + int nmodels, maxmodels; + Granular_NS::GranularModel** models_list; + int **types_indices; // optional user-specified global cutoff, per-type user-specified cutoffs double **cutoff_type; From d1dd8d3c110c117ce49e8144df7a68deae789156 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 10 Nov 2022 16:06:36 -0700 Subject: [PATCH 47/57] Renaming files/classes, other small, misc updates --- cmake/Modules/StyleHeaderUtils.cmake | 42 +++---- doc/src/Modify.rst | 2 +- ...Modify_gsm.rst => Modify_gran_sub_mod.rst} | 103 +++++++++--------- ...rate.rst => fix_heat_flow_sphere_temp.rst} | 12 +- src/.gitignore | 32 +++--- ...rate.cpp => fix_heat_flow_sphere_temp.cpp} | 17 ++- ...ntegrate.h => fix_heat_flow_sphere_temp.h} | 10 +- src/GRANULAR/fix_wall_gran.cpp | 2 +- src/GRANULAR/fix_wall_gran.h | 6 +- src/GRANULAR/{gsm.cpp => gran_sub_mod.cpp} | 22 ++-- src/GRANULAR/{gsm.h => gran_sub_mod.h} | 12 +- ...m_damping.cpp => gran_sub_mod_damping.cpp} | 30 ++--- .../{gsm_damping.h => gran_sub_mod_damping.h} | 58 +++++----- .../{gsm_heat.cpp => gran_sub_mod_heat.cpp} | 14 +-- .../{gsm_heat.h => gran_sub_mod_heat.h} | 34 +++--- ...gsm_normal.cpp => gran_sub_mod_normal.cpp} | 60 +++++----- .../{gsm_normal.h => gran_sub_mod_normal.h} | 66 +++++------ ...m_rolling.cpp => gran_sub_mod_rolling.cpp} | 16 +-- .../{gsm_rolling.h => gran_sub_mod_rolling.h} | 34 +++--- ...ential.cpp => gran_sub_mod_tangential.cpp} | 44 ++++---- ...tangential.h => gran_sub_mod_tangential.h} | 90 +++++++-------- ...twisting.cpp => gran_sub_mod_twisting.cpp} | 22 ++-- ...gsm_twisting.h => gran_sub_mod_twisting.h} | 42 +++---- src/GRANULAR/granular_model.cpp | 68 ++++++------ src/GRANULAR/granular_model.h | 38 +++---- src/GRANULAR/pair_granular.cpp | 2 +- src/GRANULAR/pair_granular.h | 7 +- src/Make.sh | 42 +++---- 28 files changed, 468 insertions(+), 459 deletions(-) rename doc/src/{Modify_gsm.rst => Modify_gran_sub_mod.rst} (59%) rename doc/src/{fix_temp_integrate.rst => fix_heat_flow_sphere_temp.rst} (85%) rename src/GRANULAR/{fix_temp_integrate.cpp => fix_heat_flow_sphere_temp.cpp} (89%) rename src/GRANULAR/{fix_temp_integrate.h => fix_heat_flow_sphere_temp.h} (82%) rename src/GRANULAR/{gsm.cpp => gran_sub_mod.cpp} (85%) rename src/GRANULAR/{gsm.h => gran_sub_mod.h} (89%) rename src/GRANULAR/{gsm_damping.cpp => gran_sub_mod_damping.cpp} (74%) rename src/GRANULAR/{gsm_damping.h => gran_sub_mod_damping.h} (58%) rename src/GRANULAR/{gsm_heat.cpp => gran_sub_mod_heat.cpp} (79%) rename src/GRANULAR/{gsm_heat.h => gran_sub_mod_heat.h} (66%) rename src/GRANULAR/{gsm_normal.cpp => gran_sub_mod_normal.cpp} (82%) rename src/GRANULAR/{gsm_normal.h => gran_sub_mod_normal.h} (65%) rename src/GRANULAR/{gsm_rolling.cpp => gran_sub_mod_rolling.cpp} (87%) rename src/GRANULAR/{gsm_rolling.h => gran_sub_mod_rolling.h} (65%) rename src/GRANULAR/{gsm_tangential.cpp => gran_sub_mod_tangential.cpp} (84%) rename src/GRANULAR/{gsm_tangential.h => gran_sub_mod_tangential.h} (50%) rename src/GRANULAR/{gsm_twisting.cpp => gran_sub_mod_twisting.cpp} (82%) rename src/GRANULAR/{gsm_twisting.h => gran_sub_mod_twisting.h} (62%) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index 2bc84252d3..d95e265c4a 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -95,27 +95,27 @@ function(RegisterIntegrateStyle path) endfunction(RegisterIntegrateStyle) function(RegisterStyles search_path) - FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force - FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid - FindStyleHeaders(${search_path} BODY_CLASS body_ BODY ) # body ) # atom_vec_body - FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force - FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input - FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify - FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force - FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump - FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify - FindStyleHeaders(${search_path} GSM_CLASS gsm_ GSM ) # gsm ) # granular_model - FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force - FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update - FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force - FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update - FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor - FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor - FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor - FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor - FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force - FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump - FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain + FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force + FindStyleHeaders(${search_path} ATOM_CLASS atom_vec_ ATOM_VEC ) # atom ) # atom atom_vec_hybrid + FindStyleHeaders(${search_path} BODY_CLASS body_ BODY ) # body ) # atom_vec_body + FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force + FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input + FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify + FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force + FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump + FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify + FindStyleHeaders(${search_path} GRAN_SUB_MOD_CLASS gran_sub_mod_ GRAN_SUB_MOD ) # gran_sub_mod ) # granular_model + FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force + FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update + FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force + FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update + FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor + FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor + FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor + FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor + FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force + FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump + FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain endfunction(RegisterStyles) function(RegisterStylesExt search_path extension sources) diff --git a/doc/src/Modify.rst b/doc/src/Modify.rst index 39a1faeb87..8ea7850fc5 100644 --- a/doc/src/Modify.rst +++ b/doc/src/Modify.rst @@ -34,6 +34,6 @@ style requirements and recommendations `. Modify_min Modify_region Modify_body - Modify_gsm + Modify_gran_sub_mod Modify_thermo Modify_variable diff --git a/doc/src/Modify_gsm.rst b/doc/src/Modify_gran_sub_mod.rst similarity index 59% rename from doc/src/Modify_gsm.rst rename to doc/src/Modify_gran_sub_mod.rst index 515c776c6c..fe8b0da275 100644 --- a/doc/src/Modify_gsm.rst +++ b/doc/src/Modify_gran_sub_mod.rst @@ -1,4 +1,4 @@ -Granular Sub-model (GSM) styles +Granular Sub-Model styles =============================== In granular models, particles are spheres with a finite radius and rotational @@ -11,27 +11,27 @@ torques, and heat flow between two types of bodies is defined using a GranularModel class. The GranularModel class organizes the details of an interaction using a series of granular sub-models each of which describe a particular interaction mode (e.g. normal forces or rolling friction). From a -parent GSM class, several types of sub-model classes are derived: +parent GranSubMod class, several types of sub-model classes are derived: -* GSMNormal: normal force sub-model -* GSMDamping: normal damping sub-model -* GSMTangential: tangential forces and sliding friction sub-model -* GSMRolling: rolling friction sub-model -* GSMTwisting: twisting friction sub-model -* GSMHeat: heat conduction sub-model +* GranSubModNormal: normal force sub-model +* GranSubModDamping: normal damping sub-model +* GranSubModTangential: tangential forces and sliding friction sub-model +* GranSubModRolling: rolling friction sub-model +* GranSubModTwisting: twisting friction sub-model +* GranSubModHeat: heat conduction sub-model For each type of sub-model, more classes are further derived, each describing -a specific implementation. For instance, from the GSMNormal class the -GSMNormalHooke, GSMNormalHertz, and GSMNormalJKR classes are derived which -calculate Hookean, Hertzian, or JKR normal forces, respectively. This modular -structure simplifies the addition of new granular contact models as as one only -needs to create a new GSM class without having to modify the more complex -PairGranular, FixGranWall, and GranularModel classes. Most GSM methods are also -already defined by the parent classes so new contact models typically only require -edits to a few relevant methods (e.g. methods that define coefficients and +a specific implementation. For instance, from the GranSubModNormal class the +GranSubModNormalHooke, GranSubModNormalHertz, and GranSubModNormalJKR classes +are derived which calculate Hookean, Hertzian, or JKR normal forces, respectively. +This modular structure simplifies the addition of new granular contact models as +as one onlyneeds to create a new GranSubMod class without having to modify the more +complex PairGranular, FixGranWall, and GranularModel classes. Most GranSubMod methods +are also already defined by the parent classes so new contact models typically only +require edits to a few relevant methods (e.g. methods that define coefficients and calculate forces). -Each GSM class has a pointer to both the LAMMPS class and the GranularModel +Each GranSubMod class has a pointer to both the LAMMPS class and the GranularModel class which owns it, ``lmp`` and ``gm``, respectively. The GranularModel class includes several public variables that describe the geometry/dynamics of the contact such as @@ -59,69 +59,70 @@ These quantities, among others, are calculated in the ``GranularModel->check_con and ``GranularModel->calculate_forces()`` methods which can be referred to for more details. -To create a new GSM class, it is recommended that one first looks at similar GSM -classes. All GSM classes share several general methods which may need to be defined +To create a new GranSubMod class, it is recommended that one first looks at similar +GranSubMod classes. All GranSubMod classes share several general methods which may +need to be defined .. list-table:: - * - ``GSM->mix_coeff()`` + * - ``GranSubMod->mix_coeff()`` - Optional method to define how coefficients are mixed for different atom types. By default, coefficients are mixed using a geometric mean. - * - ``GSM->coeffs_to_local()`` + * - ``GranSubMod->coeffs_to_local()`` - Parses coefficients to define local variables. Run once at model construction. - * - ``GSM->init()`` - - Optional method to define local variables after other GSM types were created. For instance, this method may be used by a tangential model that derives parameters from the normal model. + * - ``GranSubMod->init()`` + - Optional method to define local variables after other GranSubMod types were created. For instance, this method may be used by a tangential model that derives parameters from the normal model. There are also several type-specific methods .. list-table:: - * - ``GSMNormal->touch()`` + * - ``GranSubModNormal->touch()`` - Optional method to test when particles are in contact. By default, this is when particles overlap. - * - ``GSMNormal->pulloff_distance()`` + * - ``GranSubModNormal->pulloff_distance()`` - Optional method to return the distance at which particles stop interacting. By default, this is when particles no longer overlap. - * - ``GSMNormal->calculate_area()`` + * - ``GranSubModNormal->calculate_area()`` - Optional method to return the surface area of the contact. By default, this returns the geometric cross section. - * - ``GSMNormal->set_fncrit()`` + * - ``GranSubModNormal->set_fncrit()`` - Optional method that defines the critical force to break the contact used by some tangential, rolling, and twisting sub-models. By default, this is the current total normal force including damping. - * - ``GSMNormal->calculate_forces()`` + * - ``GranSubModNormal->calculate_forces()`` - Required method that returns the normal contact force - * - ``GSMDamping->calculate_forces()`` + * - ``GranSubModDamping->calculate_forces()`` - Required method that returns the normal damping force - * - ``GSMTangential->calculate_forces()`` + * - ``GranSubModTangential->calculate_forces()`` - Required method that calculates tangential forces/torques - * - ``GSMTwisting->calculate_forces()`` + * - ``GranSubModTwisting->calculate_forces()`` - Required method that calculates twisting friction forces/torques - * - ``GSMRolling->calculate_forces()`` + * - ``GranSubModRolling->calculate_forces()`` - Required method that calculates rolling friction forces/torques - * - ``GSMHeat->calculate_heat()`` + * - ``GranSubModHeat->calculate_heat()`` - Required method that returns the rate of heat flow As an example, say one wanted to create a new normal force option that consisted of a Hookean force with a piecewise stiffness. This could be done by adding a new -set of files ``gsm_custom.h``: +set of files ``gran_sub_mod_custom.h``: .. code-block:: c++ - #ifdef GSM_CLASS + #ifdef GranSubMod_CLASS // clang-format off - GSMStyle(hooke/piecewise, - GSMNormalHookePiecewise, + GranSubModStyle(hooke/piecewise, + GranSubModNormalHookePiecewise, NORMAL); // clang-format on #else - #ifndef GSM_CUSTOM_H_ - #define GSM_CUSTOM_H_ + #ifndef GRAN_SUB_MOD_CUSTOM_H_ + #define GRAN_SUB_MOD_CUSTOM_H_ - #include "gsm.h" - #include "gsm_normal.h" + #include "gran_sub_mod.h" + #include "gran_sub_mod_normal.h" namespace LAMMPS_NS { namespace Granular_NS { - class GSMNormalHookePiecewise : public GSMNormal { + class GranSubModNormalHookePiecewise : public GranSubModNormal { public: - GSMNormalHookePiecewise(class GranularModel *, class LAMMPS *); + GranSubModNormalHookePiecewise(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; double calculate_forces(); protected: @@ -131,29 +132,29 @@ set of files ``gsm_custom.h``: } // namespace Granular_NS } // namespace LAMMPS_NS - #endif /*GSM_CUSTOM_H_ */ - #endif /*GSM_CLASS_H_ */ + #endif /*GRAN_SUB_MOD_CUSTOM_H_ */ + #endif /*GRAN_SUB_MOD_CLASS_H_ */ -and ``gsm_custom.cpp`` +and ``gran_sub_mod_custom.cpp`` .. code-block:: c++ - #include "gsm_custom.h" - #include "gsm_normal.h" + #include "gran_sub_mod_custom.h" + #include "gran_sub_mod_normal.h" #include "granular_model.h" using namespace LAMMPS_NS; using namespace Granular_NS; - GSMNormalHookePiecewise::GSMNormalHookePiecewise(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) + GranSubModNormalHookePiecewise::GranSubModNormalHookePiecewise(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp) { num_coeffs = 4; } /* ---------------------------------------------------------------------- */ - void GSMNormalHookePiecewise::coeffs_to_local() + void GranSubModNormalHookePiecewise::coeffs_to_local() { k1 = coeffs[0]; k2 = coeffs[1]; @@ -163,7 +164,7 @@ and ``gsm_custom.cpp`` /* ---------------------------------------------------------------------- */ - double GSMNormalHookePiecewise::calculate_forces() + double GranSubModNormalHookePiecewise::calculate_forces() { double Fne; if (gm->delta >= delta_switch) { diff --git a/doc/src/fix_temp_integrate.rst b/doc/src/fix_heat_flow_sphere_temp.rst similarity index 85% rename from doc/src/fix_temp_integrate.rst rename to doc/src/fix_heat_flow_sphere_temp.rst index efcf450d8f..c604b041ad 100644 --- a/doc/src/fix_temp_integrate.rst +++ b/doc/src/fix_heat_flow_sphere_temp.rst @@ -1,6 +1,6 @@ -.. index:: fix temp/integrate +.. index:: fix heat/flow/sphere/temp -fix temp/integrate command +fix heat/flow/sphere/temp command ========================== Syntax @@ -8,10 +8,10 @@ Syntax .. parsed-literal:: - fix ID group-ID temp/integrate style values ... + fix ID group-ID heat/flow/sphere/temp style values ... * ID, group-ID are documented in :doc:`fix ` command -* temp/integrate = style name of this fix command +* heat/flow/sphere/temp = style name of this fix command * one style with corresponding value(s) needs to be listed .. parsed-literal:: @@ -29,8 +29,8 @@ Examples .. code-block:: LAMMPS - fix 1 all temp/integrate constant 1.0 - fix 1 all temp/integrate type 1.0 0.5 + fix 1 all heat/flow/sphere/temp constant 1.0 + fix 1 all heat/flow/sphere/temp type 1.0 0.5 Description """"""""""" diff --git a/src/.gitignore b/src/.gitignore index c03af484ee..f2f2d3c110 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1533,8 +1533,8 @@ /fix_srp.h /fix_srp_react.cpp /fix_srp_react.h -/fix_temp_integrate.cpp -/fix_temp_integrate.h +/fix_heat_flow_sphere_temp.cpp +/fix_heat_flow_sphere_temp.h /fix_tfmc.cpp /fix_tfmc.h /fix_ttm.cpp @@ -1545,20 +1545,20 @@ /fix_ttm_mod.h /granular_model.cpp /granular_model.h -/gsm_normal.cpp -/gsm_normal.h -/gsm_damping.cpp -/gsm_damping.h -/gsm_tangential.cpp -/gsm_tangential.h -/gsm_twisting.cpp -/gsm_twisting.h -/gsm_rolling.cpp -/gsm_rolling.h -/gsm_heat.cpp -/gsm_heat.h -/gsm.cpp -/gsm.h +/gran_sub_mod_normal.cpp +/gran_sub_mod_normal.h +/gran_sub_mod_damping.cpp +/gran_sub_mod_damping.h +/gran_sub_mod_tangential.cpp +/gran_sub_mod_tangential.h +/gran_sub_mod_twisting.cpp +/gran_sub_mod_twisting.h +/gran_sub_mod_rolling.cpp +/gran_sub_mod_rolling.h +/gran_sub_mod_heat.cpp +/gran_sub_mod_heat.h +/gran_sub_mod.cpp +/gran_sub_mod.h /pair_born_coul_long_cs.cpp /pair_born_coul_long_cs.h /pair_born_coul_dsf_cs.cpp diff --git a/src/GRANULAR/fix_temp_integrate.cpp b/src/GRANULAR/fix_heat_flow_sphere_temp.cpp similarity index 89% rename from src/GRANULAR/fix_temp_integrate.cpp rename to src/GRANULAR/fix_heat_flow_sphere_temp.cpp index ab9739e874..fe7fc49324 100644 --- a/src/GRANULAR/fix_temp_integrate.cpp +++ b/src/GRANULAR/fix_heat_flow_sphere_temp.cpp @@ -12,7 +12,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "fix_temp_integrate.h" +#include "fix_heat_flow_sphere_temp.h" #include "atom.h" #include "error.h" @@ -28,7 +28,7 @@ enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ -FixTempIntegrate::FixTempIntegrate(LAMMPS *lmp, int narg, char **arg) : +FixHeatFlowSphereTemp::FixHeatFlowSphereTemp(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal fix command"); @@ -56,12 +56,11 @@ FixTempIntegrate::FixTempIntegrate(LAMMPS *lmp, int narg, char **arg) : if (cp_style == NONE) error->all(FLERR, "Must specify specific heat in fix temp/integrate"); dynamic_group_allow = 1; - time_integrate = 1; } /* ---------------------------------------------------------------------- */ -int FixTempIntegrate::setmask() +int FixHeatFlowSphereTemp::setmask() { int mask = 0; mask |= FINAL_INTEGRATE; @@ -71,7 +70,7 @@ int FixTempIntegrate::setmask() /* ---------------------------------------------------------------------- */ -void FixTempIntegrate::init() +void FixHeatFlowSphereTemp::init() { dt = update->dt; @@ -83,7 +82,7 @@ void FixTempIntegrate::init() /* ---------------------------------------------------------------------- */ -void FixTempIntegrate::final_integrate() +void FixHeatFlowSphereTemp::final_integrate() { // update temperature of atoms in group @@ -111,7 +110,7 @@ void FixTempIntegrate::final_integrate() /* ---------------------------------------------------------------------- */ -void FixTempIntegrate::final_integrate_respa(int ilevel, int /*iloop*/) +void FixHeatFlowSphereTemp::final_integrate_respa(int ilevel, int /*iloop*/) { dt = update->dt; final_integrate(); @@ -119,14 +118,14 @@ void FixTempIntegrate::final_integrate_respa(int ilevel, int /*iloop*/) /* ---------------------------------------------------------------------- */ -void FixTempIntegrate::reset_dt() +void FixHeatFlowSphereTemp::reset_dt() { dt = update->dt; } /* ---------------------------------------------------------------------- */ -double FixTempIntegrate::calc_cp(int i) +double FixHeatFlowSphereTemp::calc_cp(int i) { if (cp_style == TYPE) { return cp_type[atom->type[i]]; diff --git a/src/GRANULAR/fix_temp_integrate.h b/src/GRANULAR/fix_heat_flow_sphere_temp.h similarity index 82% rename from src/GRANULAR/fix_temp_integrate.h rename to src/GRANULAR/fix_heat_flow_sphere_temp.h index 8356d00433..6bc2d50373 100644 --- a/src/GRANULAR/fix_temp_integrate.h +++ b/src/GRANULAR/fix_heat_flow_sphere_temp.h @@ -13,20 +13,20 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(temp/integrate,FixTempIntegrate); +FixStyle(heat/flow/sphere/temp,FixHeatFlowSphereTemp); // clang-format on #else -#ifndef LMP_FIX_TEMP_INTEGRATE_H -#define LMP_FIX_TEMP_INTEGRATE_H +#ifndef LMP_FIX_HEAT_FLOW_SPHERE_TEMP_H +#define LMP_FIX_HEAT_FLOW_SPHERE_TEMP_H #include "fix.h" namespace LAMMPS_NS { -class FixTempIntegrate : public Fix { +class FixHeatFlowSphereTemp : public Fix { public: - FixTempIntegrate(class LAMMPS *, int, char **); + FixHeatFlowSphereTemp(class LAMMPS *, int, char **); int setmask() override; void init() override; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 583cbba62e..fe2286a0fa 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "granular_model.h" -#include "gsm.h" +#include "gran_sub_mod.h" #include "domain.h" #include "error.h" #include "input.h" diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index a621a973e2..16a2fe5dc0 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -25,6 +25,10 @@ FixStyle(wall/gran,FixWallGran); namespace LAMMPS_NS { +namespace Granular_NS { + class GranularModel; +} + class FixWallGran : public Fix { public: FixWallGran(class LAMMPS *, int, char **); @@ -53,7 +57,7 @@ class FixWallGran : public Fix { bigint time_origin; // for granular model choices - Granular_NS::GranularModel *model; + class Granular_NS::GranularModel *model; double lo, hi, cylradius; double amplitude, period, omega, vshear; diff --git a/src/GRANULAR/gsm.cpp b/src/GRANULAR/gran_sub_mod.cpp similarity index 85% rename from src/GRANULAR/gsm.cpp rename to src/GRANULAR/gran_sub_mod.cpp index 4ac7473504..2d836151f8 100644 --- a/src/GRANULAR/gsm.cpp +++ b/src/GRANULAR/gran_sub_mod.cpp @@ -13,7 +13,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - This class contains a framework for granular submodels (GSM) including: + This class contains a framework for granular submodels (GranSubMod): normal, damping, tangential, rolling, twisting, and heat These are used to calculate forces/torques/etc based on contact geometry @@ -21,7 +21,7 @@ Dan Bolintineanu (SNL), Joel Clemmer (SNL) ----------------------------------------------------------------------- */ -#include "gsm.h" +#include "gran_sub_mod.h" #include "error.h" #include "utils.h" @@ -32,7 +32,7 @@ using namespace Granular_NS; Parent class for all types of granular submodels ------------------------------------------------------------------------- */ -GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) +GranSubMod::GranSubMod(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) { this->gm = gm; @@ -51,7 +51,7 @@ GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) /* ---------------------------------------------------------------------- */ -GSM::~GSM() +GranSubMod::~GranSubMod() { if (allocated) delete [] coeffs; delete [] transfer_history_factor; @@ -59,7 +59,7 @@ GSM::~GSM() /* ---------------------------------------------------------------------- */ -void GSM::allocate_coeffs() +void GranSubMod::allocate_coeffs() { allocated = 1; coeffs = new double[num_coeffs]; @@ -67,7 +67,7 @@ void GSM::allocate_coeffs() /* ---------------------------------------------------------------------- */ -void GSM::mix_coeffs(double* icoeffs, double* jcoeffs) +void GranSubMod::mix_coeffs(double* icoeffs, double* jcoeffs) { for (int i = 0; i < num_coeffs; i++) coeffs[i] = mix_geom(icoeffs[i], jcoeffs[i]); @@ -78,7 +78,7 @@ void GSM::mix_coeffs(double* icoeffs, double* jcoeffs) mixing of Young's modulus (E) ------------------------------------------------------------------------- */ -double GSM::mix_stiffnessE(double E1, double E2, +double GranSubMod::mix_stiffnessE(double E1, double E2, double pois1, double pois2) { double factor1 = (1 - pois1 * pois1) / E1; @@ -90,7 +90,7 @@ double GSM::mix_stiffnessE(double E1, double E2, mixing of shear modulus (G) ------------------------------------------------------------------------ */ -double GSM::mix_stiffnessG(double E1, double E2, +double GranSubMod::mix_stiffnessG(double E1, double E2, double pois1, double pois2) { double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; @@ -102,7 +102,7 @@ double GSM::mix_stiffnessG(double E1, double E2, mixing of Young's modulus (E) for walls ------------------------------------------------------------------------- */ -double GSM::mix_stiffnessE_wall(double E, double pois) +double GranSubMod::mix_stiffnessE_wall(double E, double pois) { double factor = 2 * (1 - pois); return E / factor; @@ -112,7 +112,7 @@ double GSM::mix_stiffnessE_wall(double E, double pois) mixing of shear modulus (G) for walls ------------------------------------------------------------------------ */ -double GSM::mix_stiffnessG_wall(double E, double pois) +double GranSubMod::mix_stiffnessG_wall(double E, double pois) { double factor = 32.0 * (2 - pois) * (1 + pois); return E / factor; @@ -122,7 +122,7 @@ double GSM::mix_stiffnessG_wall(double E, double pois) mixing of everything else ------------------------------------------------------------------------- */ -double GSM::mix_geom(double val1, double val2) +double GranSubMod::mix_geom(double val1, double val2) { return sqrt(val1 * val2); } diff --git a/src/GRANULAR/gsm.h b/src/GRANULAR/gran_sub_mod.h similarity index 89% rename from src/GRANULAR/gsm.h rename to src/GRANULAR/gran_sub_mod.h index 3c19179d52..78f4229b29 100644 --- a/src/GRANULAR/gsm.h +++ b/src/GRANULAR/gran_sub_mod.h @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef LMP_GSM_H_ -#define LMP_GSM_H_ +#ifndef LMP_GRAN_SUB_MOD_H_ +#define LMP_GRAN_SUB_MOD_H_ #include "granular_model.h" #include "pointers.h" // IWYU pragma: export @@ -20,10 +20,10 @@ namespace LAMMPS_NS { namespace Granular_NS { -class GSM : protected Pointers { +class GranSubMod : protected Pointers { public: - GSM(class GranularModel *, class LAMMPS *); - virtual ~GSM(); + GranSubMod(class GranularModel *, class LAMMPS *); + virtual ~GranSubMod(); int num_coeffs; double *coeffs; @@ -59,4 +59,4 @@ class GSM : protected Pointers { } // namespace GranularModel } // namespace LAMMPS_NS -#endif /* GSM_H_ */ +#endif /* GRAN_SUB_MOD_H_ */ diff --git a/src/GRANULAR/gsm_damping.cpp b/src/GRANULAR/gran_sub_mod_damping.cpp similarity index 74% rename from src/GRANULAR/gsm_damping.cpp rename to src/GRANULAR/gran_sub_mod_damping.cpp index db7f0f3371..e78233735a 100644 --- a/src/GRANULAR/gsm_damping.cpp +++ b/src/GRANULAR/gran_sub_mod_damping.cpp @@ -12,8 +12,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "gsm_damping.h" -#include "gsm_normal.h" +#include "gran_sub_mod_damping.h" +#include "gran_sub_mod_normal.h" #include "granular_model.h" #include "math_special.h" @@ -25,11 +25,11 @@ using namespace MathSpecial; Default damping model ------------------------------------------------------------------------- */ -GSMDamping::GSMDamping(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} +GranSubModDamping::GranSubModDamping(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {} /* ---------------------------------------------------------------------- */ -void GSMDamping::init() +void GranSubModDamping::init() { damp = gm->normal_model->damp; } @@ -38,11 +38,11 @@ void GSMDamping::init() No model ------------------------------------------------------------------------- */ -GSMDampingNone::GSMDampingNone(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} +GranSubModDampingNone::GranSubModDampingNone(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp) {} /* ---------------------------------------------------------------------- */ -double GSMDampingNone::calculate_forces() +double GranSubModDampingNone::calculate_forces() { damp_prefactor = 0.0; return 0.0; @@ -52,11 +52,11 @@ double GSMDampingNone::calculate_forces() Velocity damping ------------------------------------------------------------------------- */ -GSMDampingVelocity::GSMDampingVelocity(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} +GranSubModDampingVelocity::GranSubModDampingVelocity(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp) {} /* ---------------------------------------------------------------------- */ -double GSMDampingVelocity::calculate_forces() +double GranSubModDampingVelocity::calculate_forces() { damp_prefactor = damp; return -damp_prefactor * gm->vnnr; @@ -66,11 +66,11 @@ double GSMDampingVelocity::calculate_forces() Mass velocity damping ------------------------------------------------------------------------- */ -GSMDampingMassVelocity::GSMDampingMassVelocity(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) {} +GranSubModDampingMassVelocity::GranSubModDampingMassVelocity(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp) {} /* ---------------------------------------------------------------------- */ -double GSMDampingMassVelocity::calculate_forces() +double GranSubModDampingMassVelocity::calculate_forces() { damp_prefactor = damp * gm->meff; return -damp_prefactor * gm->vnnr; @@ -80,14 +80,14 @@ double GSMDampingMassVelocity::calculate_forces() Default, viscoelastic damping ------------------------------------------------------------------------- */ -GSMDampingViscoelastic::GSMDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) +GranSubModDampingViscoelastic::GranSubModDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp) { area_flag = 1; } /* ---------------------------------------------------------------------- */ -double GSMDampingViscoelastic::calculate_forces() +double GranSubModDampingViscoelastic::calculate_forces() { damp_prefactor = damp * gm->meff * gm->area; return -damp_prefactor * gm->vnnr; @@ -97,14 +97,14 @@ double GSMDampingViscoelastic::calculate_forces() Tsuji damping ------------------------------------------------------------------------- */ -GSMDampingTsuji::GSMDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) +GranSubModDampingTsuji::GranSubModDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp) { allow_cohesion = 0; } /* ---------------------------------------------------------------------- */ -void GSMDampingTsuji::init() +void GranSubModDampingTsuji::init() { double tmp = gm->normal_model->damp; damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); @@ -114,7 +114,7 @@ void GSMDampingTsuji::init() /* ---------------------------------------------------------------------- */ -double GSMDampingTsuji::calculate_forces() +double GranSubModDampingTsuji::calculate_forces() { damp_prefactor = damp * sqrt(gm->meff * gm->Fnormal / gm->delta); return -damp_prefactor * gm->vnnr; diff --git a/src/GRANULAR/gsm_damping.h b/src/GRANULAR/gran_sub_mod_damping.h similarity index 58% rename from src/GRANULAR/gsm_damping.h rename to src/GRANULAR/gran_sub_mod_damping.h index 75c0f96356..04316a950d 100644 --- a/src/GRANULAR/gsm_damping.h +++ b/src/GRANULAR/gran_sub_mod_damping.h @@ -11,43 +11,43 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef GSM_CLASS +#ifdef GRAN_SUB_MOD_CLASS // clang-format off -GSMStyle(none, - GSMDampingNone, +GranSubModStyle(none, + GranSubModDampingNone, DAMPING); -GSMStyle(velocity, - GSMDampingVelocity, +GranSubModStyle(velocity, + GranSubModDampingVelocity, DAMPING); -GSMStyle(mass_velocity, - GSMDampingMassVelocity, +GranSubModStyle(mass_velocity, + GranSubModDampingMassVelocity, DAMPING); -GSMStyle(viscoelastic, - GSMDampingViscoelastic, +GranSubModStyle(viscoelastic, + GranSubModDampingViscoelastic, DAMPING); -GSMStyle(tsuji, - GSMDampingTsuji, +GranSubModStyle(tsuji, + GranSubModDampingTsuji, DAMPING); // clang-format on #else -#ifndef GSM_DAMPING_H_ -#define GSM_DAMPING_H_ +#ifndef GRAN_SUB_MOD_DAMPING_H_ +#define GRAN_SUB_MOD_DAMPING_H_ -#include "gsm.h" +#include "gran_sub_mod.h" #include "pointers.h" namespace LAMMPS_NS { namespace Granular_NS { -class GSMDamping : public GSM { +class GranSubModDamping : public GranSubMod { public: - GSMDamping(class GranularModel *, class LAMMPS *); - ~GSMDamping() {}; + GranSubModDamping(class GranularModel *, class LAMMPS *); + ~GranSubModDamping() {}; virtual void coeffs_to_local() {}; virtual void mix_coeffs(double*, double*) {}; virtual void init(); @@ -59,42 +59,42 @@ class GSMDamping : public GSM { /* ---------------------------------------------------------------------- */ -class GSMDampingNone : public GSMDamping { +class GranSubModDampingNone : public GranSubModDamping { public: - GSMDampingNone(class GranularModel *, class LAMMPS *); + GranSubModDampingNone(class GranularModel *, class LAMMPS *); void init() override {}; double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class GSMDampingVelocity : public GSMDamping { +class GranSubModDampingVelocity : public GranSubModDamping { public: - GSMDampingVelocity(class GranularModel *, class LAMMPS *); + GranSubModDampingVelocity(class GranularModel *, class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class GSMDampingMassVelocity : public GSMDamping { +class GranSubModDampingMassVelocity : public GranSubModDamping { public: - GSMDampingMassVelocity(class GranularModel *, class LAMMPS *); + GranSubModDampingMassVelocity(class GranularModel *, class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class GSMDampingViscoelastic : public GSMDamping { +class GranSubModDampingViscoelastic : public GranSubModDamping { public: - GSMDampingViscoelastic(class GranularModel *, class LAMMPS *); + GranSubModDampingViscoelastic(class GranularModel *, class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class GSMDampingTsuji : public GSMDamping { +class GranSubModDampingTsuji : public GranSubModDamping { public: - GSMDampingTsuji(class GranularModel *, class LAMMPS *); + GranSubModDampingTsuji(class GranularModel *, class LAMMPS *); void init() override; double calculate_forces(); }; @@ -102,5 +102,5 @@ class GSMDampingTsuji : public GSMDamping { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GSM_DAMPING_H_ */ -#endif /*GSM_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_DAMPING_H_ */ +#endif /*GRAN_SUB_MOD_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_heat.cpp b/src/GRANULAR/gran_sub_mod_heat.cpp similarity index 79% rename from src/GRANULAR/gsm_heat.cpp rename to src/GRANULAR/gran_sub_mod_heat.cpp index 1a0cff5301..02a18117ff 100644 --- a/src/GRANULAR/gsm_heat.cpp +++ b/src/GRANULAR/gran_sub_mod_heat.cpp @@ -12,7 +12,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "gsm_heat.h" +#include "gran_sub_mod_heat.h" #include "granular_model.h" #include "error.h" @@ -23,17 +23,17 @@ using namespace Granular_NS; Default heat conduction ------------------------------------------------------------------------- */ -GSMHeat::GSMHeat(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} +GranSubModHeat::GranSubModHeat(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {} /* ---------------------------------------------------------------------- Area-based heat conduction ------------------------------------------------------------------------- */ -GSMHeatNone::GSMHeatNone(GranularModel *gm, LAMMPS *lmp) : GSMHeat(gm, lmp) {} +GranSubModHeatNone::GranSubModHeatNone(GranularModel *gm, LAMMPS *lmp) : GranSubModHeat(gm, lmp) {} /* ---------------------------------------------------------------------- */ -double GSMHeatNone::calculate_heat() +double GranSubModHeatNone::calculate_heat() { return 0.0; } @@ -42,7 +42,7 @@ double GSMHeatNone::calculate_heat() Area-based heat conduction ------------------------------------------------------------------------- */ -GSMHeatArea::GSMHeatArea(GranularModel *gm, LAMMPS *lmp) : GSMHeat(gm, lmp) +GranSubModHeatArea::GranSubModHeatArea(GranularModel *gm, LAMMPS *lmp) : GranSubModHeat(gm, lmp) { num_coeffs = 1; area_flag = 1; @@ -50,7 +50,7 @@ GSMHeatArea::GSMHeatArea(GranularModel *gm, LAMMPS *lmp) : GSMHeat(gm, lmp) /* ---------------------------------------------------------------------- */ -void GSMHeatArea::coeffs_to_local() +void GranSubModHeatArea::coeffs_to_local() { conductivity = coeffs[0]; @@ -59,7 +59,7 @@ void GSMHeatArea::coeffs_to_local() /* ---------------------------------------------------------------------- */ -double GSMHeatArea::calculate_heat() +double GranSubModHeatArea::calculate_heat() { return conductivity * gm->area * (gm->Tj - gm->Ti); } diff --git a/src/GRANULAR/gsm_heat.h b/src/GRANULAR/gran_sub_mod_heat.h similarity index 66% rename from src/GRANULAR/gsm_heat.h rename to src/GRANULAR/gran_sub_mod_heat.h index c913593f19..3520a41a06 100644 --- a/src/GRANULAR/gsm_heat.h +++ b/src/GRANULAR/gran_sub_mod_heat.h @@ -11,30 +11,30 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef GSM_CLASS +#ifdef GRAN_SUB_MOD_CLASS // clang-format off -GSMStyle(none, - GSMHeatNone, +GranSubModStyle(none, + GranSubModHeatNone, HEAT); -GSMStyle(area, - GSMHeatArea, +GranSubModStyle(area, + GranSubModHeatArea, HEAT); // clang-format on #else -#ifndef GSM_HEAT_H_ -#define GSM_HEAT_H_ +#ifndef GRAN_SUB_MOD_HEAT_H_ +#define GRAN_SUB_MOD_HEAT_H_ -#include "gsm.h" +#include "gran_sub_mod.h" namespace LAMMPS_NS { namespace Granular_NS { -class GSMHeat : public GSM { +class GranSubModHeat : public GranSubMod { public: - GSMHeat(class GranularModel *, class LAMMPS *); - ~GSMHeat() {}; + GranSubModHeat(class GranularModel *, class LAMMPS *); + ~GranSubModHeat() {}; virtual void coeffs_to_local() {}; virtual void init() {}; virtual double calculate_heat() = 0; @@ -42,17 +42,17 @@ class GSMHeat : public GSM { /* ---------------------------------------------------------------------- */ -class GSMHeatNone : public GSMHeat { +class GranSubModHeatNone : public GranSubModHeat { public: - GSMHeatNone(class GranularModel *, class LAMMPS *); + GranSubModHeatNone(class GranularModel *, class LAMMPS *); double calculate_heat(); }; /* ---------------------------------------------------------------------- */ -class GSMHeatArea : public GSMHeat { +class GranSubModHeatArea : public GranSubModHeat { public: - GSMHeatArea(class GranularModel *, class LAMMPS *); + GranSubModHeatArea(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; double calculate_heat(); protected: @@ -62,5 +62,5 @@ class GSMHeatArea : public GSMHeat { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GSM_HEAT_H_ */ -#endif /*GSM_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_HEAT_H_ */ +#endif /*GRAN_SUB_MOD_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_normal.cpp b/src/GRANULAR/gran_sub_mod_normal.cpp similarity index 82% rename from src/GRANULAR/gsm_normal.cpp rename to src/GRANULAR/gran_sub_mod_normal.cpp index 28e4d7af79..d10c984a51 100644 --- a/src/GRANULAR/gsm_normal.cpp +++ b/src/GRANULAR/gran_sub_mod_normal.cpp @@ -12,7 +12,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "gsm_normal.h" +#include "gran_sub_mod_normal.h" #include "granular_model.h" #include "error.h" #include "math_const.h" @@ -33,7 +33,7 @@ using namespace MathConst; Default normal model ------------------------------------------------------------------------- */ -GSMNormal::GSMNormal(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) +GranSubModNormal::GranSubModNormal(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) { material_properties = 0; cohesive_flag = 0; @@ -41,7 +41,7 @@ GSMNormal::GSMNormal(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) /* ---------------------------------------------------------------------- */ -bool GSMNormal::touch() +bool GranSubModNormal::touch() { bool touchflag = (gm->rsq < gm->radsum * gm->radsum); return touchflag; @@ -49,7 +49,7 @@ bool GSMNormal::touch() /* ---------------------------------------------------------------------- */ -double GSMNormal::pulloff_distance(double radi, double radj) +double GranSubModNormal::pulloff_distance(double radi, double radj) { //called outside of compute(), do not assume correct geometry defined in contact return radi + radj; @@ -57,14 +57,14 @@ double GSMNormal::pulloff_distance(double radi, double radj) /* ---------------------------------------------------------------------- */ -double GSMNormal::calculate_area() +double GranSubModNormal::calculate_area() { return sqrt(gm->dR); } /* ---------------------------------------------------------------------- */ -void GSMNormal::set_fncrit() +void GranSubModNormal::set_fncrit() { Fncrit = fabs(gm->Fntot); } @@ -73,11 +73,11 @@ void GSMNormal::set_fncrit() No model ------------------------------------------------------------------------- */ -GSMNormalNone::GSMNormalNone(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) {} +GranSubModNormalNone::GranSubModNormalNone(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp) {} /* ---------------------------------------------------------------------- */ -double GSMNormalNone::calculate_forces() +double GranSubModNormalNone::calculate_forces() { return 0.0; } @@ -86,14 +86,14 @@ double GSMNormalNone::calculate_forces() Hookean normal force ------------------------------------------------------------------------- */ -GSMNormalHooke::GSMNormalHooke(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +GranSubModNormalHooke::GranSubModNormalHooke(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp) { num_coeffs = 2; } /* ---------------------------------------------------------------------- */ -void GSMNormalHooke::coeffs_to_local() +void GranSubModNormalHooke::coeffs_to_local() { k = coeffs[0]; damp = coeffs[1]; @@ -103,7 +103,7 @@ void GSMNormalHooke::coeffs_to_local() /* ---------------------------------------------------------------------- */ -double GSMNormalHooke::calculate_forces() +double GranSubModNormalHooke::calculate_forces() { return k * gm->delta; } @@ -112,7 +112,7 @@ double GSMNormalHooke::calculate_forces() Hertzian normal force ------------------------------------------------------------------------- */ -GSMNormalHertz::GSMNormalHertz(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +GranSubModNormalHertz::GranSubModNormalHertz(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp) { num_coeffs = 2; area_flag = 1; @@ -120,7 +120,7 @@ GSMNormalHertz::GSMNormalHertz(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, l /* ---------------------------------------------------------------------- */ -void GSMNormalHertz::coeffs_to_local() +void GranSubModNormalHertz::coeffs_to_local() { k = coeffs[0]; damp = coeffs[1]; @@ -130,7 +130,7 @@ void GSMNormalHertz::coeffs_to_local() /* ---------------------------------------------------------------------- */ -double GSMNormalHertz::calculate_forces() +double GranSubModNormalHertz::calculate_forces() { return k * gm->area * gm->delta; } @@ -139,7 +139,7 @@ double GSMNormalHertz::calculate_forces() Hertzian normal force with material properties ------------------------------------------------------------------------- */ -GSMNormalHertzMaterial::GSMNormalHertzMaterial(GranularModel *gm, LAMMPS *lmp) : GSMNormalHertz(gm, lmp) +GranSubModNormalHertzMaterial::GranSubModNormalHertzMaterial(GranularModel *gm, LAMMPS *lmp) : GranSubModNormalHertz(gm, lmp) { material_properties = 1; num_coeffs = 3; @@ -148,7 +148,7 @@ GSMNormalHertzMaterial::GSMNormalHertzMaterial(GranularModel *gm, LAMMPS *lmp) : /* ---------------------------------------------------------------------- */ -void GSMNormalHertzMaterial::coeffs_to_local() +void GranSubModNormalHertzMaterial::coeffs_to_local() { Emod = coeffs[0]; damp = coeffs[1]; @@ -164,7 +164,7 @@ void GSMNormalHertzMaterial::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) +void GranSubModNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) { coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); @@ -176,7 +176,7 @@ void GSMNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs) DMT normal force ------------------------------------------------------------------------- */ -GSMNormalDMT::GSMNormalDMT(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +GranSubModNormalDMT::GranSubModNormalDMT(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp) { material_properties = 1; cohesive_flag = 1; @@ -186,7 +186,7 @@ GSMNormalDMT::GSMNormalDMT(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) /* ---------------------------------------------------------------------- */ -void GSMNormalDMT::coeffs_to_local() +void GranSubModNormalDMT::coeffs_to_local() { Emod = coeffs[0]; damp = coeffs[1]; @@ -203,7 +203,7 @@ void GSMNormalDMT::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMNormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) +void GranSubModNormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) { coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); @@ -214,7 +214,7 @@ void GSMNormalDMT::mix_coeffs(double* icoeffs, double* jcoeffs) /* ---------------------------------------------------------------------- */ -double GSMNormalDMT::calculate_forces() +double GranSubModNormalDMT::calculate_forces() { Fne = k * gm->area * gm->delta; F_pulloff = 4.0 * MathConst::MY_PI * cohesion * gm->Reff; @@ -224,7 +224,7 @@ double GSMNormalDMT::calculate_forces() /* ---------------------------------------------------------------------- */ -void GSMNormalDMT::set_fncrit() +void GranSubModNormalDMT::set_fncrit() { Fncrit = fabs(Fne + 2.0 * F_pulloff); } @@ -233,7 +233,7 @@ void GSMNormalDMT::set_fncrit() JKR normal force ------------------------------------------------------------------------- */ -GSMNormalJKR::GSMNormalJKR(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) +GranSubModNormalJKR::GranSubModNormalJKR(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp) { material_properties = 1; cohesive_flag = 1; @@ -244,7 +244,7 @@ GSMNormalJKR::GSMNormalJKR(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) /* ---------------------------------------------------------------------- */ -void GSMNormalJKR::coeffs_to_local() +void GranSubModNormalJKR::coeffs_to_local() { Emod = coeffs[0]; damp = coeffs[1]; @@ -264,7 +264,7 @@ void GSMNormalJKR::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMNormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) +void GranSubModNormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) { coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); @@ -275,7 +275,7 @@ void GSMNormalJKR::mix_coeffs(double* icoeffs, double* jcoeffs) /* ---------------------------------------------------------------------- */ -bool GSMNormalJKR::touch() +bool GranSubModNormalJKR::touch() { double area_at_pulloff, R2, delta_pulloff, dist_pulloff; bool touchflag; @@ -297,7 +297,7 @@ bool GSMNormalJKR::touch() called outside of compute(), do not assume geometry defined in contact ------------------------------------------------------------------------- */ -double GSMNormalJKR::pulloff_distance(double radi, double radj) +double GranSubModNormalJKR::pulloff_distance(double radi, double radj) { double area_at_pulloff, Reff_tmp; @@ -310,7 +310,7 @@ double GSMNormalJKR::pulloff_distance(double radi, double radj) /* ---------------------------------------------------------------------- */ -double GSMNormalJKR::calculate_area() +double GranSubModNormalJKR::calculate_area() { double R2, dR2, t0, t1, t2, t3, t4, t5, t6; double sqrt1, sqrt2, sqrt3; @@ -335,7 +335,7 @@ double GSMNormalJKR::calculate_area() /* ---------------------------------------------------------------------- */ -double GSMNormalJKR::calculate_forces() +double GranSubModNormalJKR::calculate_forces() { double a2; a2 = gm->area * gm->area; @@ -347,7 +347,7 @@ double GSMNormalJKR::calculate_forces() /* ---------------------------------------------------------------------- */ -void GSMNormalJKR::set_fncrit() +void GranSubModNormalJKR::set_fncrit() { Fncrit = fabs(Fne + 2.0 * F_pulloff); } diff --git a/src/GRANULAR/gsm_normal.h b/src/GRANULAR/gran_sub_mod_normal.h similarity index 65% rename from src/GRANULAR/gsm_normal.h rename to src/GRANULAR/gran_sub_mod_normal.h index 2d7391f3c8..8fb0c01d4b 100644 --- a/src/GRANULAR/gsm_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -11,46 +11,46 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef GSM_CLASS +#ifdef GRAN_SUB_MOD_CLASS // clang-format off -GSMStyle(none, - GSMNormalNone, +GranSubModStyle(none, + GranSubModNormalNone, NORMAL); -GSMStyle(hooke, - GSMNormalHooke, +GranSubModStyle(hooke, + GranSubModNormalHooke, NORMAL); -GSMStyle(hertz, - GSMNormalHertz, +GranSubModStyle(hertz, + GranSubModNormalHertz, NORMAL); -GSMStyle(hertz/material, - GSMNormalHertzMaterial, +GranSubModStyle(hertz/material, + GranSubModNormalHertzMaterial, NORMAL); -GSMStyle(dmt, - GSMNormalDMT, +GranSubModStyle(dmt, + GranSubModNormalDMT, NORMAL); -GSMStyle(jkr, - GSMNormalJKR, +GranSubModStyle(jkr, + GranSubModNormalJKR, NORMAL); // clang-format on #else -#ifndef GSM_NORMAL_H_ -#define GSM_NORMAL_H_ +#ifndef GRAN_SUB_MOD_NORMAL_H_ +#define GRAN_SUB_MOD_NORMAL_H_ -#include "gsm.h" +#include "gran_sub_mod.h" namespace LAMMPS_NS { namespace Granular_NS { -class GSMNormal : public GSM { +class GranSubModNormal : public GranSubMod { public: - GSMNormal(class GranularModel *, class LAMMPS *); - ~GSMNormal() {}; + GranSubModNormal(class GranularModel *, class LAMMPS *); + ~GranSubModNormal() {}; virtual void coeffs_to_local() {}; virtual void init() {}; virtual bool touch(); @@ -66,17 +66,17 @@ class GSMNormal : public GSM { /* ---------------------------------------------------------------------- */ -class GSMNormalNone : public GSMNormal { +class GranSubModNormalNone : public GranSubModNormal { public: - GSMNormalNone(class GranularModel *, class LAMMPS *); + GranSubModNormalNone(class GranularModel *, class LAMMPS *); double calculate_forces(); }; /* ---------------------------------------------------------------------- */ -class GSMNormalHooke : public GSMNormal { +class GranSubModNormalHooke : public GranSubModNormal { public: - GSMNormalHooke(class GranularModel *, class LAMMPS *); + GranSubModNormalHooke(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; double calculate_forces(); protected: @@ -85,9 +85,9 @@ class GSMNormalHooke : public GSMNormal { /* ---------------------------------------------------------------------- */ -class GSMNormalHertz : public GSMNormal { +class GranSubModNormalHertz : public GranSubModNormal { public: - GSMNormalHertz(class GranularModel *, class LAMMPS *); + GranSubModNormalHertz(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; double calculate_forces(); protected: @@ -96,18 +96,18 @@ class GSMNormalHertz : public GSMNormal { /* ---------------------------------------------------------------------- */ -class GSMNormalHertzMaterial : public GSMNormalHertz { +class GranSubModNormalHertzMaterial : public GranSubModNormalHertz { public: - GSMNormalHertzMaterial(class GranularModel *, class LAMMPS *); + GranSubModNormalHertzMaterial(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; }; /* ---------------------------------------------------------------------- */ -class GSMNormalDMT : public GSMNormal { +class GranSubModNormalDMT : public GranSubModNormal { public: - GSMNormalDMT(class GranularModel *, class LAMMPS *); + GranSubModNormalDMT(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; double calculate_forces(); @@ -119,9 +119,9 @@ class GSMNormalDMT : public GSMNormal { /* ---------------------------------------------------------------------- */ -class GSMNormalJKR : public GSMNormal { +class GranSubModNormalJKR : public GranSubModNormal { public: - GSMNormalJKR(class GranularModel *, class LAMMPS *); + GranSubModNormalJKR(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; bool touch() override; @@ -137,5 +137,5 @@ class GSMNormalJKR : public GSMNormal { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GSM_NORMAL_H_ */ -#endif /*GSM_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_NORMAL_H_ */ +#endif /*GRAN_SUB_MOD_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_rolling.cpp b/src/GRANULAR/gran_sub_mod_rolling.cpp similarity index 87% rename from src/GRANULAR/gsm_rolling.cpp rename to src/GRANULAR/gran_sub_mod_rolling.cpp index ceda262853..c1dc53fcc8 100644 --- a/src/GRANULAR/gsm_rolling.cpp +++ b/src/GRANULAR/gran_sub_mod_rolling.cpp @@ -12,8 +12,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "gsm_normal.h" -#include "gsm_rolling.h" +#include "gran_sub_mod_normal.h" +#include "gran_sub_mod_rolling.h" #include "granular_model.h" #include "error.h" #include "math_const.h" @@ -24,23 +24,25 @@ using namespace Granular_NS; using namespace MathConst; using namespace MathExtra; +#define EPSILON 1e-10 + /* ---------------------------------------------------------------------- Default rolling friction model ------------------------------------------------------------------------- */ -GSMRolling::GSMRolling(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} +GranSubModRolling::GranSubModRolling(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {} /* ---------------------------------------------------------------------- No model ------------------------------------------------------------------------- */ -GSMRollingNone::GSMRollingNone(GranularModel *gm, LAMMPS *lmp) : GSMRolling(gm, lmp) {} +GranSubModRollingNone::GranSubModRollingNone(GranularModel *gm, LAMMPS *lmp) : GranSubModRolling(gm, lmp) {} /* ---------------------------------------------------------------------- SDS rolling friction model ------------------------------------------------------------------------- */ -GSMRollingSDS::GSMRollingSDS(GranularModel *gm, LAMMPS *lmp) : GSMRolling(gm, lmp) +GranSubModRollingSDS::GranSubModRollingSDS(GranularModel *gm, LAMMPS *lmp) : GranSubModRolling(gm, lmp) { num_coeffs = 3; size_history = 3; @@ -48,7 +50,7 @@ GSMRollingSDS::GSMRollingSDS(GranularModel *gm, LAMMPS *lmp) : GSMRolling(gm, lm /* ---------------------------------------------------------------------- */ -void GSMRollingSDS::coeffs_to_local() +void GranSubModRollingSDS::coeffs_to_local() { k = coeffs[0]; gamma = coeffs[1]; @@ -60,7 +62,7 @@ void GSMRollingSDS::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMRollingSDS::calculate_forces() +void GranSubModRollingSDS::calculate_forces() { int rhist0, rhist1, rhist2, frameupdate; double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], scalefac, temp_array[3]; diff --git a/src/GRANULAR/gsm_rolling.h b/src/GRANULAR/gran_sub_mod_rolling.h similarity index 65% rename from src/GRANULAR/gsm_rolling.h rename to src/GRANULAR/gran_sub_mod_rolling.h index 054b22954f..cb64c94219 100644 --- a/src/GRANULAR/gsm_rolling.h +++ b/src/GRANULAR/gran_sub_mod_rolling.h @@ -11,30 +11,30 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef GSM_CLASS +#ifdef GRAN_SUB_MOD_CLASS // clang-format off -GSMStyle(none, - GSMRollingNone, +GranSubModStyle(none, + GranSubModRollingNone, ROLLING); -GSMStyle(sds, - GSMRollingSDS, +GranSubModStyle(sds, + GranSubModRollingSDS, ROLLING); // clang-format on #else -#ifndef GSM_ROLLING_H_ -#define GSM_ROLLING_H_ +#ifndef GRAN_SUB_MOD_ROLLING_H_ +#define GRAN_SUB_MOD_ROLLING_H_ -#include "gsm.h" +#include "gran_sub_mod.h" namespace LAMMPS_NS { namespace Granular_NS { -class GSMRolling : public GSM { +class GranSubModRolling : public GranSubMod { public: - GSMRolling(class GranularModel *, class LAMMPS *); - ~GSMRolling() {}; + GranSubModRolling(class GranularModel *, class LAMMPS *); + ~GranSubModRolling() {}; virtual void coeffs_to_local() {}; virtual void init() {}; virtual void calculate_forces() = 0; @@ -42,17 +42,17 @@ class GSMRolling : public GSM { /* ---------------------------------------------------------------------- */ -class GSMRollingNone : public GSMRolling { +class GranSubModRollingNone : public GranSubModRolling { public: - GSMRollingNone(class GranularModel *, class LAMMPS *); + GranSubModRollingNone(class GranularModel *, class LAMMPS *); void calculate_forces() {}; }; /* ---------------------------------------------------------------------- */ -class GSMRollingSDS : public GSMRolling { +class GranSubModRollingSDS : public GranSubModRolling { public: - GSMRollingSDS(class GranularModel *, class LAMMPS *); + GranSubModRollingSDS(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void calculate_forces(); protected: @@ -62,5 +62,5 @@ class GSMRollingSDS : public GSMRolling { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GSM_ROLLING_H_ */ -#endif /*GSM_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_ROLLING_H_ */ +#endif /*GRAN_SUB_MOD_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_tangential.cpp b/src/GRANULAR/gran_sub_mod_tangential.cpp similarity index 84% rename from src/GRANULAR/gsm_tangential.cpp rename to src/GRANULAR/gran_sub_mod_tangential.cpp index a5dabde8fd..677ba4d363 100644 --- a/src/GRANULAR/gsm_tangential.cpp +++ b/src/GRANULAR/gran_sub_mod_tangential.cpp @@ -12,9 +12,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "gsm_damping.h" -#include "gsm_normal.h" -#include "gsm_tangential.h" +#include "gran_sub_mod_damping.h" +#include "gran_sub_mod_normal.h" +#include "gran_sub_mod_tangential.h" #include "granular_model.h" #include "error.h" #include "math_const.h" @@ -25,23 +25,25 @@ using namespace Granular_NS; using namespace MathConst; using namespace MathExtra; +#define EPSILON 1e-10 + /* ---------------------------------------------------------------------- Default model ------------------------------------------------------------------------- */ -GSMTangential::GSMTangential(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} +GranSubModTangential::GranSubModTangential(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {} /* ---------------------------------------------------------------------- No model ------------------------------------------------------------------------- */ -GSMTangentialNone::GSMTangentialNone(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) {} +GranSubModTangentialNone::GranSubModTangentialNone(GranularModel *gm, LAMMPS *lmp) : GranSubModTangential(gm, lmp) {} /* ---------------------------------------------------------------------- Linear model with no history ------------------------------------------------------------------------- */ -GSMTangentialLinearNoHistory::GSMTangentialLinearNoHistory(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) +GranSubModTangentialLinearNoHistory::GranSubModTangentialLinearNoHistory(GranularModel *gm, LAMMPS *lmp) : GranSubModTangential(gm, lmp) { num_coeffs = 2; size_history = 0; @@ -49,7 +51,7 @@ GSMTangentialLinearNoHistory::GSMTangentialLinearNoHistory(GranularModel *gm, LA /* ---------------------------------------------------------------------- */ -void GSMTangentialLinearNoHistory::coeffs_to_local() +void GranSubModTangentialLinearNoHistory::coeffs_to_local() { k = 0.0; // No tangential stiffness with no history xt = coeffs[0]; @@ -61,7 +63,7 @@ void GSMTangentialLinearNoHistory::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMTangentialLinearNoHistory::calculate_forces() +void GranSubModTangentialLinearNoHistory::calculate_forces() { // classic pair gran/hooke (no history) damp = xt * gm->damping_model->damp_prefactor; @@ -80,7 +82,7 @@ void GSMTangentialLinearNoHistory::calculate_forces() Linear model with history ------------------------------------------------------------------------- */ -GSMTangentialLinearHistory::GSMTangentialLinearHistory(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) +GranSubModTangentialLinearHistory::GranSubModTangentialLinearHistory(GranularModel *gm, LAMMPS *lmp) : GranSubModTangential(gm, lmp) { num_coeffs = 3; size_history = 3; @@ -88,7 +90,7 @@ GSMTangentialLinearHistory::GSMTangentialLinearHistory(GranularModel *gm, LAMMPS /* ---------------------------------------------------------------------- */ -void GSMTangentialLinearHistory::coeffs_to_local() +void GranSubModTangentialLinearHistory::coeffs_to_local() { k = coeffs[0]; xt = coeffs[1]; @@ -100,7 +102,7 @@ void GSMTangentialLinearHistory::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMTangentialLinearHistory::calculate_forces() +void GranSubModTangentialLinearHistory::calculate_forces() { // Note: this is the same as the base Mindlin calculation except k isn't scaled by area double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl, temp_array[3]; @@ -163,14 +165,14 @@ void GSMTangentialLinearHistory::calculate_forces() Linear model with history from pair gran/hooke/history ------------------------------------------------------------------------- */ -GSMTangentialLinearHistoryClassic::GSMTangentialLinearHistoryClassic(GranularModel *gm, LAMMPS *lmp) : GSMTangentialLinearHistory(gm, lmp) +GranSubModTangentialLinearHistoryClassic::GranSubModTangentialLinearHistoryClassic(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialLinearHistory(gm, lmp) { area_flag = 1; // Sets gran/hooke/history behavior } /* ---------------------------------------------------------------------- */ -void GSMTangentialLinearHistoryClassic::calculate_forces() +void GranSubModTangentialLinearHistoryClassic::calculate_forces() { double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; @@ -222,7 +224,7 @@ void GSMTangentialLinearHistoryClassic::calculate_forces() Mindlin from pair gran/hertz/history ------------------------------------------------------------------------- */ -GSMTangentialMindlinClassic::GSMTangentialMindlinClassic(GranularModel *gm, LAMMPS *lmp) : GSMTangentialLinearHistoryClassic(gm, lmp) +GranSubModTangentialMindlinClassic::GranSubModTangentialMindlinClassic(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialLinearHistoryClassic(gm, lmp) { area_flag = 1; // Sets gran/hertz/history behavior } @@ -231,7 +233,7 @@ GSMTangentialMindlinClassic::GSMTangentialMindlinClassic(GranularModel *gm, LAMM Mindlin model ------------------------------------------------------------------------- */ -GSMTangentialMindlin::GSMTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) +GranSubModTangentialMindlin::GranSubModTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GranSubModTangential(gm, lmp) { num_coeffs = 3; size_history = 3; @@ -242,7 +244,7 @@ GSMTangentialMindlin::GSMTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GSM /* ---------------------------------------------------------------------- */ -void GSMTangentialMindlin::coeffs_to_local() +void GranSubModTangentialMindlin::coeffs_to_local() { k = coeffs[0]; xt = coeffs[1]; @@ -268,7 +270,7 @@ void GSMTangentialMindlin::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMTangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) +void GranSubModTangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) { if (icoeffs[0] == -1 || jcoeffs[0] == -1) coeffs[0] = -1; else coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); @@ -279,7 +281,7 @@ void GSMTangentialMindlin::mix_coeffs(double* icoeffs, double* jcoeffs) /* ---------------------------------------------------------------------- */ -void GSMTangentialMindlin::calculate_forces() +void GranSubModTangentialMindlin::calculate_forces() { double k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; double temp_array[3]; @@ -366,7 +368,7 @@ void GSMTangentialMindlin::calculate_forces() Mindlin force model ------------------------------------------------------------------------- */ -GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) +GranSubModTangentialMindlinForce::GranSubModTangentialMindlinForce(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialMindlin(gm, lmp) { mindlin_force = 1; } @@ -375,7 +377,7 @@ GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS * Mindlin rescale model ------------------------------------------------------------------------- */ -GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) +GranSubModTangentialMindlinRescale::GranSubModTangentialMindlinRescale(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialMindlin(gm, lmp) { size_history = 4; mindlin_rescale = 1; @@ -390,7 +392,7 @@ GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMM Mindlin rescale force model ------------------------------------------------------------------------- */ -GSMTangentialMindlinRescaleForce::GSMTangentialMindlinRescaleForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) +GranSubModTangentialMindlinRescaleForce::GranSubModTangentialMindlinRescaleForce(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialMindlin(gm, lmp) { size_history = 4; mindlin_force = 1; diff --git a/src/GRANULAR/gsm_tangential.h b/src/GRANULAR/gran_sub_mod_tangential.h similarity index 50% rename from src/GRANULAR/gsm_tangential.h rename to src/GRANULAR/gran_sub_mod_tangential.h index e755f63304..56d72f80d3 100644 --- a/src/GRANULAR/gsm_tangential.h +++ b/src/GRANULAR/gran_sub_mod_tangential.h @@ -11,58 +11,58 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef GSM_CLASS +#ifdef GRAN_SUB_MOD_CLASS // clang-format off -GSMStyle(none, - GSMTangentialNone, +GranSubModStyle(none, + GranSubModTangentialNone, TANGENTIAL); -GSMStyle(linear_nohistory, - GSMTangentialLinearNoHistory, +GranSubModStyle(linear_nohistory, + GranSubModTangentialLinearNoHistory, TANGENTIAL); -GSMStyle(linear_history, - GSMTangentialLinearHistory, +GranSubModStyle(linear_history, + GranSubModTangentialLinearHistory, TANGENTIAL); -GSMStyle(linear_history_classic, - GSMTangentialLinearHistoryClassic, +GranSubModStyle(linear_history_classic, + GranSubModTangentialLinearHistoryClassic, TANGENTIAL); -GSMStyle(mindlin_classic, - GSMTangentialMindlinClassic, +GranSubModStyle(mindlin_classic, + GranSubModTangentialMindlinClassic, TANGENTIAL); -GSMStyle(mindlin, - GSMTangentialMindlin, +GranSubModStyle(mindlin, + GranSubModTangentialMindlin, TANGENTIAL); -GSMStyle(mindlin/force, - GSMTangentialMindlinForce, +GranSubModStyle(mindlin/force, + GranSubModTangentialMindlinForce, TANGENTIAL); -GSMStyle(mindlin_rescale, - GSMTangentialMindlinRescale, +GranSubModStyle(mindlin_rescale, + GranSubModTangentialMindlinRescale, TANGENTIAL); -GSMStyle(mindlin_rescale/force, - GSMTangentialMindlinRescaleForce, +GranSubModStyle(mindlin_rescale/force, + GranSubModTangentialMindlinRescaleForce, TANGENTIAL); // clang-format on #else -#ifndef GSM_TANGENTIAL_H_ -#define GSM_TANGENTIAL_H_ +#ifndef GRAN_SUB_MOD_TANGENTIAL_H_ +#define GRAN_SUB_MOD_TANGENTIAL_H_ -#include "gsm.h" +#include "gran_sub_mod.h" namespace LAMMPS_NS { namespace Granular_NS { -class GSMTangential : public GSM { +class GranSubModTangential : public GranSubMod { public: - GSMTangential(class GranularModel *, class LAMMPS *); - virtual ~GSMTangential() {}; + GranSubModTangential(class GranularModel *, class LAMMPS *); + virtual ~GranSubModTangential() {}; virtual void coeffs_to_local() {}; virtual void init() {}; virtual void calculate_forces() = 0; @@ -71,17 +71,17 @@ class GSMTangential : public GSM { /* ---------------------------------------------------------------------- */ -class GSMTangentialNone : public GSMTangential { +class GranSubModTangentialNone : public GranSubModTangential { public: - GSMTangentialNone(class GranularModel *, class LAMMPS *); + GranSubModTangentialNone(class GranularModel *, class LAMMPS *); void calculate_forces() {}; }; /* ---------------------------------------------------------------------- */ -class GSMTangentialLinearNoHistory : public GSMTangential { +class GranSubModTangentialLinearNoHistory : public GranSubModTangential { public: - GSMTangentialLinearNoHistory(class GranularModel *, class LAMMPS *); + GranSubModTangentialLinearNoHistory(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void calculate_forces(); protected: @@ -90,9 +90,9 @@ class GSMTangentialLinearNoHistory : public GSMTangential { /* ---------------------------------------------------------------------- */ -class GSMTangentialLinearHistory : public GSMTangential { +class GranSubModTangentialLinearHistory : public GranSubModTangential { public: - GSMTangentialLinearHistory(class GranularModel *, class LAMMPS *); + GranSubModTangentialLinearHistory(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void calculate_forces(); protected: @@ -101,9 +101,9 @@ class GSMTangentialLinearHistory : public GSMTangential { /* ---------------------------------------------------------------------- */ -class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory { +class GranSubModTangentialLinearHistoryClassic : public GranSubModTangentialLinearHistory { public: - GSMTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); + GranSubModTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); void calculate_forces(); protected: double xt; @@ -111,16 +111,16 @@ class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory { /* ---------------------------------------------------------------------- */ -class GSMTangentialMindlinClassic : public GSMTangentialLinearHistoryClassic { +class GranSubModTangentialMindlinClassic : public GranSubModTangentialLinearHistoryClassic { public: - GSMTangentialMindlinClassic(class GranularModel *, class LAMMPS *); + GranSubModTangentialMindlinClassic(class GranularModel *, class LAMMPS *); }; /* ---------------------------------------------------------------------- */ -class GSMTangentialMindlin : public GSMTangential { +class GranSubModTangentialMindlin : public GranSubModTangential { public: - GSMTangentialMindlin(class GranularModel *, class LAMMPS *); + GranSubModTangentialMindlin(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double*, double*) override; void calculate_forces(); @@ -131,27 +131,27 @@ class GSMTangentialMindlin : public GSMTangential { /* ---------------------------------------------------------------------- */ -class GSMTangentialMindlinForce : public GSMTangentialMindlin { +class GranSubModTangentialMindlinForce : public GranSubModTangentialMindlin { public: - GSMTangentialMindlinForce(class GranularModel *, class LAMMPS *); + GranSubModTangentialMindlinForce(class GranularModel *, class LAMMPS *); }; /* ---------------------------------------------------------------------- */ -class GSMTangentialMindlinRescale : public GSMTangentialMindlin { +class GranSubModTangentialMindlinRescale : public GranSubModTangentialMindlin { public: - GSMTangentialMindlinRescale(class GranularModel *, class LAMMPS *); + GranSubModTangentialMindlinRescale(class GranularModel *, class LAMMPS *); }; /* ---------------------------------------------------------------------- */ -class GSMTangentialMindlinRescaleForce : public GSMTangentialMindlin { +class GranSubModTangentialMindlinRescaleForce : public GranSubModTangentialMindlin { public: - GSMTangentialMindlinRescaleForce(class GranularModel *, class LAMMPS *); + GranSubModTangentialMindlinRescaleForce(class GranularModel *, class LAMMPS *); }; } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GSM_TANGENTIAL_H_ */ -#endif /*GSM_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_TANGENTIAL_H_ */ +#endif /*GRAN_SUB_MOD_CLASS_H_ */ diff --git a/src/GRANULAR/gsm_twisting.cpp b/src/GRANULAR/gran_sub_mod_twisting.cpp similarity index 82% rename from src/GRANULAR/gsm_twisting.cpp rename to src/GRANULAR/gran_sub_mod_twisting.cpp index 42609bf632..9cb6d69dc8 100644 --- a/src/GRANULAR/gsm_twisting.cpp +++ b/src/GRANULAR/gran_sub_mod_twisting.cpp @@ -12,9 +12,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "gsm_normal.h" -#include "gsm_tangential.h" -#include "gsm_twisting.h" +#include "gran_sub_mod_normal.h" +#include "gran_sub_mod_tangential.h" +#include "gran_sub_mod_twisting.h" #include "granular_model.h" #include "error.h" #include "math_const.h" @@ -27,19 +27,19 @@ using namespace MathConst; Default twisting model ------------------------------------------------------------------------- */ -GSMTwisting::GSMTwisting(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} +GranSubModTwisting::GranSubModTwisting(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {} /* ---------------------------------------------------------------------- No model ------------------------------------------------------------------------- */ -GSMTwistingNone::GSMTwistingNone(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) {} +GranSubModTwistingNone::GranSubModTwistingNone(GranularModel *gm, LAMMPS *lmp) : GranSubModTwisting(gm, lmp) {} /* ---------------------------------------------------------------------- Marshall twisting model ------------------------------------------------------------------------- */ -GSMTwistingMarshall::GSMTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) +GranSubModTwistingMarshall::GranSubModTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GranSubModTwisting(gm, lmp) { num_coeffs = 0; size_history = 3; @@ -49,7 +49,7 @@ GSMTwistingMarshall::GSMTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GSMTw /* ---------------------------------------------------------------------- */ -void GSMTwistingMarshall::init() +void GranSubModTwistingMarshall::init() { k_tang = gm->tangential_model->k; mu_tang = gm->tangential_model->mu; @@ -57,7 +57,7 @@ void GSMTwistingMarshall::init() /* ---------------------------------------------------------------------- */ -void GSMTwistingMarshall::calculate_forces() +void GranSubModTwistingMarshall::calculate_forces() { double signtwist, Mtcrit; @@ -86,7 +86,7 @@ void GSMTwistingMarshall::calculate_forces() SDS twisting model ------------------------------------------------------------------------- */ -GSMTwistingSDS::GSMTwistingSDS(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) +GranSubModTwistingSDS::GranSubModTwistingSDS(GranularModel *gm, LAMMPS *lmp) : GranSubModTwisting(gm, lmp) { num_coeffs = 3; size_history = 3; @@ -94,7 +94,7 @@ GSMTwistingSDS::GSMTwistingSDS(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, /* ---------------------------------------------------------------------- */ -void GSMTwistingSDS::coeffs_to_local() +void GranSubModTwistingSDS::coeffs_to_local() { k = coeffs[0]; damp = coeffs[1]; @@ -106,7 +106,7 @@ void GSMTwistingSDS::coeffs_to_local() /* ---------------------------------------------------------------------- */ -void GSMTwistingSDS::calculate_forces() +void GranSubModTwistingSDS::calculate_forces() { double signtwist, Mtcrit; diff --git a/src/GRANULAR/gsm_twisting.h b/src/GRANULAR/gran_sub_mod_twisting.h similarity index 62% rename from src/GRANULAR/gsm_twisting.h rename to src/GRANULAR/gran_sub_mod_twisting.h index b9ab7826a6..7f8addec97 100644 --- a/src/GRANULAR/gsm_twisting.h +++ b/src/GRANULAR/gran_sub_mod_twisting.h @@ -11,34 +11,34 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifdef GSM_CLASS +#ifdef GRAN_SUB_MOD_CLASS // clang-format off -GSMStyle(none, - GSMTwistingNone, +GranSubModStyle(none, + GranSubModTwistingNone, TWISTING); -GSMStyle(marshall, - GSMTwistingMarshall, +GranSubModStyle(marshall, + GranSubModTwistingMarshall, TWISTING); -GSMStyle(sds, - GSMTwistingSDS, +GranSubModStyle(sds, + GranSubModTwistingSDS, TWISTING); // clang-format on #else -#ifndef GSM_TWISTING_H_ -#define GSM_TWISTING_H_ +#ifndef GRAN_SUB_MOD_TWISTING_H_ +#define GRAN_SUB_MOD_TWISTING_H_ -#include "gsm.h" +#include "gran_sub_mod.h" namespace LAMMPS_NS { namespace Granular_NS { -class GSMTwisting : public GSM { +class GranSubModTwisting : public GranSubMod { public: - GSMTwisting(class GranularModel *, class LAMMPS *); - virtual ~GSMTwisting() {}; + GranSubModTwisting(class GranularModel *, class LAMMPS *); + virtual ~GranSubModTwisting() {}; virtual void coeffs_to_local() {}; virtual void init() {}; virtual void calculate_forces() = 0; @@ -46,17 +46,17 @@ class GSMTwisting : public GSM { /* ---------------------------------------------------------------------- */ -class GSMTwistingNone : public GSMTwisting { +class GranSubModTwistingNone : public GranSubModTwisting { public: - GSMTwistingNone(class GranularModel *, class LAMMPS *); + GranSubModTwistingNone(class GranularModel *, class LAMMPS *); void calculate_forces() {}; }; /* ---------------------------------------------------------------------- */ -class GSMTwistingMarshall : public GSMTwisting { +class GranSubModTwistingMarshall : public GranSubModTwisting { public: - GSMTwistingMarshall(class GranularModel *, class LAMMPS *); + GranSubModTwistingMarshall(class GranularModel *, class LAMMPS *); void calculate_forces(); void init(); protected: @@ -65,9 +65,9 @@ class GSMTwistingMarshall : public GSMTwisting { /* ---------------------------------------------------------------------- */ -class GSMTwistingSDS : public GSMTwisting { +class GranSubModTwistingSDS : public GranSubModTwisting { public: - GSMTwistingSDS(class GranularModel *, class LAMMPS *); + GranSubModTwistingSDS(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void calculate_forces(); protected: @@ -77,5 +77,5 @@ class GSMTwistingSDS : public GSMTwisting { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GSM_TWISTING_H_ */ -#endif /*GSM_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_TWISTING_H_ */ +#endif /*GRAN_SUB_MOD_CLASS_H_ */ diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index 66e34386ed..872bfa6c8d 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -22,12 +22,12 @@ ----------------------------------------------------------------------- */ #include "granular_model.h" -#include "gsm.h" +#include "gran_sub_mod.h" #include "comm.h" #include "error.h" #include "force.h" #include "math_extra.h" -#include "style_gsm.h" // IWYU pragma: keep +#include "style_gran_sub_mod.h" // IWYU pragma: keep #include @@ -36,10 +36,10 @@ using namespace Granular_NS; using namespace MathExtra; /* ---------------------------------------------------------------------- - one instance per GSM style in style_gsm.h + one instance per GranSubMod style in style_gran_sub_mod.h ------------------------------------------------------------------------- */ -template static GSM *gsm_creator(GranularModel *gm, LAMMPS *lmp) +template static GranSubMod *gran_sub_mod_creator(GranularModel *gm, LAMMPS *lmp) { return new T(gm, lmp); } @@ -64,29 +64,29 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) for (int i = 0; i < NSUBMODELS; i++) sub_models[i] = nullptr; transfer_history_factor = nullptr; - // extract info from GSM classes listed in style_gsm.h + // extract info from GranSubMod classes listed in style_gran_sub_mod.h nclass = 0; -#define GSM_CLASS -#define GSMStyle(key,Class,type) nclass++; -#include "style_gsm.h" // IWYU pragma: keep -#undef GSMStyle -#undef GSM_CLASS +#define GRANSUBMOD_CLASS +#define GranSubModStyle(key,Class,type) nclass++; +#include "style_gran_sub_mod.h" // IWYU pragma: keep +#undef GranSubModStyle +#undef GRANSUBMOD_CLASS - gsmclass = new GSMCreator[nclass]; - gsmnames = new char*[nclass]; - gsmtypes = new int[nclass]; + gran_sub_mod_class = new GranSubModCreator[nclass]; + gran_sub_mod_names = new char*[nclass]; + gran_sub_mod_types = new int[nclass]; nclass = 0; -#define GSM_CLASS -#define GSMStyle(key,Class,type) \ - gsmclass[nclass] = &gsm_creator; \ - gsmnames[nclass] = (char *) #key; \ - gsmtypes[nclass++] = type; -#include "style_gsm.h" // IWYU pragma: keep -#undef GSMStyle -#undef GSM_CLASS +#define GRANSUBMOD_CLASS +#define GranSubModStyle(key,Class,type) \ + gran_sub_mod_class[nclass] = &gran_sub_mod_creator; \ + gran_sub_mod_names[nclass] = (char *) #key; \ + gran_sub_mod_types[nclass++] = type; +#include "style_gran_sub_mod.h" // IWYU pragma: keep +#undef GranSubModStyle +#undef GRANSUBMOD_CLASS } /* ---------------------------------------------------------------------- */ @@ -94,9 +94,9 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) GranularModel::~GranularModel() { delete [] transfer_history_factor; - delete [] gsmclass; - delete [] gsmnames; - delete [] gsmtypes; + delete [] gran_sub_mod_class; + delete [] gran_sub_mod_names; + delete [] gran_sub_mod_types; for (int i = 0; i < NSUBMODELS; i ++) delete sub_models[i]; } @@ -132,11 +132,11 @@ void GranularModel::construct_submodel(std::string model_name, SubmodelType mode { int i; for (i = 0; i < nclass; i++) { - if (gsmtypes[i] == model_type) { - if (strcmp(gsmnames[i], model_name.c_str()) == 0) { - GSMCreator &gsm_creator = gsmclass[i]; + if (gran_sub_mod_types[i] == model_type) { + if (strcmp(gran_sub_mod_names[i], model_name.c_str()) == 0) { + GranSubModCreator &gran_sub_mod_creator = gran_sub_mod_class[i]; delete sub_models[model_type]; - sub_models[model_type] = gsm_creator(this, lmp); + sub_models[model_type] = gran_sub_mod_creator(this, lmp); break; } } @@ -148,12 +148,12 @@ void GranularModel::construct_submodel(std::string model_name, SubmodelType mode sub_models[model_type]->name.assign(model_name); sub_models[model_type]->allocate_coeffs(); - if (model_type == NORMAL) normal_model = dynamic_cast (sub_models[NORMAL]); - if (model_type == DAMPING) damping_model = dynamic_cast (sub_models[DAMPING]); - if (model_type == TANGENTIAL) tangential_model = dynamic_cast (sub_models[TANGENTIAL]); - if (model_type == ROLLING) rolling_model = dynamic_cast (sub_models[ROLLING]); - if (model_type == TWISTING) twisting_model = dynamic_cast (sub_models[TWISTING]); - if (model_type == HEAT) heat_model = dynamic_cast (sub_models[HEAT]); + if (model_type == NORMAL) normal_model = dynamic_cast (sub_models[NORMAL]); + if (model_type == DAMPING) damping_model = dynamic_cast (sub_models[DAMPING]); + if (model_type == TANGENTIAL) tangential_model = dynamic_cast (sub_models[TANGENTIAL]); + if (model_type == ROLLING) rolling_model = dynamic_cast (sub_models[ROLLING]); + if (model_type == TWISTING) twisting_model = dynamic_cast (sub_models[TWISTING]); + if (model_type == HEAT) heat_model = dynamic_cast (sub_models[HEAT]); } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index 3ea3d9e4b3..de4f82c01e 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -19,8 +19,6 @@ namespace LAMMPS_NS { namespace Granular_NS { -#define EPSILON 1e-10 - enum SubmodelType { NORMAL = 0, DAMPING, @@ -38,13 +36,13 @@ enum ContactType { }; // forward declarations -class GSM; -class GSMNormal; -class GSMDamping; -class GSMTangential; -class GSMRolling; -class GSMTwisting; -class GSMHeat; +class GranSubMod; +class GranSubModNormal; +class GranSubModDamping; +class GranSubModTangential; +class GranSubModRolling; +class GranSubModTwisting; +class GranSubModHeat; class GranularModel : protected Pointers { public: @@ -64,13 +62,13 @@ class GranularModel : protected Pointers { void read_restart(FILE *); // Sub models - GSMNormal *normal_model; - GSMDamping *damping_model; - GSMTangential *tangential_model; - GSMRolling *rolling_model; - GSMTwisting *twisting_model; - GSMHeat *heat_model; - GSM *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors + GranSubModNormal *normal_model; + GranSubModDamping *damping_model; + GranSubModTangential *tangential_model; + GranSubModRolling *rolling_model; + GranSubModTwisting *twisting_model; + GranSubModHeat *heat_model; + GranSubMod *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors // Extra options int beyond_contact, limit_damping, history_update; @@ -102,10 +100,10 @@ class GranularModel : protected Pointers { int nclass; - typedef class GSM *(*GSMCreator)(class GranularModel *, class LAMMPS *); - GSMCreator *gsmclass; - char **gsmnames; - int *gsmtypes; + typedef class GranSubMod *(*GranSubModCreator)(class GranularModel *, class LAMMPS *); + GranSubModCreator *gran_sub_mod_class; + char **gran_sub_mod_names; + int *gran_sub_mod_types; }; } // namespace Granular_NS diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index dcac8e32c3..b6c9bba705 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -23,7 +23,7 @@ #include "atom.h" #include "comm.h" #include "granular_model.h" -#include "gsm.h" +#include "gran_sub_mod.h" #include "error.h" #include "fix.h" #include "fix_dummy.h" diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 9ae02a200a..956717d598 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -20,12 +20,15 @@ PairStyle(granular,PairGranular); #ifndef LMP_PAIR_GRANULAR_H #define LMP_PAIR_GRANULAR_H -#include "granular_model.h" #include "pair.h" #include namespace LAMMPS_NS { +namespace Granular_NS { + class GranularModel; +} + class PairGranular : public Pair { public: PairGranular(class LAMMPS *); @@ -73,7 +76,7 @@ class PairGranular : public Pair { // granular models int nmodels, maxmodels; - Granular_NS::GranularModel** models_list; + class Granular_NS::GranularModel** models_list; int **types_indices; // optional user-specified global cutoff, per-type user-specified cutoffs diff --git a/src/Make.sh b/src/Make.sh index da034f8226..8f63adea4a 100755 --- a/src/Make.sh +++ b/src/Make.sh @@ -95,27 +95,27 @@ cmd=$1 if (test $cmd = "style") || (test $cmd = "packages") then - $cmd ANGLE_CLASS angle_ angle force - $cmd ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid - $cmd BODY_CLASS body_ body atom_vec_body - $cmd BOND_CLASS bond_ bond force - $cmd COMMAND_CLASS "" command input - $cmd COMPUTE_CLASS compute_ compute modify - $cmd DIHEDRAL_CLASS dihedral_ dihedral force - $cmd DUMP_CLASS dump_ dump output write_dump - $cmd FIX_CLASS fix_ fix modify - $cmd GSM_CLASS gsm_ gsm granular_model - $cmd IMPROPER_CLASS improper_ improper force - $cmd INTEGRATE_CLASS "" integrate update - $cmd KSPACE_CLASS "" kspace force - $cmd MINIMIZE_CLASS min_ minimize update - $cmd NBIN_CLASS nbin_ nbin neighbor - $cmd NPAIR_CLASS npair_ npair neighbor - $cmd NSTENCIL_CLASS nstencil_ nstencil neighbor - $cmd NTOPO_CLASS ntopo_ ntopo neighbor - $cmd PAIR_CLASS pair_ pair force - $cmd READER_CLASS reader_ reader read_dump - $cmd REGION_CLASS region_ region domain + $cmd ANGLE_CLASS angle_ angle force + $cmd ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid + $cmd BODY_CLASS body_ body atom_vec_body + $cmd BOND_CLASS bond_ bond force + $cmd COMMAND_CLASS "" command input + $cmd COMPUTE_CLASS compute_ compute modify + $cmd DIHEDRAL_CLASS dihedral_ dihedral force + $cmd DUMP_CLASS dump_ dump output write_dump + $cmd FIX_CLASS fix_ fix modify + $cmd GRAN_SUB_MOD_CLASS gran_sub_mod_ gran_sub_mod granular_model + $cmd IMPROPER_CLASS improper_ improper force + $cmd INTEGRATE_CLASS "" integrate update + $cmd KSPACE_CLASS "" kspace force + $cmd MINIMIZE_CLASS min_ minimize update + $cmd NBIN_CLASS nbin_ nbin neighbor + $cmd NPAIR_CLASS npair_ npair neighbor + $cmd NSTENCIL_CLASS nstencil_ nstencil neighbor + $cmd NTOPO_CLASS ntopo_ ntopo neighbor + $cmd PAIR_CLASS pair_ pair force + $cmd READER_CLASS reader_ reader read_dump + $cmd REGION_CLASS region_ region domain # edit Makefile.lib, for creating non-shared lib # called by "make makelib" From d6b5878dce42aa9bf1aac6f82daa92ccd6035e2c Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 10 Nov 2022 16:25:34 -0700 Subject: [PATCH 48/57] Adding/removing underscores --- src/GRANULAR/gran_sub_mod.h | 6 +++--- src/GRANULAR/gran_sub_mod_damping.h | 8 ++++---- src/GRANULAR/gran_sub_mod_heat.h | 8 ++++---- src/GRANULAR/gran_sub_mod_normal.h | 8 ++++---- src/GRANULAR/gran_sub_mod_rolling.h | 8 ++++---- src/GRANULAR/gran_sub_mod_tangential.h | 8 ++++---- src/GRANULAR/gran_sub_mod_twisting.h | 8 ++++---- src/GRANULAR/granular_model.cpp | 8 ++++---- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/GRANULAR/gran_sub_mod.h b/src/GRANULAR/gran_sub_mod.h index 78f4229b29..b2335e8cfb 100644 --- a/src/GRANULAR/gran_sub_mod.h +++ b/src/GRANULAR/gran_sub_mod.h @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef LMP_GRAN_SUB_MOD_H_ -#define LMP_GRAN_SUB_MOD_H_ +#ifndef LMP_GRAN_SUB_MOD_H +#define LMP_GRAN_SUB_MOD_H #include "granular_model.h" #include "pointers.h" // IWYU pragma: export @@ -59,4 +59,4 @@ class GranSubMod : protected Pointers { } // namespace GranularModel } // namespace LAMMPS_NS -#endif /* GRAN_SUB_MOD_H_ */ +#endif /* GRAN_SUB_MOD_H */ diff --git a/src/GRANULAR/gran_sub_mod_damping.h b/src/GRANULAR/gran_sub_mod_damping.h index 04316a950d..e5f4227ce8 100644 --- a/src/GRANULAR/gran_sub_mod_damping.h +++ b/src/GRANULAR/gran_sub_mod_damping.h @@ -35,8 +35,8 @@ GranSubModStyle(tsuji, // clang-format on #else -#ifndef GRAN_SUB_MOD_DAMPING_H_ -#define GRAN_SUB_MOD_DAMPING_H_ +#ifndef GRAN_SUB_MOD_DAMPING_H +#define GRAN_SUB_MOD_DAMPING_H #include "gran_sub_mod.h" #include "pointers.h" @@ -102,5 +102,5 @@ class GranSubModDampingTsuji : public GranSubModDamping { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GRAN_SUB_MOD_DAMPING_H_ */ -#endif /*GRAN_SUB_MOD_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_DAMPING_H */ +#endif /*GRAN_SUB_MOD_CLASS_H */ diff --git a/src/GRANULAR/gran_sub_mod_heat.h b/src/GRANULAR/gran_sub_mod_heat.h index 3520a41a06..a5408a0fc2 100644 --- a/src/GRANULAR/gran_sub_mod_heat.h +++ b/src/GRANULAR/gran_sub_mod_heat.h @@ -23,8 +23,8 @@ GranSubModStyle(area, // clang-format on #else -#ifndef GRAN_SUB_MOD_HEAT_H_ -#define GRAN_SUB_MOD_HEAT_H_ +#ifndef GRAN_SUB_MOD_HEAT_H +#define GRAN_SUB_MOD_HEAT_H #include "gran_sub_mod.h" @@ -62,5 +62,5 @@ class GranSubModHeatArea : public GranSubModHeat { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GRAN_SUB_MOD_HEAT_H_ */ -#endif /*GRAN_SUB_MOD_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_HEAT_H */ +#endif /*GRAN_SUB_MOD_CLASS_H */ diff --git a/src/GRANULAR/gran_sub_mod_normal.h b/src/GRANULAR/gran_sub_mod_normal.h index 8fb0c01d4b..49e7d012c4 100644 --- a/src/GRANULAR/gran_sub_mod_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -39,8 +39,8 @@ GranSubModStyle(jkr, // clang-format on #else -#ifndef GRAN_SUB_MOD_NORMAL_H_ -#define GRAN_SUB_MOD_NORMAL_H_ +#ifndef GRAN_SUB_MOD_NORMAL_H +#define GRAN_SUB_MOD_NORMAL_H #include "gran_sub_mod.h" @@ -137,5 +137,5 @@ class GranSubModNormalJKR : public GranSubModNormal { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GRAN_SUB_MOD_NORMAL_H_ */ -#endif /*GRAN_SUB_MOD_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_NORMAL_H */ +#endif /*GRAN_SUB_MOD_CLASS_H */ diff --git a/src/GRANULAR/gran_sub_mod_rolling.h b/src/GRANULAR/gran_sub_mod_rolling.h index cb64c94219..5739067f50 100644 --- a/src/GRANULAR/gran_sub_mod_rolling.h +++ b/src/GRANULAR/gran_sub_mod_rolling.h @@ -23,8 +23,8 @@ GranSubModStyle(sds, // clang-format on #else -#ifndef GRAN_SUB_MOD_ROLLING_H_ -#define GRAN_SUB_MOD_ROLLING_H_ +#ifndef GRAN_SUB_MOD_ROLLING_H +#define GRAN_SUB_MOD_ROLLING_H #include "gran_sub_mod.h" @@ -62,5 +62,5 @@ class GranSubModRollingSDS : public GranSubModRolling { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GRAN_SUB_MOD_ROLLING_H_ */ -#endif /*GRAN_SUB_MOD_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_ROLLING_H */ +#endif /*GRAN_SUB_MOD_CLASS_H */ diff --git a/src/GRANULAR/gran_sub_mod_tangential.h b/src/GRANULAR/gran_sub_mod_tangential.h index 56d72f80d3..b5a195a1d6 100644 --- a/src/GRANULAR/gran_sub_mod_tangential.h +++ b/src/GRANULAR/gran_sub_mod_tangential.h @@ -51,8 +51,8 @@ GranSubModStyle(mindlin_rescale/force, // clang-format on #else -#ifndef GRAN_SUB_MOD_TANGENTIAL_H_ -#define GRAN_SUB_MOD_TANGENTIAL_H_ +#ifndef GRAN_SUB_MOD_TANGENTIAL_H +#define GRAN_SUB_MOD_TANGENTIAL_H #include "gran_sub_mod.h" @@ -153,5 +153,5 @@ class GranSubModTangentialMindlinRescaleForce : public GranSubModTangentialMindl } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GRAN_SUB_MOD_TANGENTIAL_H_ */ -#endif /*GRAN_SUB_MOD_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_TANGENTIAL_H */ +#endif /*GRAN_SUB_MOD_CLASS_H */ diff --git a/src/GRANULAR/gran_sub_mod_twisting.h b/src/GRANULAR/gran_sub_mod_twisting.h index 7f8addec97..c365cba331 100644 --- a/src/GRANULAR/gran_sub_mod_twisting.h +++ b/src/GRANULAR/gran_sub_mod_twisting.h @@ -27,8 +27,8 @@ GranSubModStyle(sds, // clang-format on #else -#ifndef GRAN_SUB_MOD_TWISTING_H_ -#define GRAN_SUB_MOD_TWISTING_H_ +#ifndef GRAN_SUB_MOD_TWISTING_H +#define GRAN_SUB_MOD_TWISTING_H #include "gran_sub_mod.h" @@ -77,5 +77,5 @@ class GranSubModTwistingSDS : public GranSubModTwisting { } // namespace Granular_NS } // namespace LAMMPS_NS -#endif /*GRAN_SUB_MOD_TWISTING_H_ */ -#endif /*GRAN_SUB_MOD_CLASS_H_ */ +#endif /*GRAN_SUB_MOD_TWISTING_H */ +#endif /*GRAN_SUB_MOD_CLASS_H */ diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index 872bfa6c8d..47d84b2495 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -68,25 +68,25 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp) nclass = 0; -#define GRANSUBMOD_CLASS +#define GRAN_SUB_MOD_CLASS #define GranSubModStyle(key,Class,type) nclass++; #include "style_gran_sub_mod.h" // IWYU pragma: keep #undef GranSubModStyle -#undef GRANSUBMOD_CLASS +#undef GRAN_SUB_MOD_CLASS gran_sub_mod_class = new GranSubModCreator[nclass]; gran_sub_mod_names = new char*[nclass]; gran_sub_mod_types = new int[nclass]; nclass = 0; -#define GRANSUBMOD_CLASS +#define GRAN_SUB_MOD_CLASS #define GranSubModStyle(key,Class,type) \ gran_sub_mod_class[nclass] = &gran_sub_mod_creator; \ gran_sub_mod_names[nclass] = (char *) #key; \ gran_sub_mod_types[nclass++] = type; #include "style_gran_sub_mod.h" // IWYU pragma: keep #undef GranSubModStyle -#undef GRANSUBMOD_CLASS +#undef GRAN_SUB_MOD_CLASS } /* ---------------------------------------------------------------------- */ From b2c5c1fda41966987064d6f19543ba2c416f7e6a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Thu, 10 Nov 2022 21:06:47 -0700 Subject: [PATCH 49/57] Fixing cmake style header --- cmake/Modules/StyleHeaderUtils.cmake | 84 ++++++++++++++-------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/cmake/Modules/StyleHeaderUtils.cmake b/cmake/Modules/StyleHeaderUtils.cmake index d95e265c4a..2ce7c44d87 100644 --- a/cmake/Modules/StyleHeaderUtils.cmake +++ b/cmake/Modules/StyleHeaderUtils.cmake @@ -119,52 +119,52 @@ function(RegisterStyles search_path) endfunction(RegisterStyles) function(RegisterStylesExt search_path extension sources) - FindStyleHeadersExt(${search_path} ANGLE_CLASS ${extension} ANGLE ${sources}) - FindStyleHeadersExt(${search_path} ATOM_CLASS ${extension} ATOM_VEC ${sources}) - FindStyleHeadersExt(${search_path} BODY_CLASS ${extension} BODY ${sources}) - FindStyleHeadersExt(${search_path} BOND_CLASS ${extension} BOND ${sources}) - FindStyleHeadersExt(${search_path} COMMAND_CLASS ${extension} COMMAND ${sources}) - FindStyleHeadersExt(${search_path} COMPUTE_CLASS ${extension} COMPUTE ${sources}) - FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources}) - FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources}) - FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources}) - FindStyleHeadersExt(${search_path} GSM_CLASS ${extension} GSM ${sources}) - FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources}) - FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources}) - FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources}) - FindStyleHeadersExt(${search_path} MINIMIZE_CLASS ${extension} MINIMIZE ${sources}) - FindStyleHeadersExt(${search_path} NBIN_CLASS ${extension} NBIN ${sources}) - FindStyleHeadersExt(${search_path} NPAIR_CLASS ${extension} NPAIR ${sources}) - FindStyleHeadersExt(${search_path} NSTENCIL_CLASS ${extension} NSTENCIL ${sources}) - FindStyleHeadersExt(${search_path} NTOPO_CLASS ${extension} NTOPO ${sources}) - FindStyleHeadersExt(${search_path} PAIR_CLASS ${extension} PAIR ${sources}) - FindStyleHeadersExt(${search_path} READER_CLASS ${extension} READER ${sources}) - FindStyleHeadersExt(${search_path} REGION_CLASS ${extension} REGION ${sources}) + FindStyleHeadersExt(${search_path} ANGLE_CLASS ${extension} ANGLE ${sources}) + FindStyleHeadersExt(${search_path} ATOM_CLASS ${extension} ATOM_VEC ${sources}) + FindStyleHeadersExt(${search_path} BODY_CLASS ${extension} BODY ${sources}) + FindStyleHeadersExt(${search_path} BOND_CLASS ${extension} BOND ${sources}) + FindStyleHeadersExt(${search_path} COMMAND_CLASS ${extension} COMMAND ${sources}) + FindStyleHeadersExt(${search_path} COMPUTE_CLASS ${extension} COMPUTE ${sources}) + FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources}) + FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources}) + FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources}) + FindStyleHeadersExt(${search_path} GRAN_SUB_MOD_CLASS ${extension} GRAN_SUB_MOD ${sources}) + FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources}) + FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources}) + FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources}) + FindStyleHeadersExt(${search_path} MINIMIZE_CLASS ${extension} MINIMIZE ${sources}) + FindStyleHeadersExt(${search_path} NBIN_CLASS ${extension} NBIN ${sources}) + FindStyleHeadersExt(${search_path} NPAIR_CLASS ${extension} NPAIR ${sources}) + FindStyleHeadersExt(${search_path} NSTENCIL_CLASS ${extension} NSTENCIL ${sources}) + FindStyleHeadersExt(${search_path} NTOPO_CLASS ${extension} NTOPO ${sources}) + FindStyleHeadersExt(${search_path} PAIR_CLASS ${extension} PAIR ${sources}) + FindStyleHeadersExt(${search_path} READER_CLASS ${extension} READER ${sources}) + FindStyleHeadersExt(${search_path} REGION_CLASS ${extension} REGION ${sources}) endfunction(RegisterStylesExt) function(GenerateStyleHeaders output_path) message(STATUS "Generating style headers...") - GenerateStyleHeader(${output_path} ANGLE angle ) # force - GenerateStyleHeader(${output_path} ATOM_VEC atom ) # atom atom_vec_hybrid - GenerateStyleHeader(${output_path} BODY body ) # atom_vec_body - GenerateStyleHeader(${output_path} BOND bond ) # force - GenerateStyleHeader(${output_path} COMMAND command ) # input - GenerateStyleHeader(${output_path} COMPUTE compute ) # modify - GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force - GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump - GenerateStyleHeader(${output_path} FIX fix ) # modify - GenerateStyleHeader(${output_path} GSM gsm ) # granular_model - GenerateStyleHeader(${output_path} IMPROPER improper ) # force - GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update - GenerateStyleHeader(${output_path} KSPACE kspace ) # force - GenerateStyleHeader(${output_path} MINIMIZE minimize ) # update - GenerateStyleHeader(${output_path} NBIN nbin ) # neighbor - GenerateStyleHeader(${output_path} NPAIR npair ) # neighbor - GenerateStyleHeader(${output_path} NSTENCIL nstencil ) # neighbor - GenerateStyleHeader(${output_path} NTOPO ntopo ) # neighbor - GenerateStyleHeader(${output_path} PAIR pair ) # force - GenerateStyleHeader(${output_path} READER reader ) # read_dump - GenerateStyleHeader(${output_path} REGION region ) # domain + GenerateStyleHeader(${output_path} ANGLE angle ) # force + GenerateStyleHeader(${output_path} ATOM_VEC atom ) # atom atom_vec_hybrid + GenerateStyleHeader(${output_path} BODY body ) # atom_vec_body + GenerateStyleHeader(${output_path} BOND bond ) # force + GenerateStyleHeader(${output_path} COMMAND command ) # input + GenerateStyleHeader(${output_path} COMPUTE compute ) # modify + GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force + GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump + GenerateStyleHeader(${output_path} FIX fix ) # modify + GenerateStyleHeader(${output_path} GRAN_SUB_MOD gran_sub_mod ) # granular_model + GenerateStyleHeader(${output_path} IMPROPER improper ) # force + GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update + GenerateStyleHeader(${output_path} KSPACE kspace ) # force + GenerateStyleHeader(${output_path} MINIMIZE minimize ) # update + GenerateStyleHeader(${output_path} NBIN nbin ) # neighbor + GenerateStyleHeader(${output_path} NPAIR npair ) # neighbor + GenerateStyleHeader(${output_path} NSTENCIL nstencil ) # neighbor + GenerateStyleHeader(${output_path} NTOPO ntopo ) # neighbor + GenerateStyleHeader(${output_path} PAIR pair ) # force + GenerateStyleHeader(${output_path} READER reader ) # read_dump + GenerateStyleHeader(${output_path} REGION region ) # domain endfunction(GenerateStyleHeaders) function(DetectBuildSystemConflict lammps_src_dir) From 5f0fff58ac133135821103a8a6559fd17aac8cf1 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 14 Nov 2022 21:16:03 -0700 Subject: [PATCH 50/57] fixing broken doc references --- doc/src/Commands_fix.rst | 2 +- doc/src/Howto_granular.rst | 4 ++-- doc/src/fix.rst | 2 +- doc/src/pair_granular.rst | 5 +++-- src/GRANULAR/granular_model.cpp | 1 - 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index ec8174a370..604280c73c 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -91,6 +91,7 @@ OPT. * :doc:`grem ` * :doc:`halt ` * :doc:`heat ` + * :doc:`heat/flow/sphere/temp ` * :doc:`hyper/global ` * :doc:`hyper/local ` * :doc:`imd ` @@ -235,7 +236,6 @@ OPT. * :doc:`temp/berendsen ` * :doc:`temp/csld ` * :doc:`temp/csvr ` - * :doc:`temp/integrate ` * :doc:`temp/rescale ` * :doc:`temp/rescale/eff ` * :doc:`tfmc ` diff --git a/doc/src/Howto_granular.rst b/doc/src/Howto_granular.rst index af52904204..6a2346746b 100644 --- a/doc/src/Howto_granular.rst +++ b/doc/src/Howto_granular.rst @@ -46,7 +46,7 @@ atoms, and should be used for granular system instead of the fix style To model heat conduction, one must use the atom style: * :doc:`atom_style sphere/temp ` a temperature integration fix -* :doc:`fix temp/integrate ` +* :doc:`fix heat/flow/sphere/temp ` and a heat conduction option defined in both * :doc:`pair_style granular ` * :doc:`fix wall/gran ` @@ -65,4 +65,4 @@ computations between frozen atoms by using this command: doc page, where 2d simulations are discussed. To add custom granular contact models, see the -:doc:`modifying granular submodels page `. +:doc:`modifying granular sub-models page `. diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 461cfc1465..b87a151061 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -238,6 +238,7 @@ accelerated styles exist. * :doc:`grem ` - implements the generalized replica exchange method * :doc:`halt ` - terminate a dynamics run or minimization * :doc:`heat ` - add/subtract momentum-conserving heat +* :doc:`heat/flow/sphere/temp ` - plain time integration of heat flow with per-atom temperature updates * :doc:`hyper/global ` - global hyperdynamics * :doc:`hyper/local ` - local hyperdynamics * :doc:`imd ` - implements the "Interactive MD" (IMD) protocol @@ -382,7 +383,6 @@ accelerated styles exist. * :doc:`temp/berendsen ` - temperature control by Berendsen thermostat * :doc:`temp/csld ` - canonical sampling thermostat with Langevin dynamics * :doc:`temp/csvr ` - canonical sampling thermostat with Hamiltonian dynamics -* :doc:`temp/integrate ` - plain time integration with per-atom temperature updates * :doc:`temp/rescale ` - temperature control by velocity rescaling * :doc:`temp/rescale/eff ` - temperature control by velocity rescaling in the electron force field model * :doc:`tfmc ` - perform force-bias Monte Carlo with time-stamped method diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index cb044252da..491061b5fb 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -659,8 +659,9 @@ where :math:`\Delta T` is the difference in the two particles' temperature, :math:`a` is the area of the contact and depends on the normal force model. Note that the option *none* must either be used in all or none of of the -*pair_coeff* calls. See :doc:`fix temp/integrate ` for -more information on this option. +*pair_coeff* calls. See +:doc:`fix heat/flow/sphere/temp ` for more +information on this option. ---------- diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index 47d84b2495..5d89e22d03 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -409,7 +409,6 @@ void GranularModel::calculate_forces() vrel = len3(vtr); // calculate forces/torques - forces[0] = 0.0; double Fdamp, dist_to_contact; if (area_flag) area = normal_model->calculate_area(); From f51ab2c4401c9fe6e01e7b3cb72bf97bacb4b200 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 16 Nov 2022 16:36:22 -0700 Subject: [PATCH 51/57] Restarting limit_damping, other minor simplifications/cleanups --- examples/granular/in.pour.drum | 2 +- src/GRANULAR/fix_wall_gran.cpp | 32 ++++++++--------- src/GRANULAR/fix_wall_gran.h | 3 +- src/GRANULAR/fix_wall_gran_region.cpp | 2 +- src/GRANULAR/gran_sub_mod.h | 4 +-- src/GRANULAR/gran_sub_mod_damping.cpp | 2 +- src/GRANULAR/gran_sub_mod_damping.h | 2 -- src/GRANULAR/gran_sub_mod_heat.h | 2 -- src/GRANULAR/gran_sub_mod_normal.h | 4 +-- src/GRANULAR/gran_sub_mod_rolling.h | 2 -- src/GRANULAR/gran_sub_mod_tangential.h | 4 --- src/GRANULAR/gran_sub_mod_twisting.h | 4 +-- src/GRANULAR/granular_model.cpp | 44 ++++++++++++----------- src/GRANULAR/granular_model.h | 8 ++--- src/GRANULAR/pair_granular.cpp | 50 +++++++++++--------------- 15 files changed, 72 insertions(+), 93 deletions(-) diff --git a/examples/granular/in.pour.drum b/examples/granular/in.pour.drum index e0a0455f61..6c93b700d6 100644 --- a/examples/granular/in.pour.drum +++ b/examples/granular/in.pour.drum @@ -44,7 +44,7 @@ change_box all boundary p p f pair_style granular pair_coeff 1 * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji -pair_coeff 2 2 jkr 1e5 0.1 0.3 50 tangential mindlin NULL 1.0 0.5 rolling sds 1e3 1e3 0.1 twisting marshall damping tsuji +pair_coeff 2 2 jkr 1e5 0.1 0.3 50 tangential mindlin NULL 1.0 0.5 rolling sds 1e3 1e3 0.1 twisting marshall variable theta equal 0 diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index fe2286a0fa..3afb0dc60e 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -67,11 +67,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : model = new GranularModel(lmp); model->contact_type = WALL; - if (strcmp(arg[3],"granular") == 0) classic_flag = 0; - else classic_flag = 1; - limit_damping = 0; heat_flag = 0; - int Twall_defined = 0; + int classic_flag = 1; + if (strcmp(arg[3],"granular") == 0) classic_flag = 0; // wall/particle coefficients @@ -117,10 +115,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } } - // Define default damping model if unspecified, takes no args + // Define default damping submodel if unspecified, takes no args if (!model->damping_model) model->construct_submodel("viscoelastic", DAMPING); - model->init(); size_history = model->size_history; @@ -177,6 +174,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wiggle = 0; wshear = 0; peratom_flag = 0; + int Twall_defined = 0; while (iarg < narg) { if (strcmp(arg[iarg],"wiggle") == 0) { @@ -216,7 +214,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } if (heat_flag != Twall_defined) - error->all(FLERR, "To model conduction, must define both heat model and wall temperature"); + error->all(FLERR, "Must define wall temperature with heat model"); if (wallstyle == NOSTYLE) error->all(FLERR,"No wall style defined"); @@ -376,6 +374,7 @@ void FixWallGran::post_force(int /*vflag*/) history_update = 1; if (update->setupflag) history_update = 0; + model->history_update = history_update; // if just reneighbored: // update rigid body masses for owned atoms if using FixRigid @@ -407,10 +406,10 @@ void FixWallGran::post_force(int /*vflag*/) if (wiggle) { double arg = omega * (update->ntimestep - time_origin) * dt; if (wallstyle == axis) { - wlo = lo + amplitude - amplitude*cos(arg); - whi = hi + amplitude - amplitude*cos(arg); + wlo = lo + amplitude - amplitude * cos(arg); + whi = hi + amplitude - amplitude * cos(arg); } - vwall[axis] = amplitude*omega*sin(arg); + vwall[axis] = amplitude * omega * sin(arg); } else if (wshear) vwall[axis] = vshear; // loop over all my atoms @@ -473,19 +472,19 @@ void FixWallGran::post_force(int /*vflag*/) if (del1 < del2) dz = del1; else dz = -del2; } else if (wallstyle == ZCYLINDER) { - delxy = sqrt(x[i][0]*x[i][0] + x[i][1]*x[i][1]); + delxy = sqrt(x[i][0] * x[i][0] + x[i][1] * x[i][1]); delr = cylradius - delxy; if (delr > radius[i]) { dz = cylradius; rwall = 0.0; } else { - dx = -delr/delxy * x[i][0]; - dy = -delr/delxy * x[i][1]; + dx = -delr / delxy * x[i][0]; + dy = -delr / delxy * x[i][1]; // rwall = -2r_c if inside cylinder, 2r_c outside - rwall = (delxy < cylradius) ? -2*cylradius : 2*cylradius; + rwall = (delxy < cylradius) ? -2 * cylradius : 2 * cylradius; if (wshear && axis != 2) { - vwall[0] += vshear * x[i][1]/delxy; - vwall[1] += -vshear * x[i][0]/delxy; + vwall[0] += vshear * x[i][1] / delxy; + vwall[1] += -vshear * x[i][0] / delxy; vwall[2] = 0.0; } } @@ -521,7 +520,6 @@ void FixWallGran::post_force(int /*vflag*/) model->meff = meff; model->vi = v[i]; model->omegai = omega[i]; - model->history_update = history_update; if (use_history) model->history = history_one[i]; if (heat_flag) model->Ti = temperature[i]; diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 16a2fe5dc0..45e4e43844 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -53,7 +53,7 @@ class FixWallGran : public Fix { protected: int wallstyle, wiggle, wshear, axis; - int classic_flag, nlevels_respa; + int nlevels_respa; bigint time_origin; // for granular model choices @@ -69,7 +69,6 @@ class FixWallGran : public Fix { int history_update; // flag for whether shear history is updated int size_history; // # of shear history values per contact int heat_flag; - int limit_damping; int tvar; char *tstr; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 7ee794133c..f7b772cb7f 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -135,6 +135,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) history_update = 1; if (update->setupflag) history_update = 0; + model->history_update = history_update; // if just reneighbored: // update rigid body masses for owned atoms if using FixRigid @@ -262,7 +263,6 @@ void FixWallGranRegion::post_force(int /*vflag*/) model->meff = meff; model->vi = v[i]; model->omegai = omega[i]; - model->history_update = history_update; if (use_history) model->history = history_many[i][c2r[ic]]; if (heat_flag) model->Ti = temperature[i]; diff --git a/src/GRANULAR/gran_sub_mod.h b/src/GRANULAR/gran_sub_mod.h index b2335e8cfb..22f1f4e85a 100644 --- a/src/GRANULAR/gran_sub_mod.h +++ b/src/GRANULAR/gran_sub_mod.h @@ -29,8 +29,8 @@ class GranSubMod : protected Pointers { double *coeffs; void read_restart(); virtual void mix_coeffs(double*, double*); - virtual void coeffs_to_local() = 0; - virtual void init() = 0; // called after all submodel coeffs defined + virtual void coeffs_to_local() {}; + virtual void init() {}; // called after all submodels + coeffs defined void allocate_coeffs(); std::string name; diff --git a/src/GRANULAR/gran_sub_mod_damping.cpp b/src/GRANULAR/gran_sub_mod_damping.cpp index e78233735a..820d552679 100644 --- a/src/GRANULAR/gran_sub_mod_damping.cpp +++ b/src/GRANULAR/gran_sub_mod_damping.cpp @@ -108,7 +108,7 @@ void GranSubModDampingTsuji::init() { double tmp = gm->normal_model->damp; damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); - damp += -22.348 * cube(tmp)+ 27.467 * powint(tmp, 4); + damp += -22.348 * cube(tmp) + 27.467 * powint(tmp, 4); damp += -18.022 * powint(tmp, 5) + 4.8218 * powint(tmp,6); } diff --git a/src/GRANULAR/gran_sub_mod_damping.h b/src/GRANULAR/gran_sub_mod_damping.h index e5f4227ce8..5d245c384d 100644 --- a/src/GRANULAR/gran_sub_mod_damping.h +++ b/src/GRANULAR/gran_sub_mod_damping.h @@ -48,8 +48,6 @@ class GranSubModDamping : public GranSubMod { public: GranSubModDamping(class GranularModel *, class LAMMPS *); ~GranSubModDamping() {}; - virtual void coeffs_to_local() {}; - virtual void mix_coeffs(double*, double*) {}; virtual void init(); virtual double calculate_forces() = 0; double damp_prefactor; // Used by tangential models diff --git a/src/GRANULAR/gran_sub_mod_heat.h b/src/GRANULAR/gran_sub_mod_heat.h index a5408a0fc2..ca7e82313a 100644 --- a/src/GRANULAR/gran_sub_mod_heat.h +++ b/src/GRANULAR/gran_sub_mod_heat.h @@ -35,8 +35,6 @@ class GranSubModHeat : public GranSubMod { public: GranSubModHeat(class GranularModel *, class LAMMPS *); ~GranSubModHeat() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; virtual double calculate_heat() = 0; }; diff --git a/src/GRANULAR/gran_sub_mod_normal.h b/src/GRANULAR/gran_sub_mod_normal.h index 49e7d012c4..7dd9f82349 100644 --- a/src/GRANULAR/gran_sub_mod_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -51,8 +51,6 @@ class GranSubModNormal : public GranSubMod { public: GranSubModNormal(class GranularModel *, class LAMMPS *); ~GranSubModNormal() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; virtual bool touch(); virtual double pulloff_distance(double, double); virtual double calculate_area(); @@ -60,7 +58,7 @@ class GranSubModNormal : public GranSubMod { virtual void set_fncrit(); double damp; // argument historically needed by damping double Emod, poiss; - double Fncrit, knfac; + double Fncrit; int material_properties, cohesive_flag; }; diff --git a/src/GRANULAR/gran_sub_mod_rolling.h b/src/GRANULAR/gran_sub_mod_rolling.h index 5739067f50..980daeca89 100644 --- a/src/GRANULAR/gran_sub_mod_rolling.h +++ b/src/GRANULAR/gran_sub_mod_rolling.h @@ -35,8 +35,6 @@ class GranSubModRolling : public GranSubMod { public: GranSubModRolling(class GranularModel *, class LAMMPS *); ~GranSubModRolling() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; virtual void calculate_forces() = 0; }; diff --git a/src/GRANULAR/gran_sub_mod_tangential.h b/src/GRANULAR/gran_sub_mod_tangential.h index b5a195a1d6..27588d49ba 100644 --- a/src/GRANULAR/gran_sub_mod_tangential.h +++ b/src/GRANULAR/gran_sub_mod_tangential.h @@ -63,8 +63,6 @@ class GranSubModTangential : public GranSubMod { public: GranSubModTangential(class GranularModel *, class LAMMPS *); virtual ~GranSubModTangential() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; virtual void calculate_forces() = 0; double k, damp, mu; // Used by Marshall twisting model }; @@ -105,8 +103,6 @@ class GranSubModTangentialLinearHistoryClassic : public GranSubModTangentialLine public: GranSubModTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); void calculate_forces(); - protected: - double xt; }; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/gran_sub_mod_twisting.h b/src/GRANULAR/gran_sub_mod_twisting.h index c365cba331..46f56d37ce 100644 --- a/src/GRANULAR/gran_sub_mod_twisting.h +++ b/src/GRANULAR/gran_sub_mod_twisting.h @@ -39,8 +39,6 @@ class GranSubModTwisting : public GranSubMod { public: GranSubModTwisting(class GranularModel *, class LAMMPS *); virtual ~GranSubModTwisting() {}; - virtual void coeffs_to_local() {}; - virtual void init() {}; virtual void calculate_forces() = 0; }; @@ -57,8 +55,8 @@ class GranSubModTwistingNone : public GranSubModTwisting { class GranSubModTwistingMarshall : public GranSubModTwisting { public: GranSubModTwistingMarshall(class GranularModel *, class LAMMPS *); + void init() override; void calculate_forces(); - void init(); protected: double k_tang, mu_tang; }; diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index 5d89e22d03..afb3328d70 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -148,12 +148,13 @@ void GranularModel::construct_submodel(std::string model_name, SubmodelType mode sub_models[model_type]->name.assign(model_name); sub_models[model_type]->allocate_coeffs(); - if (model_type == NORMAL) normal_model = dynamic_cast (sub_models[NORMAL]); - if (model_type == DAMPING) damping_model = dynamic_cast (sub_models[DAMPING]); - if (model_type == TANGENTIAL) tangential_model = dynamic_cast (sub_models[TANGENTIAL]); - if (model_type == ROLLING) rolling_model = dynamic_cast (sub_models[ROLLING]); - if (model_type == TWISTING) twisting_model = dynamic_cast (sub_models[TWISTING]); - if (model_type == HEAT) heat_model = dynamic_cast (sub_models[HEAT]); + // Assign specific submodel pointer + if (model_type == NORMAL) normal_model = dynamic_cast (sub_models[model_type]); + if (model_type == DAMPING) damping_model = dynamic_cast (sub_models[model_type]); + if (model_type == TANGENTIAL) tangential_model = dynamic_cast (sub_models[model_type]); + if (model_type == ROLLING) rolling_model = dynamic_cast (sub_models[model_type]); + if (model_type == TWISTING) twisting_model = dynamic_cast (sub_models[model_type]); + if (model_type == HEAT) heat_model = dynamic_cast (sub_models[model_type]); } /* ---------------------------------------------------------------------- */ @@ -248,7 +249,8 @@ void GranularModel::init() beyond_contact = 1; size_history += sub_models[i]->size_history; if (!sub_models[i]->allow_cohesion && normal_model->cohesive_flag) - error->all(FLERR,"Cannot use {} model with a cohesive normal model, {}", sub_models[i]->name, normal_model->name); + error->all(FLERR,"Cannot use {} model with a cohesive normal model, {}", + sub_models[i]->name, normal_model->name); if (sub_models[i]->area_flag) area_flag = 1; } @@ -260,14 +262,14 @@ void GranularModel::init() int j; for (int i = 0; i < size_history; i++) { - // Find which model owns this history value + // Find which submodel owns this history value size_cumulative = 0; for (j = 0; j < NSUBMODELS; j++) { if ((size_cumulative + sub_models[j]->size_history) > i) break; size_cumulative += sub_models[j]->size_history; } - // Check if model has nondefault transfers, if so copy its array + // Check if submodel has nondefault transfers, if so copy its array transfer_history_factor[i] = -1; if (j != NSUBMODELS) { if (sub_models[j]->nondefault_history_transfer) { @@ -284,8 +286,7 @@ void GranularModel::init() int GranularModel::mix_coeffs(GranularModel *g1, GranularModel *g2) { - int i; - for (i = 0; i < NSUBMODELS; i++) { + for (int i = 0; i < NSUBMODELS; i++) { if (g1->sub_models[i]->name != g2->sub_models[i]->name) return i; construct_submodel(g1->sub_models[i]->name, (SubmodelType) i); @@ -311,6 +312,8 @@ void GranularModel::write_restart(FILE *fp) fwrite(&num_coeffs, sizeof(int), 1, fp); fwrite(sub_models[i]->coeffs, sizeof(double), num_coeffs, fp); } + + fwrite(&limit_damping, sizeof(int), 1, fp); } /* ---------------------------------------------------------------------- */ @@ -328,22 +331,23 @@ void GranularModel::read_restart(FILE *fp) if (comm->me == 0) utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); - construct_submodel(model_name, (SubmodelType) i); - if (comm->me == 0) { + if (comm->me == 0) utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); - if (num_coeff != sub_models[i]->num_coeffs) - error->one(FLERR, "Invalid granular model written to restart file"); - } MPI_Bcast(&num_coeff, 1, MPI_INT, 0, world); + if (num_coeff != sub_models[i]->num_coeffs) + error->all(FLERR, "Invalid granular model written to restart file"); - if (comm->me == 0) { + if (comm->me == 0) utils::sfread(FLERR, sub_models[i]->coeffs, sizeof(double), num_coeff, fp, nullptr, error); - } MPI_Bcast(sub_models[i]->coeffs, num_coeff, MPI_DOUBLE, 0, world); sub_models[i]->coeffs_to_local(); } + + if (comm->me == 0) + utils::sfread(FLERR, &limit_damping, sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&limit_damping, 1, MPI_INT, 0, world); } /* ---------------------------------------------------------------------- */ @@ -393,7 +397,7 @@ void GranularModel::calculate_forces() sub3(vi, vj, vr); // normal component - vnnr = dot3(vr, nx); //v_R . n + vnnr = dot3(vr, nx); scale3(vnnr, nx, vn); // tangential component @@ -433,7 +437,7 @@ void GranularModel::calculate_forces() if (contact_type == PAIR) { copy3(torquesi, torquesj); - // Classic pair styles wouldn't scale, but classic option is only used by walls + // Classic pair styles don't scale, but classic option is currently only used by walls dist_to_contact = radi - 0.5 * delta; scale3(dist_to_contact, torquesi); dist_to_contact = radj - 0.5 * delta; diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index de4f82c01e..a047bc27e5 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -68,7 +68,7 @@ class GranularModel : protected Pointers { GranSubModRolling *rolling_model; GranSubModTwisting *twisting_model; GranSubModHeat *heat_model; - GranSubMod *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors + GranSubMod *sub_models[NSUBMODELS]; // Extra options int beyond_contact, limit_damping, history_update; @@ -94,9 +94,9 @@ class GranularModel : protected Pointers { bool touch; protected: - int rolling_defined, twisting_defined, heat_defined; // Used to quickly skip undefined submodels - int classic_model; - int area_flag; + int rolling_defined, twisting_defined, heat_defined; // Flag optional submodels + int classic_model; // Flag original pair/gran calculations + int area_flag; // Flag whether area is needed int nclass; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index b6c9bba705..47bfa89da0 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -57,8 +57,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) svector = new double[single_extra]; neighprev = 0; - nmodels = 0; - maxmodels = 0; nmax = 0; mass_rigid = nullptr; @@ -302,6 +300,7 @@ void PairGranular::allocate() maxmodels = n * n + 1; // should never need any more space models_list = (GranularModel **) memory->smalloc(maxmodels * sizeof(GranularModel *), "pair:models_list"); for (int i = 0; i < maxmodels; i++) models_list[i] = nullptr; + nmodels = 0; onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -339,7 +338,6 @@ void PairGranular::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - // Construct new model models_list[nmodels] = new GranularModel(lmp); class GranularModel* model = models_list[nmodels]; @@ -374,9 +372,10 @@ void PairGranular::coeff(int narg, char **arg) } else error->all(FLERR, "Illegal pair_coeff command {}", arg[iarg]); } - // Define default damping model if unspecified, has no coeffs + // Define default damping submodel if unspecified, has no coeffs if (!model->damping_model) model->construct_submodel("viscoelastic", DAMPING); + model->init(); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -388,7 +387,7 @@ void PairGranular::coeff(int narg, char **arg) } } - // If there are > ntype^2 models, delete unused ones + // If there are > ntype^2 models, delete unused models if (nmodels == maxmodels) prune_models(); if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); @@ -419,7 +418,6 @@ void PairGranular::init_style() int size_max[NSUBMODELS] = {0}; for (int n = 0; n < nmodels; n++) { model = models_list[n]; - model->init(); if (model->beyond_contact) { beyond_contact = 1; @@ -559,7 +557,6 @@ double PairGranular::init_one(int i, int j) model1->sub_models[error_code]->name, model2->sub_models[error_code]->name); - // Initialize new model, init_one() occurs after init_style model->init(); for (int k = 0; k < NSUBMODELS; k++) @@ -657,8 +654,10 @@ void PairGranular::read_restart(FILE *fp) MPI_Bcast(&nmodels,1,MPI_INT,0,world); for (i = 0; i < nmodels; i++) { + delete models_list[i]; models_list[i] = new GranularModel(lmp); models_list[i]->read_restart(fp); + models_list[i]->init(); } for (i = 1; i <= atom->ntypes; i++) { @@ -690,28 +689,22 @@ double PairGranular::single(int i, int j, int itype, int jtype, double rsq, double /* factor_coul */, double factor_lj, double &fforce) { - if (factor_lj == 0) { fforce = 0.0; for (int m = 0; m < single_extra; m++) svector[m] = 0.0; return 0.0; } - int jnum; - int *jlist; - double *history,*allhistory; - int nall = atom->nlocal + atom->nghost; if ((i >= nall) || (j >= nall)) error->all(FLERR,"Not enough atoms for pair granular single function"); - int touchflag; - double **x = atom->x; - double *radius = atom->radius; - class GranularModel* model = models_list[types_indices[itype][jtype]]; // Reset model and copy initial geometric data + double **x = atom->x; + double *radius = atom->radius; + model->xi = x[i]; model->xj = x[j]; model->radi = radius[i]; @@ -719,8 +712,9 @@ double PairGranular::single(int i, int j, int itype, int jtype, model->history_update = 0; // Don't update history // If history is needed - jnum = list->numneigh[i]; - jlist = list->firstneigh[i]; + double *history,*allhistory; + int jnum = list->numneigh[i]; + int *jlist = list->firstneigh[i]; if (use_history) { if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) error->one(FLERR,"Pair granular single computation needs history"); @@ -730,11 +724,11 @@ double PairGranular::single(int i, int j, int itype, int jtype, if (neighprev >= jnum) neighprev = 0; if (jlist[neighprev] == j) break; } - history = &allhistory[size_history*neighprev]; + history = &allhistory[size_history * neighprev]; model->touch = fix_history->firstflag[i][neighprev]; } - touchflag = model->check_contact(); + int touchflag = model->check_contact(); if (!touchflag) { fforce = 0.0; @@ -745,17 +739,16 @@ double PairGranular::single(int i, int j, int itype, int jtype, // meff = effective mass of pair of particles // if I or J part of rigid body, use body mass // if I or J is frozen, meff is other particle - double mi, mj, meff; double *rmass = atom->rmass; int *mask = atom->mask; - mi = rmass[i]; - mj = rmass[j]; + double mi = rmass[i]; + double mj = rmass[j]; if (fix_rigid) { if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; } - meff = mi * mj / (mi + mj); + double meff = mi * mj / (mi + mj); if (mask[i] & freeze_group_bit) meff = mj; if (mask[j] & freeze_group_bit) meff = mi; @@ -770,11 +763,10 @@ double PairGranular::single(int i, int j, int itype, int jtype, model->omegaj = omega[j]; model->history = history; - double *forces, *torquesi, *torquesj; model->calculate_forces(); - forces = model->forces; - torquesi = model->torquesi; - torquesj = model->torquesj; + double *forces = model->forces; + double *torquesi = model->torquesi; + double *torquesj = model->torquesj; // apply forces & torques fforce = MathExtra::len3(forces); @@ -843,7 +835,7 @@ void PairGranular::transfer_history(double* source, double* target, int itype, i class GranularModel* model = models_list[types_indices[itype][jtype]]; if (model->nondefault_history_transfer) { for (int i = 0; i < size_history; i++) { - target[i] = model->transfer_history_factor[i] * source [i]; + target[i] = model->transfer_history_factor[i] * source[i]; } } else { for (int i = 0; i < size_history; i++) { From 1a467233fb1920f19d7caffcefa255d2d2e3688a Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 29 Nov 2022 12:24:43 -0700 Subject: [PATCH 52/57] adding examples, fixing wall algebra, updating labels --- src/GRANULAR/fix_wall_gran.cpp | 16 ++++++------ src/GRANULAR/gran_sub_mod.cpp | 24 +++++++++--------- src/GRANULAR/gran_sub_mod.h | 8 +++--- src/GRANULAR/granular_model.cpp | 44 ++++++++++++++++----------------- src/GRANULAR/granular_model.h | 8 +++--- src/GRANULAR/pair_granular.cpp | 22 ++++++++--------- 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 3afb0dc60e..7029074fe8 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -86,19 +86,19 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } else { iarg = 4; - iarg = model->add_submodel(arg, iarg, narg, NORMAL); + iarg = model->add_sub_model(arg, iarg, narg, NORMAL); while (iarg < narg) { if (strcmp(arg[iarg], "damping") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, DAMPING); + iarg = model->add_sub_model(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "tangential") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, TANGENTIAL); + iarg = model->add_sub_model(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, ROLLING); + iarg = model->add_sub_model(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, TWISTING); + iarg = model->add_sub_model(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, HEAT); + iarg = model->add_sub_model(arg, iarg + 1, narg, HEAT); heat_flag = 1; } else if (strcmp(arg[iarg], "xplane") == 0 || strcmp(arg[iarg], "yplane") == 0 || @@ -115,9 +115,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } } - // Define default damping submodel if unspecified, takes no args + // Define default damping sub model if unspecified, takes no args if (!model->damping_model) - model->construct_submodel("viscoelastic", DAMPING); + model->construct_sub_model("viscoelastic", DAMPING); model->init(); size_history = model->size_history; diff --git a/src/GRANULAR/gran_sub_mod.cpp b/src/GRANULAR/gran_sub_mod.cpp index 2d836151f8..5650f4f45a 100644 --- a/src/GRANULAR/gran_sub_mod.cpp +++ b/src/GRANULAR/gran_sub_mod.cpp @@ -13,7 +13,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - This class contains a framework for granular submodels (GranSubMod): + This class contains a framework for granular sub models (GranSubMod): normal, damping, tangential, rolling, twisting, and heat These are used to calculate forces/torques/etc based on contact geometry @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; using namespace Granular_NS; /* ---------------------------------------------------------------------- - Parent class for all types of granular submodels + Parent class for all types of granular sub models ------------------------------------------------------------------------- */ GranSubMod::GranSubMod(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp) @@ -79,10 +79,10 @@ void GranSubMod::mix_coeffs(double* icoeffs, double* jcoeffs) ------------------------------------------------------------------------- */ double GranSubMod::mix_stiffnessE(double E1, double E2, - double pois1, double pois2) + double poiss1, double poiss2) { - double factor1 = (1 - pois1 * pois1) / E1; - double factor2 = (1 - pois2 * pois2) / E2; + double factor1 = (1 - poiss1 * poiss1) / E1; + double factor2 = (1 - poiss2 * poiss2) / E2; return 1 / (factor1 + factor2); } @@ -91,10 +91,10 @@ double GranSubMod::mix_stiffnessE(double E1, double E2, ------------------------------------------------------------------------ */ double GranSubMod::mix_stiffnessG(double E1, double E2, - double pois1, double pois2) + double poiss1, double poiss2) { - double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; - double factor2 = 2 * (2 - pois2) * (1 + pois2) / E2; + double factor1 = 2 * (2 - poiss1) * (1 + poiss1) / E1; + double factor2 = 2 * (2 - poiss2) * (1 + poiss2) / E2; return 1 / (factor1 + factor2); } @@ -102,9 +102,9 @@ double GranSubMod::mix_stiffnessG(double E1, double E2, mixing of Young's modulus (E) for walls ------------------------------------------------------------------------- */ -double GranSubMod::mix_stiffnessE_wall(double E, double pois) +double GranSubMod::mix_stiffnessE_wall(double E, double poiss) { - double factor = 2 * (1 - pois); + double factor = 2 * (1 - poiss * poiss); return E / factor; } @@ -112,9 +112,9 @@ double GranSubMod::mix_stiffnessE_wall(double E, double pois) mixing of shear modulus (G) for walls ------------------------------------------------------------------------ */ -double GranSubMod::mix_stiffnessG_wall(double E, double pois) +double GranSubMod::mix_stiffnessG_wall(double E, double poiss) { - double factor = 32.0 * (2 - pois) * (1 + pois); + double factor = 4.0 * (2 - poiss) * (1 + poiss); return E / factor; } diff --git a/src/GRANULAR/gran_sub_mod.h b/src/GRANULAR/gran_sub_mod.h index 22f1f4e85a..a8bc430857 100644 --- a/src/GRANULAR/gran_sub_mod.h +++ b/src/GRANULAR/gran_sub_mod.h @@ -30,7 +30,7 @@ class GranSubMod : protected Pointers { void read_restart(); virtual void mix_coeffs(double*, double*); virtual void coeffs_to_local() {}; - virtual void init() {}; // called after all submodels + coeffs defined + virtual void init() {}; // called after all sub models + coeffs defined void allocate_coeffs(); std::string name; @@ -40,9 +40,9 @@ class GranSubMod : protected Pointers { double *transfer_history_factor; int history_index; - int beyond_contact; // If the submodel contact extends beyond overlap - int allow_cohesion; // If the submodel works with a cohesive normal force - int area_flag; // If the submodel requires area + int beyond_contact; // If the sub model contact extends beyond overlap + int allow_cohesion; // If the sub model works with a cohesive normal force + int area_flag; // If the sub model requires area GranularModel *gm; diff --git a/src/GRANULAR/granular_model.cpp b/src/GRANULAR/granular_model.cpp index afb3328d70..6b5ba1bedf 100644 --- a/src/GRANULAR/granular_model.cpp +++ b/src/GRANULAR/granular_model.cpp @@ -103,13 +103,13 @@ GranularModel::~GranularModel() /* ---------------------------------------------------------------------- */ -int GranularModel::add_submodel(char **arg, int iarg, int narg, SubmodelType model_type) +int GranularModel::add_sub_model(char **arg, int iarg, int narg, SubModelType model_type) { if (iarg >= narg) - error->all(FLERR, "Must specify granular submodel name"); + error->all(FLERR, "Must specify granular sub model name"); std::string model_name = std::string(arg[iarg++]); - construct_submodel(model_name, model_type); + construct_sub_model(model_name, model_type); int num_coeffs = sub_models[model_type]->num_coeffs; if (iarg + num_coeffs > narg) @@ -128,7 +128,7 @@ int GranularModel::add_submodel(char **arg, int iarg, int narg, SubmodelType mod /* ---------------------------------------------------------------------- */ -void GranularModel::construct_submodel(std::string model_name, SubmodelType model_type) +void GranularModel::construct_sub_model(std::string model_name, SubModelType model_type) { int i; for (i = 0; i < nclass; i++) { @@ -148,7 +148,7 @@ void GranularModel::construct_submodel(std::string model_name, SubmodelType mode sub_models[model_type]->name.assign(model_name); sub_models[model_type]->allocate_coeffs(); - // Assign specific submodel pointer + // Assign specific sub model pointer if (model_type == NORMAL) normal_model = dynamic_cast (sub_models[model_type]); if (model_type == DAMPING) damping_model = dynamic_cast (sub_models[model_type]); if (model_type == TANGENTIAL) tangential_model = dynamic_cast (sub_models[model_type]); @@ -185,26 +185,26 @@ int GranularModel::define_classic_model(char **arg, int iarg, int narg) error->all(FLERR,"Illegal classic gran model command"); if (strcmp(arg[iarg],"hooke") == 0) { - construct_submodel("hooke", NORMAL); - construct_submodel("linear_nohistory", TANGENTIAL); - construct_submodel("mass_velocity", DAMPING); + construct_sub_model("hooke", NORMAL); + construct_sub_model("linear_nohistory", TANGENTIAL); + construct_sub_model("mass_velocity", DAMPING); } else if (strcmp(arg[iarg],"hooke/history") == 0) { - construct_submodel("hooke", NORMAL); - construct_submodel("linear_history_classic", TANGENTIAL); - construct_submodel("mass_velocity", DAMPING); + construct_sub_model("hooke", NORMAL); + construct_sub_model("linear_history_classic", TANGENTIAL); + construct_sub_model("mass_velocity", DAMPING); } else if (strcmp(arg[iarg],"hertz/history") == 0) { // convert Kn and Kt from pressure units to force/distance^2 if Hertzian kn /= force->nktv2p; kt /= force->nktv2p; - construct_submodel("hertz", NORMAL); - construct_submodel("mindlin_classic", TANGENTIAL); - construct_submodel("viscoelastic", DAMPING); + construct_sub_model("hertz", NORMAL); + construct_sub_model("mindlin_classic", TANGENTIAL); + construct_sub_model("viscoelastic", DAMPING); } else error->all(FLERR,"Invalid classic gran model"); // ensure additional models are undefined - construct_submodel("none", ROLLING); - construct_submodel("none", TWISTING); - construct_submodel("none", HEAT); + construct_sub_model("none", ROLLING); + construct_sub_model("none", TWISTING); + construct_sub_model("none", HEAT); // manually parse coeffs normal_model->coeffs[0] = kn; @@ -226,7 +226,7 @@ int GranularModel::define_classic_model(char **arg, int iarg, int narg) void GranularModel::init() { for (int i = 0; i < NSUBMODELS; i++) - if (!sub_models[i]) construct_submodel("none", (SubmodelType) i); + if (!sub_models[i]) construct_sub_model("none", (SubModelType) i); // Must have valid normal, damping, and tangential models if (normal_model->name == "none") error->all(FLERR, "Must specify normal granular model"); @@ -262,14 +262,14 @@ void GranularModel::init() int j; for (int i = 0; i < size_history; i++) { - // Find which submodel owns this history value + // Find which sub model owns this history value size_cumulative = 0; for (j = 0; j < NSUBMODELS; j++) { if ((size_cumulative + sub_models[j]->size_history) > i) break; size_cumulative += sub_models[j]->size_history; } - // Check if submodel has nondefault transfers, if so copy its array + // Check if sub model has nondefault transfers, if so copy its array transfer_history_factor[i] = -1; if (j != NSUBMODELS) { if (sub_models[j]->nondefault_history_transfer) { @@ -289,7 +289,7 @@ int GranularModel::mix_coeffs(GranularModel *g1, GranularModel *g2) for (int i = 0; i < NSUBMODELS; i++) { if (g1->sub_models[i]->name != g2->sub_models[i]->name) return i; - construct_submodel(g1->sub_models[i]->name, (SubmodelType) i); + construct_sub_model(g1->sub_models[i]->name, (SubModelType) i); sub_models[i]->mix_coeffs(g1->sub_models[i]->coeffs, g2->sub_models[i]->coeffs); } @@ -331,7 +331,7 @@ void GranularModel::read_restart(FILE *fp) if (comm->me == 0) utils::sfread(FLERR, const_cast(model_name.data()), sizeof(char),num_char, fp, nullptr, error); MPI_Bcast(const_cast(model_name.data()), num_char, MPI_CHAR, 0, world); - construct_submodel(model_name, (SubmodelType) i); + construct_sub_model(model_name, (SubModelType) i); if (comm->me == 0) utils::sfread(FLERR, &num_coeff, sizeof(int), 1, fp, nullptr, error); diff --git a/src/GRANULAR/granular_model.h b/src/GRANULAR/granular_model.h index a047bc27e5..62b3007b0e 100644 --- a/src/GRANULAR/granular_model.h +++ b/src/GRANULAR/granular_model.h @@ -19,7 +19,7 @@ namespace LAMMPS_NS { namespace Granular_NS { -enum SubmodelType { +enum SubModelType { NORMAL = 0, DAMPING, TANGENTIAL, @@ -53,9 +53,9 @@ class GranularModel : protected Pointers { void calculate_forces(); double pulloff_distance(double, double); - int add_submodel(char **, int, int, SubmodelType); + int add_sub_model(char **, int, int, SubModelType); int define_classic_model(char **, int, int); - void construct_submodel(std::string, SubmodelType); + void construct_sub_model(std::string, SubModelType); int mix_coeffs(GranularModel*, GranularModel*); void write_restart(FILE *); @@ -94,7 +94,7 @@ class GranularModel : protected Pointers { bool touch; protected: - int rolling_defined, twisting_defined, heat_defined; // Flag optional submodels + int rolling_defined, twisting_defined, heat_defined; // Flag optional sub models int classic_model; // Flag original pair/gran calculations int area_flag; // Flag whether area is needed diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 47bfa89da0..21278d2891 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -345,21 +345,21 @@ void PairGranular::coeff(int narg, char **arg) //Parse mandatory specification int iarg = 2; - iarg = model->add_submodel(arg, iarg, narg, NORMAL); + iarg = model->add_sub_model(arg, iarg, narg, NORMAL); //Parse optional arguments while (iarg < narg) { if (strcmp(arg[iarg], "tangential") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, TANGENTIAL); + iarg = model->add_sub_model(arg, iarg + 1, narg, TANGENTIAL); } else if (strcmp(arg[iarg], "damping") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, DAMPING); + iarg = model->add_sub_model(arg, iarg + 1, narg, DAMPING); } else if (strcmp(arg[iarg], "rolling") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, ROLLING); + iarg = model->add_sub_model(arg, iarg + 1, narg, ROLLING); } else if (strcmp(arg[iarg], "twisting") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, TWISTING); + iarg = model->add_sub_model(arg, iarg + 1, narg, TWISTING); } else if (strcmp(arg[iarg], "heat") == 0) { - iarg = model->add_submodel(arg, iarg + 1, narg, HEAT); + iarg = model->add_sub_model(arg, iarg + 1, narg, HEAT); heat_flag = 1; } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) @@ -372,9 +372,9 @@ void PairGranular::coeff(int narg, char **arg) } else error->all(FLERR, "Illegal pair_coeff command {}", arg[iarg]); } - // Define default damping submodel if unspecified, has no coeffs + // Define default damping sub model if unspecified, has no coeffs if (!model->damping_model) - model->construct_submodel("viscoelastic", DAMPING); + model->construct_sub_model("viscoelastic", DAMPING); model->init(); int count = 0; @@ -551,7 +551,7 @@ double PairGranular::init_one(int i, int j) if (error_code != -1) error->all(FLERR,"Granular pair style functional forms are different, " "cannot mix coefficients for types {} and {} \n" - "with submodels {} and {}. \n" + "with sub models {} and {}. \n" "This combination must be set explicitly via a " "pair_coeff command",i,j, model1->sub_models[error_code]->name, @@ -834,11 +834,11 @@ void PairGranular::transfer_history(double* source, double* target, int itype, i { class GranularModel* model = models_list[types_indices[itype][jtype]]; if (model->nondefault_history_transfer) { - for (int i = 0; i < size_history; i++) { + for (int i = 0; i < model->size_history; i++) { target[i] = model->transfer_history_factor[i] * source[i]; } } else { - for (int i = 0; i < size_history; i++) { + for (int i = 0; i < model->size_history; i++) { target[i] = -source[i]; } } From e8c271cc1608d050088b01de3ae73df0da67db93 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 26 Nov 2022 15:29:32 -0500 Subject: [PATCH 53/57] update python to version to 3.11 and disable png/jpeg for now --- .github/workflows/compile-msvc.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 3ec5fc4cb0..d756e9fa82 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -26,7 +26,7 @@ jobs: - name: Select Python version uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Building LAMMPS via CMake shell: bash @@ -35,6 +35,8 @@ jobs: python3 -m pip install pyyaml cmake -C cmake/presets/windows.cmake \ -D PKG_PYTHON=on \ + -D WITH_PNG=off \ + -D WITH_JPEG=off \ -S cmake -B build \ -D BUILD_SHARED_LIBS=on \ -D LAMMPS_EXCEPTIONS=on \ From f2d866420a51e66e88dab9ceac688c22892428f5 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 7 Dec 2022 11:41:53 -0700 Subject: [PATCH 54/57] Updated examples --- .../log.15Sep22.granregion.box.g++.1 | 493 +++++++ .../log.15Sep22.granregion.box.g++.4 | 493 +++++++ .../log.15Sep22.granregion.funnel.g++.1 | 633 +++++++++ .../log.15Sep22.granregion.funnel.g++.4 | 633 +++++++++ .../log.15Sep22.granregion.mixer.g++.1 | 632 +++++++++ .../log.15Sep22.granregion.mixer.g++.4 | 632 +++++++++ .../log.27Nov18.granregion.box.g++.1 | 475 ------- .../log.27Nov18.granregion.box.g++.4 | 475 ------- .../log.27Nov18.granregion.funnel.g++.1 | 601 --------- .../log.27Nov18.granregion.funnel.g++.4 | 601 --------- .../log.27Nov18.granregion.mixer.g++.1 | 602 --------- .../log.27Nov18.granregion.mixer.g++.4 | 602 --------- examples/granular/in.pour.heat | 2 +- examples/granular/log.15Sep22.pour.drum.g++.1 | 272 ++++ examples/granular/log.15Sep22.pour.drum.g++.4 | 272 ++++ .../granular/log.15Sep22.pour.flatwall.g++.1 | 195 +++ .../granular/log.15Sep22.pour.flatwall.g++.4 | 195 +++ examples/granular/log.15Sep22.pour.heat.g++.1 | 1172 +++++++++++++++++ examples/granular/log.15Sep22.pour.heat.g++.4 | 1172 +++++++++++++++++ examples/granular/log.29Oct20.pour.drum.g++.1 | 271 ---- examples/granular/log.29Oct20.pour.drum.g++.4 | 271 ---- .../granular/log.29Oct20.pour.flatwall.g++.1 | 188 --- .../granular/log.29Oct20.pour.flatwall.g++.4 | 188 --- 23 files changed, 6795 insertions(+), 4275 deletions(-) create mode 100644 examples/granregion/log.15Sep22.granregion.box.g++.1 create mode 100644 examples/granregion/log.15Sep22.granregion.box.g++.4 create mode 100644 examples/granregion/log.15Sep22.granregion.funnel.g++.1 create mode 100644 examples/granregion/log.15Sep22.granregion.funnel.g++.4 create mode 100644 examples/granregion/log.15Sep22.granregion.mixer.g++.1 create mode 100644 examples/granregion/log.15Sep22.granregion.mixer.g++.4 delete mode 100644 examples/granregion/log.27Nov18.granregion.box.g++.1 delete mode 100644 examples/granregion/log.27Nov18.granregion.box.g++.4 delete mode 100644 examples/granregion/log.27Nov18.granregion.funnel.g++.1 delete mode 100644 examples/granregion/log.27Nov18.granregion.funnel.g++.4 delete mode 100644 examples/granregion/log.27Nov18.granregion.mixer.g++.1 delete mode 100644 examples/granregion/log.27Nov18.granregion.mixer.g++.4 create mode 100644 examples/granular/log.15Sep22.pour.drum.g++.1 create mode 100644 examples/granular/log.15Sep22.pour.drum.g++.4 create mode 100644 examples/granular/log.15Sep22.pour.flatwall.g++.1 create mode 100644 examples/granular/log.15Sep22.pour.flatwall.g++.4 create mode 100644 examples/granular/log.15Sep22.pour.heat.g++.1 create mode 100644 examples/granular/log.15Sep22.pour.heat.g++.4 delete mode 100644 examples/granular/log.29Oct20.pour.drum.g++.1 delete mode 100644 examples/granular/log.29Oct20.pour.drum.g++.4 delete mode 100644 examples/granular/log.29Oct20.pour.flatwall.g++.1 delete mode 100644 examples/granular/log.29Oct20.pour.flatwall.g++.4 diff --git a/examples/granregion/log.15Sep22.granregion.box.g++.1 b/examples/granregion/log.15Sep22.granregion.box.g++.1 new file mode 100644 index 0000000000..0df89d49ee --- /dev/null +++ b/examples/granregion/log.15Sep22.granregion.box.g++.1 @@ -0,0 +1,493 @@ +LAMMPS (15 Sep 2022) +# pouring spheres into container box + +units lj +atom_style sphere +boundary f f f +dimension 3 +comm_modify vel yes + +region box block -10 10 -10 10 -10 10 units box +create_box 2 box +Created orthogonal box = (-10 -10 -10) to (10 10 10) + 1 by 1 by 1 MPI processor grid + +pair_style hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1 +pair_coeff * * gran/hooke + +region container block -6 6 -6 6 -6 6 units box +fix container all wall/gran/region hooke/history 4000.0 NULL 100.0 NULL 0.5 1 region container + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +fix 2 all nve/sphere +fix 3 all gravity 1.0 vector 0 0 -1 + +region slab block -2 2 -2 2 -2 2 units box +fix ins all pour 100 2 4767548 vol 0.4 10 diam one 1.0 region slab ignore +Particle insertion: 48 every 566 steps, 100 by step 1133 + +timestep 0.005 + +compute 1 all temp +compute_modify 1 dynamic/dof yes + +compute 2 all temp/sphere +compute_modify 2 dynamic/dof yes + +thermo 100 +thermo_style custom step atoms temp c_1 c_2 press +thermo_modify lost ignore +compute_modify thermo_temp dynamic/dof yes + +#dump 2 all image 100 image.*.jpg type type # zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03 +#dump_modify 2 pad 5 + +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 1.3 + binsize = 0.65, bins = 31 31 31 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hooke, perpetual + attributes: half, newton on, size + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 0.5861 | 0.5861 | 0.5861 Mbytes + Step Atoms Temp c_1 c_2 Press + 0 0 0 0 0 0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 100 30 0.803783 0.803783 0.39507978 0.0029137134 + 200 30 1.1967995 1.1967995 0.5882574 0.0043383984 + 300 30 1.2814686 1.2814686 0.62987441 0.0046453238 + 400 30 0.82331082 0.82331082 0.41173176 0.0029845017 + 500 30 0.7708462 0.7708462 0.38777784 0.0043831147 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 600 64 0.51564897 0.51564897 0.26631577 0.0040059368 + 700 64 0.57239348 0.57239348 0.29566901 0.0045075987 + 800 64 0.61837087 0.61837087 0.32195387 0.0048123564 + 900 64 0.53061888 0.53061888 0.28564763 0.0055906552 + 1000 64 0.496299 0.496299 0.26801572 0.0061169128 + 1100 64 0.46068308 0.46068308 0.24699057 0.0055717699 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 1200 99 0.39206225 0.39206225 0.21356546 0.0066294211 + 1300 99 0.38624966 0.38624966 0.21345854 0.0049051051 + 1400 99 0.35615284 0.35615284 0.19785725 0.0046170772 + 1500 99 0.31486693 0.31486693 0.17429055 0.0064903432 + 1600 99 0.26369001 0.26369001 0.15095266 0.0045226847 + 1700 100 0.1925923 0.1925923 0.11308104 0.007362313 + 1800 100 0.13724978 0.13724978 0.083276845 0.0058136373 + 1900 100 0.077212636 0.077212636 0.053159386 0.0016509598 + 2000 100 0.065294031 0.065294031 0.04372752 0.0020346467 + 2100 100 0.057431398 0.057431398 0.037977068 0.0012681098 + 2200 100 0.059093045 0.059093045 0.037435193 0.00096610799 + 2300 100 0.03422338 0.03422338 0.025491304 0.00069886052 + 2400 100 0.020558284 0.020558284 0.016163009 0.0017260663 + 2500 100 0.015339709 0.015339709 0.012329236 0.00041308031 + 2600 100 0.012891354 0.012891354 0.009766054 0.00030356722 + 2700 100 0.0092634449 0.0092634449 0.0073580108 0.00077723051 + 2800 100 0.0073925841 0.0073925841 0.0059932218 0.00016466767 + 2900 100 0.0081228267 0.0081228267 0.006281761 0.00013828388 + 3000 100 0.0041833223 0.0041833223 0.0035147096 0.00013160599 + 3100 100 0.0035930775 0.0035930775 0.0030039922 0.00060639771 + 3200 100 0.0030824465 0.0030824465 0.0026541293 0.00047391014 + 3300 100 0.0035087522 0.0035087522 0.0027664508 0.00014080317 + 3400 100 0.0018537868 0.0018537868 0.0017099705 6.3326674e-05 + 3500 100 0.0015371228 0.0015371228 0.0014155433 0.00021612522 + 3600 100 0.001708556 0.001708556 0.0014369892 8.1034202e-05 + 3700 100 0.00095948652 0.00095948652 0.0009788528 3.4694023e-05 + 3800 100 0.00091875668 0.00091875668 0.00086805146 3.9373686e-05 + 3900 100 0.001557068 0.001557068 0.001159526 2.5178607e-05 + 4000 100 0.00062012451 0.00062012451 0.00066806922 5.6680551e-06 + 4100 100 0.00060940771 0.00060940771 0.00065614741 1.0137901e-05 + 4200 100 0.00059538437 0.00059538437 0.00064501521 7.3679744e-06 + 4300 100 0.00052946048 0.00052946048 0.00059353641 5.9225081e-06 + 4400 100 0.00051202281 0.00051202281 0.00057524772 3.6198435e-05 + 4500 100 0.00049986632 0.00049986632 0.00055754521 2.2275519e-05 + 4600 100 0.00048187334 0.00048187334 0.00053988815 2.2015243e-05 + 4700 100 0.00045261491 0.00045261491 0.00050298355 8.9681339e-05 + 4800 100 0.00034965427 0.00034965427 0.0004278781 1.0983535e-05 + 4900 100 0.00033555621 0.00033555621 0.00041435167 2.9266598e-05 + 5000 100 0.00031387148 0.00031387148 0.00039605781 2.5628425e-05 +Loop time of 0.078687 on 1 procs for 5000 steps with 100 atoms + +Performance: 27450544.413 tau/day, 63542.927 timesteps/s, 6.354 Matom-step/s +80.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0084151 | 0.0084151 | 0.0084151 | 0.0 | 10.69 +Neigh | 0.012728 | 0.012728 | 0.012728 | 0.0 | 16.18 +Comm | 0.0056143 | 0.0056143 | 0.0056143 | 0.0 | 7.14 +Output | 0.00051411 | 0.00051411 | 0.00051411 | 0.0 | 0.65 +Modify | 0.041412 | 0.041412 | 0.041412 | 0.0 | 52.63 +Other | | 0.01 | | | 12.71 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 164 ave 164 max 164 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 164 +Ave neighs/atom = 1.64 +Neighbor list builds = 281 +Dangerous builds = 0 + +region container delete +variable theta equal (step-5000)*(4.0*PI/5000) +region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 0 0 1 +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 1.3 + binsize = 0.65, bins = 31 31 31 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hooke, perpetual + attributes: half, newton on, size + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.837 | 5.837 | 5.837 Mbytes + Step Atoms Temp c_1 c_2 Press + 5000 100 0.00031387148 0.00031387148 0.00039605781 2.6174978e-05 + 5100 100 0.54537023 0.54537023 0.30042175 0.0087427352 + 5200 100 0.57210852 0.57210852 0.3192468 0.0098134067 + 5300 100 0.7168108 0.7168108 0.38577893 0.011004584 + 5400 100 0.78895524 0.78895524 0.41889428 0.013555713 + 5500 100 0.87797874 0.87797874 0.45689223 0.01565356 + 5600 100 0.95424379 0.95424379 0.48830429 0.014707858 + 5700 100 1.0046012 1.0046012 0.51054927 0.01469179 + 5800 100 1.0371453 1.0371453 0.5262568 0.015576788 + 5900 100 1.0545743 1.0545743 0.5361173 0.01589889 + 6000 100 1.0932949 1.0932949 0.55402214 0.017484573 + 6100 100 1.1148364 1.1148364 0.56241126 0.01721788 + 6200 100 1.1315267 1.1315267 0.57050887 0.017961246 + 6300 100 1.1506124 1.1506124 0.58009471 0.017159062 + 6400 100 1.1663328 1.1663328 0.5876586 0.017935311 + 6500 100 1.1821086 1.1821086 0.59595162 0.018005316 + 6600 100 1.2039397 1.2039397 0.60567524 0.021604669 + 6700 100 1.2269911 1.2269911 0.61770224 0.018907995 + 6800 100 1.2447035 1.2447035 0.6257652 0.02053766 + 6900 100 1.2625323 1.2625323 0.63486698 0.020106134 + 7000 100 1.2617127 1.2617127 0.63318163 0.019670429 + 7100 100 1.260715 1.260715 0.63311254 0.019810631 + 7200 100 1.2790404 1.2790404 0.64079001 0.020218903 + 7300 100 1.2760228 1.2760228 0.6395331 0.021749906 + 7400 100 1.2799658 1.2799658 0.64139084 0.020472922 + 7500 100 1.2846473 1.2846473 0.64343085 0.020610025 + 7600 100 1.2883965 1.2883965 0.64491873 0.02074884 + 7700 100 1.2926891 1.2926891 0.64684545 0.020599654 + 7800 100 1.3032201 1.3032201 0.65119455 0.02183405 + 7900 100 1.3025628 1.3025628 0.65068661 0.021248589 + 8000 100 1.3052302 1.3052302 0.65208602 0.021399549 + 8100 100 1.3069867 1.3069867 0.65304849 0.021254794 + 8200 100 1.3092024 1.3092024 0.6543837 0.021220909 + 8300 100 1.3101468 1.3101468 0.65519741 0.021328361 + 8400 100 1.3116005 1.3116005 0.65545253 0.021493555 + 8500 100 1.3153616 1.3153616 0.65731542 0.021433279 + 8600 100 1.3164556 1.3164556 0.65791227 0.021531213 + 8700 100 1.3187245 1.3187245 0.65915974 0.02170181 + 8800 100 1.3215981 1.3215981 0.66036644 0.022358849 + 8900 100 1.3206845 1.3206845 0.65984651 0.021901337 + 9000 100 1.3213046 1.3213046 0.66020378 0.021876353 + 9100 100 1.3225084 1.3225084 0.66088847 0.021811098 + 9200 100 1.3240309 1.3240309 0.66180646 0.021768929 + 9300 100 1.325458 1.325458 0.66280401 0.02165852 + 9400 100 1.3322968 1.3322968 0.66615126 0.022139018 + 9500 100 1.3416035 1.3416035 0.67030794 0.022243129 + 9600 100 1.3353326 1.3353326 0.66692811 0.022622122 + 9700 100 1.336265 1.336265 0.66727395 0.022171165 + 9800 100 1.3344531 1.3344531 0.66634538 0.022025131 + 9900 100 1.3337098 1.3337098 0.66601721 0.022111706 + 10000 100 1.3335539 1.3335539 0.66597627 0.022133817 +Loop time of 0.235008 on 1 procs for 5000 steps with 100 atoms + +Performance: 9191156.994 tau/day, 21275.826 timesteps/s, 2.128 Matom-step/s +94.1% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.029846 | 0.029846 | 0.029846 | 0.0 | 12.70 +Neigh | 0.030211 | 0.030211 | 0.030211 | 0.0 | 12.86 +Comm | 0.005731 | 0.005731 | 0.005731 | 0.0 | 2.44 +Output | 0.00051873 | 0.00051873 | 0.00051873 | 0.0 | 0.22 +Modify | 0.1583 | 0.1583 | 0.1583 | 0.0 | 67.36 +Other | | 0.01041 | | | 4.43 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 186 ave 186 max 186 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 186 +Ave neighs/atom = 1.86 +Neighbor list builds = 626 +Dangerous builds = 0 + +region container delete +region container block -6 6 -6 6 -6 6 units box +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.837 | 5.837 | 5.837 Mbytes + Step Atoms Temp c_1 c_2 Press + 10000 100 1.3335539 1.3335539 0.66597627 0.022207076 + 10100 100 0.29976134 0.29976134 0.1752962 0.0091355801 + 10200 100 0.1548002 0.1548002 0.1005356 0.0062509071 + 10300 100 0.082468613 0.082468613 0.066729575 0.0017315098 + 10400 100 0.06731284 0.06731284 0.056685383 0.0011965765 + 10500 100 0.050167538 0.050167538 0.042388389 0.0010830279 + 10600 100 0.041091371 0.041091371 0.034743534 0.00092984522 + 10700 100 0.033199041 0.033199041 0.027954031 0.0018451338 + 10800 100 0.027880411 0.027880411 0.024437224 0.0013039536 + 10900 100 0.024634597 0.024634597 0.021815184 0.00030935286 + 11000 100 0.020741105 0.020741105 0.018754221 0.0006306901 + 11100 100 0.017210914 0.017210914 0.015842306 0.00075930229 + 11200 100 0.01254319 0.01254319 0.012145795 0.00047388541 + 11300 100 0.010032468 0.010032468 0.0095918697 0.0014677116 + 11400 100 0.0081538458 0.0081538458 0.0080985914 0.00032485316 + 11500 100 0.0072918155 0.0072918155 0.0070156789 0.00023642827 + 11600 100 0.0070136586 0.0070136586 0.0067263114 7.8490444e-05 + 11700 100 0.0061722946 0.0061722946 0.0058832419 0.00013450793 + 11800 100 0.0052444487 0.0052444487 0.0049294304 8.6973121e-05 + 11900 100 0.0048212279 0.0048212279 0.0045261412 0.00010458031 + 12000 100 0.0046782797 0.0046782797 0.0044011937 0.00018881094 + 12100 100 0.0042066617 0.0042066617 0.0040330976 0.00015507521 + 12200 100 0.0038529032 0.0038529032 0.003664712 1.1476621e-05 + 12300 100 0.0033203238 0.0033203238 0.0032404054 0.00027622191 + 12400 100 0.003113731 0.003113731 0.0030491123 3.8532421e-05 + 12500 100 0.0029925149 0.0029925149 0.0029415075 4.2673261e-05 + 12600 100 0.0028383323 0.0028383323 0.0027902992 9.328552e-05 + 12700 100 0.0026386104 0.0026386104 0.0026095714 7.7740986e-05 + 12800 100 0.0023509873 0.0023509873 0.0023518594 3.1944764e-05 + 12900 100 0.0022296104 0.0022296104 0.0022030693 4.5393502e-05 + 13000 100 0.0021991358 0.0021991358 0.0021560478 0.0001221212 + 13100 100 0.0021011001 0.0021011001 0.0020752855 2.4605107e-05 + 13200 100 0.002004495 0.002004495 0.0020040212 2.4805625e-05 + 13300 100 0.0018394135 0.0018394135 0.0018288384 6.2227066e-05 + 13400 100 0.0016314086 0.0016314086 0.0016058102 0.00010372886 + 13500 100 0.0015042857 0.0015042857 0.0014660263 0.00020805178 + 13600 100 0.0013584764 0.0013584764 0.0013177418 5.1603333e-05 + 13700 100 0.0012407449 0.0012407449 0.0011902637 8.87401e-05 + 13800 100 0.0011673364 0.0011673364 0.0011324247 2.3668551e-05 + 13900 100 0.0011429204 0.0011429204 0.0011072347 1.414364e-05 + 14000 100 0.001087543 0.001087543 0.0010616439 3.0874865e-05 + 14100 100 0.00098839393 0.00098839393 0.00096445684 6.5331515e-05 + 14200 100 0.00095139076 0.00095139076 0.00093658993 2.5649208e-05 + 14300 100 0.00089532494 0.00089532494 0.00082626435 2.6200482e-05 + 14400 100 0.00077973015 0.00077973015 0.00070733785 2.29298e-05 + 14500 100 0.00068559117 0.00068559117 0.00062297009 8.4841907e-06 + 14600 100 0.00059199698 0.00059199698 0.00052453148 1.2737231e-05 + 14700 100 0.00055052378 0.00055052378 0.00048459372 1.3028328e-05 + 14800 100 0.00049397913 0.00049397913 0.00044094284 6.1129918e-06 + 14900 100 0.00048082746 0.00048082746 0.00043128724 3.7301936e-06 + 15000 100 0.00046847825 0.00046847825 0.00041484245 5.7974184e-06 +Loop time of 0.0802044 on 1 procs for 5000 steps with 100 atoms + +Performance: 26931180.398 tau/day, 62340.695 timesteps/s, 6.234 Matom-step/s +82.1% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0080809 | 0.0080809 | 0.0080809 | 0.0 | 10.08 +Neigh | 0.0048815 | 0.0048815 | 0.0048815 | 0.0 | 6.09 +Comm | 0.0055605 | 0.0055605 | 0.0055605 | 0.0 | 6.93 +Output | 0.00050386 | 0.00050386 | 0.00050386 | 0.0 | 0.63 +Modify | 0.051104 | 0.051104 | 0.051104 | 0.0 | 63.72 +Other | | 0.01007 | | | 12.56 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 157 ave 157 max 157 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 157 +Ave neighs/atom = 1.57 +Neighbor list builds = 100 +Dangerous builds = 0 + +region container delete +variable theta equal (step-15000)*(4.0*PI/5000) +region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 1 1 1 +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.837 | 5.837 | 5.837 Mbytes + Step Atoms Temp c_1 c_2 Press + 15000 100 0.00046847825 0.00046847825 0.00041484245 5.7974184e-06 + 15100 100 0.96677694 0.96677694 0.64420785 0.01431184 + 15200 100 1.0659255 1.0659255 0.69293741 0.013240486 + 15300 100 1.1647631 1.1647631 0.75191941 0.014622673 + 15400 100 1.3411593 1.3411593 0.85696383 0.02561549 + 15500 100 1.6033758 1.6033758 0.99094919 0.026221789 + 15600 100 1.7889645 1.7889645 1.075315 0.024116301 + 15700 100 1.8077023 1.8077023 1.0842652 0.031781756 + 15800 100 2.0252655 2.0252655 1.1517407 0.037201818 + 15900 100 2.1479427 2.1479427 1.2061238 0.027668435 + 16000 100 2.1788838 2.1788838 1.2205599 0.029114273 + 16100 100 2.3257431 2.3257431 1.2921157 0.035663063 + 16200 100 2.3885449 2.3885449 1.3282237 0.032255517 + 16300 100 2.3670966 2.3670966 1.3091694 0.029579008 + 16400 100 2.5097781 2.5097781 1.3712036 0.034579196 + 16500 100 2.6440883 2.6440883 1.4440043 0.03347813 + 16600 100 2.7230084 2.7230084 1.481565 0.036660339 + 16700 100 2.8246108 2.8246108 1.5298387 0.035623641 + 16800 100 3.0338694 3.0338694 1.6333504 0.038818594 + 16900 100 3.1219584 3.1219584 1.6790766 0.043444123 + 17000 100 3.4103817 3.4103817 1.8222668 0.044524654 + 17100 100 3.3869069 3.3869069 1.8170743 0.050670801 + 17200 100 3.4220314 3.4220314 1.8312364 0.045956123 + 17300 100 3.396894 3.396894 1.8158291 0.050420297 + 17400 100 3.4508224 3.4508224 1.8429996 0.049923733 + 17500 100 3.5039601 3.5039601 1.8822352 0.051047713 + 17600 100 3.3743905 3.3743905 1.8380347 0.047922214 + 17700 100 3.3729709 3.3729709 1.8224123 0.04758126 + 17800 100 3.3237798 3.3237798 1.7962316 0.045427975 + 17900 100 3.2441052 3.2441052 1.7782748 0.044651231 + 18000 100 3.1169205 3.1169205 1.704639 0.047440495 + 18100 100 3.1704608 3.1704608 1.7326375 0.045656546 + 18200 100 3.1113438 3.1113438 1.7002232 0.041619255 + 18300 100 3.2506111 3.2506111 1.7693075 0.048028527 + 18400 100 3.3840681 3.3840681 1.8370672 0.04443243 + 18500 100 3.4822823 3.4822823 1.9125273 0.043687118 + 18600 100 3.5214372 3.5214372 1.9364829 0.049798605 + 18700 100 3.5439229 3.5439229 1.9441301 0.046240266 + 18800 100 3.6046761 3.6046761 1.9791448 0.054369382 + 18900 100 3.8598403 3.8598403 2.0999449 0.049863074 + 19000 100 3.8606461 3.8606461 2.0885493 0.050269245 + 19100 100 4.076627 4.076627 2.2025766 0.058050893 + 19200 100 3.8280814 3.8280814 2.0749884 0.05730905 + 19300 100 3.8211633 3.8211633 2.0759453 0.05145071 + 19400 100 3.7726284 3.7726284 2.0466555 0.053566404 + 19500 100 3.7468403 3.7468403 2.03218 0.048422025 + 19600 100 3.6408955 3.6408955 1.9873843 0.046565134 + 19700 100 3.6454187 3.6454187 2.0042204 0.049299897 + 19800 100 3.5165071 3.5165071 1.937379 0.046319859 + 19900 100 3.4670702 3.4670702 1.9140316 0.045650114 + 20000 100 3.6114294 3.6114294 1.9798674 0.05431148 +Loop time of 0.203164 on 1 procs for 5000 steps with 100 atoms + +Performance: 10631806.993 tau/day, 24610.664 timesteps/s, 2.461 Matom-step/s +92.3% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.01242 | 0.01242 | 0.01242 | 0.0 | 6.11 +Neigh | 0.044478 | 0.044478 | 0.044478 | 0.0 | 21.89 +Comm | 0.0057766 | 0.0057766 | 0.0057766 | 0.0 | 2.84 +Output | 0.00051702 | 0.00051702 | 0.00051702 | 0.0 | 0.25 +Modify | 0.12923 | 0.12923 | 0.12923 | 0.0 | 63.61 +Other | | 0.01074 | | | 5.29 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 142 ave 142 max 142 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 142 +Ave neighs/atom = 1.42 +Neighbor list builds = 909 +Dangerous builds = 0 + +region container delete +region container block -6 6 -6 6 -6 6 units box +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.837 | 5.837 | 5.837 Mbytes + Step Atoms Temp c_1 c_2 Press + 20000 100 3.6114294 3.6114294 1.9798674 0.053887263 + 20100 100 1.0907336 1.0907336 0.69799767 0.013925984 + 20200 100 0.92304387 0.92304387 0.59520318 0.012377709 + 20300 100 0.84004201 0.84004201 0.55081472 0.012108246 + 20400 100 0.89491209 0.89491209 0.56269969 0.01221427 + 20500 100 0.92011482 0.92011482 0.56971815 0.011353588 + 20600 100 0.95722998 0.95722998 0.58038747 0.01185569 + 20700 100 0.92635786 0.92635786 0.55373959 0.011953734 + 20800 100 0.93088162 0.93088162 0.55094813 0.012887472 + 20900 100 0.97288373 0.97288373 0.56309599 0.013731021 + 21000 100 0.63378762 0.63378762 0.3779177 0.010114787 + 21100 100 0.34618473 0.34618473 0.21652381 0.0070717708 + 21200 100 0.18660008 0.18660008 0.1302051 0.006504227 + 21300 100 0.13917709 0.13917709 0.09667499 0.0032593765 + 21400 100 0.11627047 0.11627047 0.080272858 0.0028891045 + 21500 100 0.086269781 0.086269781 0.064184981 0.0019374959 + 21600 100 0.08052393 0.08052393 0.059561101 0.001214522 + 21700 100 0.036026032 0.036026032 0.030243348 0.001199233 + 21800 100 0.02392645 0.02392645 0.022284244 0.00060060634 + 21900 100 0.016991266 0.016991266 0.017366625 0.00065672411 + 22000 100 0.016974877 0.016974877 0.016399245 0.0005903103 + 22100 100 0.015491818 0.015491818 0.014806105 0.00051181051 + 22200 100 0.011908698 0.011908698 0.011206673 0.00099478656 + 22300 100 0.010002714 0.010002714 0.0093749794 0.00028214624 + 22400 100 0.0081652616 0.0081652616 0.0079594664 0.00026841276 + 22500 100 0.0067602843 0.0067602843 0.0067498831 0.00019472612 + 22600 100 0.0061024058 0.0061024058 0.0062958451 0.00016615781 + 22700 100 0.005331422 0.005331422 0.0056152366 0.00021543475 + 22800 100 0.0040796708 0.0040796708 0.004140932 0.00024397062 + 22900 100 0.0042042089 0.0042042089 0.0040406804 0.00015880055 + 23000 100 0.0056083872 0.0056083872 0.0046056699 0.00029203396 + 23100 100 0.0035006398 0.0035006398 0.003343101 0.00010571574 + 23200 100 0.0032402473 0.0032402473 0.003122476 0.00012784403 + 23300 100 0.0030100724 0.0030100724 0.0029649423 8.5613724e-05 + 23400 100 0.002746305 0.002746305 0.0027519317 9.6521844e-05 + 23500 100 0.0028543876 0.0028543876 0.002842845 0.00012566665 + 23600 100 0.0036979234 0.0036979234 0.0032448309 8.6321879e-05 + 23700 100 0.0030503565 0.0030503565 0.0027392305 5.9716835e-05 + 23800 100 0.0021564041 0.0021564041 0.0022097768 0.00028317769 + 23900 100 0.0018905956 0.0018905956 0.0020002233 4.5205733e-05 + 24000 100 0.0015705513 0.0015705513 0.0017262538 0.00026550225 + 24100 100 0.0013341334 0.0013341334 0.0015663921 4.8307183e-05 + 24200 100 0.0012426828 0.0012426828 0.0014960127 5.5195907e-05 + 24300 100 0.0011933799 0.0011933799 0.0014508697 5.2781568e-05 + 24400 100 0.0010126015 0.0010126015 0.0012821281 0.00011096457 + 24500 100 0.00094102576 0.00094102576 0.0012265703 3.3454252e-05 + 24600 100 0.00092243997 0.00092243997 0.0011970533 3.7288789e-05 + 24700 100 0.00080565605 0.00080565605 0.0010864406 0.00015797228 + 24800 100 0.00075303124 0.00075303124 0.0010103671 5.4727635e-05 + 24900 100 0.00074808599 0.00074808599 0.0010053951 8.6607732e-05 + 25000 100 0.00071720457 0.00071720457 0.00096622937 0.00015861964 +Loop time of 0.0845534 on 1 procs for 5000 steps with 100 atoms + +Performance: 25545994.179 tau/day, 59134.246 timesteps/s, 5.913 Matom-step/s +90.2% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0091411 | 0.0091411 | 0.0091411 | 0.0 | 10.81 +Neigh | 0.013557 | 0.013557 | 0.013557 | 0.0 | 16.03 +Comm | 0.0056205 | 0.0056205 | 0.0056205 | 0.0 | 6.65 +Output | 0.0005087 | 0.0005087 | 0.0005087 | 0.0 | 0.60 +Modify | 0.045578 | 0.045578 | 0.045578 | 0.0 | 53.90 +Other | | 0.01015 | | | 12.00 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 151 ave 151 max 151 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 151 +Ave neighs/atom = 1.51 +Neighbor list builds = 286 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/granregion/log.15Sep22.granregion.box.g++.4 b/examples/granregion/log.15Sep22.granregion.box.g++.4 new file mode 100644 index 0000000000..3e83d3bb04 --- /dev/null +++ b/examples/granregion/log.15Sep22.granregion.box.g++.4 @@ -0,0 +1,493 @@ +LAMMPS (15 Sep 2022) +# pouring spheres into container box + +units lj +atom_style sphere +boundary f f f +dimension 3 +comm_modify vel yes + +region box block -10 10 -10 10 -10 10 units box +create_box 2 box +Created orthogonal box = (-10 -10 -10) to (10 10 10) + 1 by 2 by 2 MPI processor grid + +pair_style hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1 +pair_coeff * * gran/hooke + +region container block -6 6 -6 6 -6 6 units box +fix container all wall/gran/region hooke/history 4000.0 NULL 100.0 NULL 0.5 1 region container + +neighbor 0.3 bin +neigh_modify delay 0 every 1 check yes + +fix 2 all nve/sphere +fix 3 all gravity 1.0 vector 0 0 -1 + +region slab block -2 2 -2 2 -2 2 units box +fix ins all pour 100 2 4767548 vol 0.4 10 diam one 1.0 region slab ignore +Particle insertion: 48 every 566 steps, 100 by step 1133 + +timestep 0.005 + +compute 1 all temp +compute_modify 1 dynamic/dof yes + +compute 2 all temp/sphere +compute_modify 2 dynamic/dof yes + +thermo 100 +thermo_style custom step atoms temp c_1 c_2 press +thermo_modify lost ignore +compute_modify thermo_temp dynamic/dof yes + +#dump 2 all image 100 image.*.jpg type type # zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03 +#dump_modify 2 pad 5 + +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 1.3 + binsize = 0.65, bins = 31 31 31 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hooke, perpetual + attributes: half, newton on, size + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 0.4843 | 0.4843 | 0.4843 Mbytes + Step Atoms Temp c_1 c_2 Press + 0 0 0 0 0 0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 100 30 0.803783 0.803783 0.39507978 0.0029137134 + 200 30 1.1967995 1.1967995 0.5882574 0.0043383984 + 300 30 1.2814686 1.2814686 0.62987441 0.0046453238 + 400 30 0.82331082 0.82331082 0.41173176 0.0029845017 + 500 30 0.7708462 0.7708462 0.38777784 0.0043831147 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 600 64 0.51564897 0.51564897 0.26631577 0.0040059368 + 700 64 0.57239348 0.57239348 0.29566901 0.0045075987 + 800 64 0.61837087 0.61837087 0.32195387 0.0048123564 + 900 64 0.53061888 0.53061888 0.28564763 0.0055906552 + 1000 64 0.496299 0.496299 0.26801572 0.0061169128 + 1100 64 0.46068308 0.46068308 0.24699057 0.0055717699 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 1200 99 0.39206225 0.39206225 0.21356546 0.0066294211 + 1300 99 0.38624966 0.38624966 0.21345854 0.0049051051 + 1400 99 0.35615284 0.35615284 0.19785725 0.0046170774 + 1500 99 0.31486691 0.31486691 0.17429054 0.0064903404 + 1600 99 0.26369 0.26369 0.15095263 0.0045226821 + 1700 100 0.19259352 0.19259352 0.11308184 0.0073603886 + 1800 100 0.1372448 0.1372448 0.083273652 0.0058163062 + 1900 100 0.077253038 0.077253038 0.053166156 0.0017440856 + 2000 100 0.065472093 0.065472093 0.04375349 0.0018416047 + 2100 100 0.057213469 0.057213469 0.037773954 0.001226231 + 2200 100 0.058857437 0.058857437 0.0372655 0.00090812381 + 2300 100 0.035066108 0.035066108 0.025934054 0.00072114554 + 2400 100 0.021272125 0.021272125 0.016635107 0.0018506654 + 2500 100 0.015530432 0.015530432 0.012533546 0.0013883971 + 2600 100 0.012603946 0.012603946 0.0096981459 0.00038648118 + 2700 100 0.0097347475 0.0097347475 0.0076016624 0.00057313888 + 2800 100 0.0067081771 0.0067081771 0.0056944431 0.00085080075 + 2900 100 0.0089177981 0.0089177981 0.0065036822 0.00028986539 + 3000 100 0.0057840287 0.0057840287 0.0044989265 0.00016111737 + 3100 100 0.0038909621 0.0038909621 0.0031511938 0.0001708892 + 3200 100 0.0029043214 0.0029043214 0.0025807767 9.2473673e-05 + 3300 100 0.0022769336 0.0022769336 0.0021487157 0.00022312666 + 3400 100 0.0015571397 0.0015571397 0.0016669068 0.0003381372 + 3500 100 0.0015978184 0.0015978184 0.001707772 4.9930818e-05 + 3600 100 0.0023358916 0.0023358916 0.0020709426 9.7687609e-05 + 3700 100 0.0011186736 0.0011186736 0.0012146914 9.3338234e-05 + 3800 100 0.0011657036 0.0011657036 0.0012313764 3.1931251e-05 + 3900 100 0.0014998387 0.0014998387 0.0014015491 2.4226798e-05 + 4000 100 0.0010858335 0.0010858335 0.0010623286 1.6359241e-05 + 4100 100 0.0010464314 0.0010464314 0.0010123557 1.2949588e-05 + 4200 100 0.0010022428 0.0010022428 0.00097338971 1.2402332e-05 + 4300 100 0.00080622372 0.00080622372 0.00084329652 0.00033857037 + 4400 100 0.00073613921 0.00073613921 0.00078373608 1.0103949e-05 + 4500 100 0.00071402196 0.00071402196 0.00076658004 8.8360218e-06 + 4600 100 0.00064851765 0.00064851765 0.00071533461 1.0736438e-05 + 4700 100 0.00061146699 0.00061146699 0.00068274687 4.1341755e-06 + 4800 100 0.00059511472 0.00059511472 0.0006625527 7.3645447e-06 + 4900 100 0.00057700347 0.00057700347 0.0006468562 1.5411897e-05 + 5000 100 0.00056205001 0.00056205001 0.00063592505 7.8813845e-06 +Loop time of 0.0856033 on 4 procs for 5000 steps with 100 atoms + +Performance: 25232672.400 tau/day, 58408.964 timesteps/s, 5.841 Matom-step/s +88.4% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0034695 | 0.0050634 | 0.0068805 | 2.2 | 5.91 +Neigh | 0.0016916 | 0.0024175 | 0.0032212 | 1.5 | 2.82 +Comm | 0.020003 | 0.026482 | 0.033796 | 3.5 | 30.94 +Output | 0.0010864 | 0.001327 | 0.0014374 | 0.4 | 1.55 +Modify | 0.0067352 | 0.015857 | 0.025751 | 7.2 | 18.52 +Other | | 0.03446 | | | 40.25 + +Nlocal: 25 ave 53 max 0 min +Histogram: 2 0 0 0 0 0 0 0 1 1 +Nghost: 4 ave 8 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 40.5 ave 92 max 0 min +Histogram: 2 0 0 0 0 0 0 1 0 1 + +Total # of neighbors = 162 +Ave neighs/atom = 1.62 +Neighbor list builds = 288 +Dangerous builds = 0 + +region container delete +variable theta equal (step-5000)*(4.0*PI/5000) +region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 0 0 1 +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 1.3 + binsize = 0.65, bins = 31 31 31 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hooke, perpetual + attributes: half, newton on, size + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.609 | 5.672 | 5.734 Mbytes + Step Atoms Temp c_1 c_2 Press + 5000 100 0.00056205001 0.00056205001 0.00063592505 7.871665e-06 + 5100 100 0.59585977 0.59585977 0.32464933 0.0141718 + 5200 100 0.67306764 0.67306764 0.35872096 0.013373672 + 5300 100 0.76065187 0.76065187 0.39925025 0.011460301 + 5400 100 0.87984446 0.87984446 0.45261417 0.013937042 + 5500 100 0.95548319 0.95548319 0.48706892 0.013601658 + 5600 100 0.9993278 0.9993278 0.50830306 0.015663766 + 5700 100 1.0449415 1.0449415 0.52967249 0.016797841 + 5800 100 1.0767598 1.0767598 0.54508699 0.016128855 + 5900 100 1.118688 1.118688 0.56530849 0.016830117 + 6000 100 1.1535698 1.1535698 0.58290663 0.01715335 + 6100 100 1.1753828 1.1753828 0.59419088 0.019273207 + 6200 100 1.1994171 1.1994171 0.60433264 0.018391566 + 6300 100 1.2244707 1.2244707 0.61626199 0.018842556 + 6400 100 1.2507994 1.2507994 0.62829386 0.019538413 + 6500 100 1.2684644 1.2684644 0.63747702 0.020794729 + 6600 100 1.2704726 1.2704726 0.63929889 0.020253985 + 6700 100 1.2737302 1.2737302 0.63970688 0.020858602 + 6800 100 1.287922 1.287922 0.64460894 0.021589773 + 6900 100 1.3028782 1.3028782 0.65197802 0.02135295 + 7000 100 1.306633 1.306633 0.65371741 0.021291182 + 7100 100 1.3161393 1.3161393 0.65785404 0.022554896 + 7200 100 1.3228158 1.3228158 0.6609031 0.021811977 + 7300 100 1.3245632 1.3245632 0.66161966 0.02206776 + 7400 100 1.3266822 1.3266822 0.662738 0.022070761 + 7500 100 1.3265138 1.3265138 0.6624472 0.021944768 + 7600 100 1.3286802 1.3286802 0.66338775 0.0219393 + 7700 100 1.332829 1.332829 0.66547051 0.022142398 + 7800 100 1.3323535 1.3323535 0.66534513 0.022787777 + 7900 100 1.3372424 1.3372424 0.66777556 0.02192759 + 8000 100 1.3396201 1.3396201 0.66910123 0.022439596 + 8100 100 1.3422271 1.3422271 0.67060566 0.023784952 + 8200 100 1.3468062 1.3468062 0.6728991 0.02243345 + 8300 100 1.3439408 1.3439408 0.6717529 0.022312339 + 8400 100 1.3484134 1.3484134 0.67346027 0.022770922 + 8500 100 1.3490032 1.3490032 0.67378177 0.022427863 + 8600 100 1.349789 1.349789 0.67398897 0.022494049 + 8700 100 1.3513512 1.3513512 0.67475613 0.022413559 + 8800 100 1.3535168 1.3535168 0.67589784 0.022356566 + 8900 100 1.3505765 1.3505765 0.67442168 0.022240615 + 9000 100 1.3499918 1.3499918 0.67419831 0.02226049 + 9100 100 1.3518103 1.3518103 0.67489482 0.022399038 + 9200 100 1.3526275 1.3526275 0.67529852 0.022395079 + 9300 100 1.353741 1.353741 0.67585205 0.022471008 + 9400 100 1.3538758 1.3538758 0.67589523 0.022461734 + 9500 100 1.3537199 1.3537199 0.67586527 0.022370169 + 9600 100 1.3539788 1.3539788 0.67602899 0.022400771 + 9700 100 1.3544874 1.3544874 0.67619552 0.022648464 + 9800 100 1.3555422 1.3555422 0.67666186 0.022367319 + 9900 100 1.3560106 1.3560106 0.6768751 0.02236585 + 10000 100 1.3563578 1.3563578 0.6770434 0.022359307 +Loop time of 0.139615 on 4 procs for 5000 steps with 100 atoms + +Performance: 15471121.710 tau/day, 35812.782 timesteps/s, 3.581 Matom-step/s +89.9% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0034672 | 0.011349 | 0.019511 | 7.2 | 8.13 +Neigh | 0.0032972 | 0.0053674 | 0.0074946 | 2.8 | 3.84 +Comm | 0.011049 | 0.018572 | 0.027876 | 5.6 | 13.30 +Output | 0.0010807 | 0.0015593 | 0.0018738 | 0.8 | 1.12 +Modify | 0.013556 | 0.040435 | 0.066715 | 13.0 | 28.96 +Other | | 0.06233 | | | 44.65 + +Nlocal: 25 ave 52 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 3 ave 6 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 48.25 ave 109 max 0 min +Histogram: 2 0 0 0 0 0 0 1 0 1 + +Total # of neighbors = 193 +Ave neighs/atom = 1.93 +Neighbor list builds = 626 +Dangerous builds = 0 + +region container delete +region container block -6 6 -6 6 -6 6 units box +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.609 | 5.672 | 5.735 Mbytes + Step Atoms Temp c_1 c_2 Press + 10000 100 1.3563578 1.3563578 0.6770434 0.022433108 + 10100 100 0.32881547 0.32881547 0.18968913 0.0063460187 + 10200 100 0.19880113 0.19880113 0.12812646 0.0074601538 + 10300 100 0.12614062 0.12614062 0.090121373 0.0028337336 + 10400 100 0.088358363 0.088358363 0.067236815 0.0020269846 + 10500 100 0.071199344 0.071199344 0.055567135 0.0016191769 + 10600 100 0.053909616 0.053909616 0.042301996 0.00098643468 + 10700 100 0.039560745 0.039560745 0.032482256 0.00089240864 + 10800 100 0.032130432 0.032130432 0.02705329 0.00058669881 + 10900 100 0.02462494 0.02462494 0.021121496 0.0017376127 + 11000 100 0.020941068 0.020941068 0.017866781 0.00031112553 + 11100 100 0.016775675 0.016775675 0.014620214 0.00026856842 + 11200 100 0.015005732 0.015005732 0.012803923 0.00067036626 + 11300 100 0.012099209 0.012099209 0.010308221 0.00032666902 + 11400 100 0.010559421 0.010559421 0.0090243729 0.00013645685 + 11500 100 0.0093738615 0.0093738615 0.0080176514 0.00098541099 + 11600 100 0.0081900702 0.0081900702 0.0070256953 0.00025935992 + 11700 100 0.0068100165 0.0068100165 0.0058703223 0.00014866816 + 11800 100 0.0060475708 0.0060475708 0.0052518105 0.00017895168 + 11900 100 0.0055607485 0.0055607485 0.0047184164 0.00011358846 + 12000 100 0.0053149064 0.0053149064 0.0045168418 0.00015222428 + 12100 100 0.0050909525 0.0050909525 0.0043196952 6.3000537e-05 + 12200 100 0.0041810842 0.0041810842 0.0036835522 4.6423956e-05 + 12300 100 0.0034305227 0.0034305227 0.0031222649 0.00020251115 + 12400 100 0.0031763077 0.0031763077 0.0028956456 0.00030307787 + 12500 100 0.0027440829 0.0027440829 0.0025087304 0.00010418607 + 12600 100 0.0024581964 0.0024581964 0.0022200229 3.042018e-05 + 12700 100 0.002259527 0.002259527 0.0020708869 4.192368e-05 + 12800 100 0.0019143448 0.0019143448 0.0018088032 4.6200439e-05 + 12900 100 0.0017935964 0.0017935964 0.0017028317 2.2195756e-05 + 13000 100 0.0017286429 0.0017286429 0.0016396753 2.3108871e-05 + 13100 100 0.0017055291 0.0017055291 0.0016122058 2.2444611e-05 + 13200 100 0.0016539275 0.0016539275 0.0015570166 2.0467353e-05 + 13300 100 0.0015777788 0.0015777788 0.0014852505 1.9525012e-05 + 13400 100 0.0015372199 0.0015372199 0.0014497102 2.3203566e-05 + 13500 100 0.0015066638 0.0015066638 0.0014097203 1.8644964e-05 + 13600 100 0.0012290618 0.0012290618 0.0012056216 1.3235643e-05 + 13700 100 0.0011781948 0.0011781948 0.0011685226 3.4312262e-05 + 13800 100 0.0011530136 0.0011530136 0.0011433171 2.8832126e-05 + 13900 100 0.0011085224 0.0011085224 0.0011052764 1.444139e-05 + 14000 100 0.0010656788 0.0010656788 0.0010702461 1.3187775e-05 + 14100 100 0.001029277 0.001029277 0.0010469537 1.2837267e-05 + 14200 100 0.0009750904 0.0009750904 0.0009915384 1.209089e-05 + 14300 100 0.00094893337 0.00094893337 0.00096909301 1.1743051e-05 + 14400 100 0.00087708427 0.00087708427 0.00087575318 1.9027338e-05 + 14500 100 0.00086229913 0.00086229913 0.0008643568 1.0670952e-05 + 14600 100 0.00084206808 0.00084206808 0.0008268172 3.2391722e-05 + 14700 100 0.00077682873 0.00077682873 0.00077186085 9.6132555e-06 + 14800 100 0.00074736908 0.00074736908 0.00074958372 9.2486924e-06 + 14900 100 0.00074456847 0.00074456847 0.00074779946 9.2140349e-06 + 15000 100 0.00073830282 0.00073830282 0.0007426924 9.1364974e-06 +Loop time of 0.0808149 on 4 procs for 5000 steps with 100 atoms + +Performance: 26727738.394 tau/day, 61869.765 timesteps/s, 6.187 Matom-step/s +86.6% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0034354 | 0.0050332 | 0.0069329 | 2.2 | 6.23 +Neigh | 0.00051999 | 0.00084906 | 0.0012075 | 0.0 | 1.05 +Comm | 0.0063631 | 0.014527 | 0.023754 | 6.8 | 17.98 +Output | 0.0010373 | 0.001342 | 0.001464 | 0.5 | 1.66 +Modify | 0.0051837 | 0.017338 | 0.031605 | 9.3 | 21.45 +Other | | 0.04173 | | | 51.63 + +Nlocal: 25 ave 53 max 0 min +Histogram: 2 0 0 0 0 0 0 0 1 1 +Nghost: 3.75 ave 8 max 0 min +Histogram: 2 0 0 0 0 0 0 0 1 1 +Neighs: 39.25 ave 82 max 0 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 157 +Ave neighs/atom = 1.57 +Neighbor list builds = 100 +Dangerous builds = 0 + +region container delete +variable theta equal (step-15000)*(4.0*PI/5000) +region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 1 1 1 +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.609 | 5.672 | 5.735 Mbytes + Step Atoms Temp c_1 c_2 Press + 15000 100 0.00073830282 0.00073830282 0.0007426924 9.1364974e-06 + 15100 100 1.1048281 1.1048281 0.7023727 0.018379275 + 15200 100 1.2022249 1.2022249 0.77748962 0.015662439 + 15300 100 1.2561351 1.2561351 0.82563065 0.01835048 + 15400 100 1.4372446 1.4372446 0.92907923 0.02087065 + 15500 100 1.6414713 1.6414713 1.0284489 0.025654324 + 15600 100 1.7844655 1.7844655 1.0861866 0.025170346 + 15700 100 2.034248 2.034248 1.2017171 0.040341642 + 15800 100 2.1253699 2.1253699 1.2228657 0.029297194 + 15900 100 2.1940232 2.1940232 1.2470589 0.033866758 + 16000 100 2.2624419 2.2624419 1.2828225 0.030063645 + 16100 100 2.3208536 2.3208536 1.3118956 0.0323489 + 16200 100 2.3564971 2.3564971 1.3261173 0.032882494 + 16300 100 2.3956066 2.3956066 1.3260307 0.03292972 + 16400 100 2.5025831 2.5025831 1.3817693 0.031132988 + 16500 100 2.5947914 2.5947914 1.4152657 0.036126782 + 16600 100 2.7688769 2.7688769 1.4975686 0.037497127 + 16700 100 2.812503 2.812503 1.5216659 0.039316167 + 16800 100 2.8977424 2.8977424 1.5599254 0.039996029 + 16900 100 3.045802 3.045802 1.6332888 0.041406156 + 17000 100 3.2195366 3.2195366 1.7247171 0.040023634 + 17100 100 3.2597294 3.2597294 1.7527958 0.04828292 + 17200 100 3.293587 3.293587 1.7693254 0.044001441 + 17300 100 3.1861836 3.1861836 1.7142076 0.049158822 + 17400 100 3.4593561 3.4593561 1.8426619 0.053469673 + 17500 100 3.3813767 3.3813767 1.8079958 0.058776299 + 17600 100 3.5834203 3.5834203 1.9094759 0.053256842 + 17700 100 3.2243306 3.2243306 1.7425111 0.064354789 + 17800 100 3.358228 3.358228 1.8202932 0.046798524 + 17900 100 3.2257908 3.2257908 1.7678964 0.043655204 + 18000 100 3.237732 3.237732 1.7598181 0.050850672 + 18100 100 3.2042441 3.2042441 1.751979 0.045582006 + 18200 100 3.1562775 3.1562775 1.7336068 0.042210739 + 18300 100 3.2630507 3.2630507 1.7925333 0.046412778 + 18400 100 3.4150588 3.4150588 1.8668408 0.044386435 + 18500 100 3.4913198 3.4913198 1.9125495 0.043329829 + 18600 100 3.5290036 3.5290036 1.9184098 0.048302721 + 18700 100 3.4852698 3.4852698 1.8865833 0.059566124 + 18800 100 3.7157551 3.7157551 2.0082235 0.051356305 + 18900 100 3.9504619 3.9504619 2.1377018 0.051553987 + 19000 100 3.9711274 3.9711274 2.1549121 0.051555312 + 19100 100 3.90954 3.90954 2.1135174 0.0548311 + 19200 100 4.0672819 4.0672819 2.1837089 0.064431553 + 19300 100 3.998355 3.998355 2.1572884 0.056830399 + 19400 100 3.9172127 3.9172127 2.1130164 0.051264041 + 19500 100 3.9120291 3.9120291 2.1088399 0.052545115 + 19600 100 3.8613614 3.8613614 2.0752883 0.055466569 + 19700 100 3.8428824 3.8428824 2.0787804 0.05129261 + 19800 100 3.5686751 3.5686751 1.9356553 0.059177256 + 19900 100 3.5573788 3.5573788 1.9430183 0.054618794 + 20000 100 3.5453022 3.5453022 1.9413343 0.047640543 +Loop time of 0.13841 on 4 procs for 5000 steps with 100 atoms + +Performance: 15605800.739 tau/day, 36124.539 timesteps/s, 3.612 Matom-step/s +89.0% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0047469 | 0.0062771 | 0.0080644 | 1.5 | 4.54 +Neigh | 0.0062517 | 0.0079248 | 0.0094271 | 1.3 | 5.73 +Comm | 0.047109 | 0.048595 | 0.050543 | 0.6 | 35.11 +Output | 0.0011807 | 0.0013428 | 0.0015517 | 0.4 | 0.97 +Modify | 0.022766 | 0.033256 | 0.039993 | 3.5 | 24.03 +Other | | 0.04101 | | | 29.63 + +Nlocal: 25 ave 36 max 13 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Nghost: 5 ave 9 max 2 min +Histogram: 1 0 1 0 1 0 0 0 0 1 +Neighs: 37.5 ave 53 max 15 min +Histogram: 1 0 0 0 0 1 0 1 0 1 + +Total # of neighbors = 150 +Ave neighs/atom = 1.5 +Neighbor list builds = 913 +Dangerous builds = 0 + +region container delete +region container block -6 6 -6 6 -6 6 units box +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.734 | 5.735 | 5.735 Mbytes + Step Atoms Temp c_1 c_2 Press + 20000 100 3.5453022 3.5453022 1.9413343 0.047178052 + 20100 100 1.0878587 1.0878587 0.68666704 0.016139979 + 20200 100 1.0230655 1.0230655 0.63593494 0.014642345 + 20300 100 0.94958824 0.94958824 0.59306601 0.011745659 + 20400 100 0.93038108 0.93038108 0.57232527 0.01154829 + 20500 100 0.92183816 0.92183816 0.55466942 0.01212559 + 20600 100 1.0175846 1.0175846 0.59940035 0.013815361 + 20700 100 1.0564615 1.0564615 0.60726745 0.013073711 + 20800 100 0.99967869 0.99967869 0.57665019 0.012450813 + 20900 100 0.97051084 0.97051084 0.5574217 0.015686955 + 21000 100 0.639185 0.639185 0.37441942 0.017594616 + 21100 100 0.24979014 0.24979014 0.17121567 0.0084027295 + 21200 100 0.15147941 0.15147941 0.11124349 0.0030435746 + 21300 100 0.13117502 0.13117502 0.091432638 0.0029110318 + 21400 100 0.11158272 0.11158272 0.076264692 0.0021951204 + 21500 100 0.056660993 0.056660993 0.043503807 0.0010993096 + 21600 100 0.028640836 0.028640836 0.026000267 0.0010440792 + 21700 100 0.025816483 0.025816483 0.021922896 0.00081674646 + 21800 100 0.023929555 0.023929555 0.019936972 0.0010383614 + 21900 100 0.022271339 0.022271339 0.017947505 0.0014630387 + 22000 100 0.019277834 0.019277834 0.015483116 0.00058751407 + 22100 100 0.019997809 0.019997809 0.015919504 0.00064176101 + 22200 100 0.015870543 0.015870543 0.01244838 0.0004205505 + 22300 100 0.011797587 0.011797587 0.0096491363 0.00034907063 + 22400 100 0.010745212 0.010745212 0.008874218 0.00035427537 + 22500 100 0.0082372399 0.0082372399 0.0071217811 0.00028179943 + 22600 100 0.007942576 0.007942576 0.0067248822 0.001507115 + 22700 100 0.0061733667 0.0061733667 0.0053092324 0.00056018554 + 22800 100 0.0058287651 0.0058287651 0.004972189 0.00023807695 + 22900 100 0.0051352339 0.0051352339 0.004324157 0.00020849263 + 23000 100 0.0040107769 0.0040107769 0.0035769703 0.00022626101 + 23100 100 0.0040288854 0.0040288854 0.0034355474 0.00019107621 + 23200 100 0.003277858 0.003277858 0.0030013165 0.00016119888 + 23300 100 0.0033633749 0.0033633749 0.0030188927 0.00014459404 + 23400 100 0.003468042 0.003468042 0.0030079205 0.00013778427 + 23500 100 0.0027616702 0.0027616702 0.0024994596 0.00011834915 + 23600 100 0.0022531303 0.0022531303 0.0021182802 0.0002279623 + 23700 100 0.002067768 0.002067768 0.0019631752 0.00014341503 + 23800 100 0.0020069255 0.0020069255 0.0019209587 0.00010673435 + 23900 100 0.0019630617 0.0019630617 0.0018748221 0.00011856923 + 24000 100 0.0018800646 0.0018800646 0.0018190347 0.00010707562 + 24100 100 0.0018028137 0.0018028137 0.0017067233 0.00010884117 + 24200 100 0.0017278932 0.0017278932 0.0016251004 0.00013664683 + 24300 100 0.0016373288 0.0016373288 0.0015529481 0.00010025414 + 24400 100 0.0019876848 0.0019876848 0.0016912033 0.00011235942 + 24500 100 0.0013677345 0.0013677345 0.0012839488 7.8669645e-05 + 24600 100 0.0012852614 0.0012852614 0.0012065052 0.00010172361 + 24700 100 0.0011145002 0.0011145002 0.0010748344 7.5021689e-05 + 24800 100 0.0012860792 0.0012860792 0.0011429675 5.7939624e-05 + 24900 100 0.00097198499 0.00097198499 0.00096175911 5.443837e-05 + 25000 100 0.00096224466 0.00096224466 0.00095159089 5.4245409e-05 +Loop time of 0.0846408 on 4 procs for 5000 steps with 100 atoms + +Performance: 25519602.289 tau/day, 59073.153 timesteps/s, 5.907 Matom-step/s +82.3% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0035473 | 0.0055294 | 0.0082454 | 2.7 | 6.53 +Neigh | 0.0016391 | 0.0022521 | 0.0028115 | 1.1 | 2.66 +Comm | 0.014697 | 0.021565 | 0.029045 | 4.1 | 25.48 +Output | 0.0010785 | 0.00132 | 0.0014171 | 0.4 | 1.56 +Modify | 0.0059648 | 0.01618 | 0.027615 | 7.9 | 19.12 +Other | | 0.03779 | | | 44.65 + +Nlocal: 25 ave 56 max 0 min +Histogram: 2 0 0 0 0 0 0 1 0 1 +Nghost: 5.5 ave 12 max 0 min +Histogram: 2 0 0 0 0 0 0 0 1 1 +Neighs: 40 ave 101 max 0 min +Histogram: 2 0 0 0 0 1 0 0 0 1 + +Total # of neighbors = 160 +Ave neighs/atom = 1.6 +Neighbor list builds = 275 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/granregion/log.15Sep22.granregion.funnel.g++.1 b/examples/granregion/log.15Sep22.granregion.funnel.g++.1 new file mode 100644 index 0000000000..fc60ca4928 --- /dev/null +++ b/examples/granregion/log.15Sep22.granregion.funnel.g++.1 @@ -0,0 +1,633 @@ +LAMMPS (15 Sep 2022) +# pour particles into cone-shaped funnel, settle them, let them run out bottom + +variable name string funnel_pour + +thermo_modify flush yes +units si +variable PI equal 3.141592653589 +variable seed equal 14314 + +############################################### +# Geometry-related parameters +############################################### + +variable xlo equal 10 +variable xhi equal 40 +variable ylo equal 10 +variable yhi equal 40 +variable zlo equal -20 +variable zhi equal 50 + +variable xc equal 25 +variable yc equal 25 + +variable zconehi equal 50 +variable zconelo equal 10 +variable zcyllo equal 0 +variable radconelo equal 2 +variable radconehi equal 20 + +################################################ +# Particle sizes +################################################ + +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable skin equal ${rhi} +variable skin equal 0.5 + +############################################### +# Granular contact parameters +############################################### + +variable coeffRes equal 0.1 +variable coeffFric equal 0.5 + +variable density equal 1.0 +variable EYoung equal 10^5 +variable Poisson equal 2.0/7.0 +variable GShear equal ${EYoung}/(2*(1+${Poisson})) +variable GShear equal 100000/(2*(1+${Poisson})) +variable GShear equal 100000/(2*(1+0.285714285714286)) + +variable gravity equal 1.0 + +variable reff equal 0.5*(${rhi}+${rlo}) +variable reff equal 0.5*(0.5+${rlo}) +variable reff equal 0.5*(0.5+0.25) +variable meff equal ${density}*4.0/3.0*${PI}*${reff}^3 +variable meff equal 1*4.0/3.0*${PI}*${reff}^3 +variable meff equal 1*4.0/3.0*3.141592653589*${reff}^3 +variable meff equal 1*4.0/3.0*3.141592653589*0.375^3 +variable min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*0.25 +variable max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*${rhi}*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*0.5 + +## Typical way to set kn, kt, etc.: +variable kn equal 4.0*${GShear}/(3*(1-${Poisson})) +variable kn equal 4.0*38888.8888888889/(3*(1-${Poisson})) +variable kn equal 4.0*38888.8888888889/(3*(1-0.285714285714286)) +variable kt equal 4.0*${GShear}/(2-${Poisson}) +variable kt equal 4.0*38888.8888888889/(2-${Poisson}) +variable kt equal 4.0*38888.8888888889/(2-0.285714285714286) + +variable a equal (-2.0*log(${coeffRes})/${PI})^2 +variable a equal (-2.0*log(0.1)/${PI})^2 +variable a equal (-2.0*log(0.1)/3.141592653589)^2 +variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*0.405284734569556)) +variable gamma_t equal ${gamma_n}*0.5 +variable gamma_t equal 903.503751814138*0.5 + +variable tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/${min_mass}-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-903.503751814138/4.0) + +variable dt equal ${tcol}*0.05 +variable dt equal 0.00210943016014969*0.05 +timestep ${dt} +timestep 0.000105471508007485 + +############################################### +variable dumpfreq equal 1000 +variable logfreq equal 1000 + +newton off +atom_style sphere + +boundary p p f + +region boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} +region boxreg block 10 ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} +region boxreg block 10 40 ${ylo} ${yhi} ${zlo} ${zhi} +region boxreg block 10 40 10 ${yhi} ${zlo} ${zhi} +region boxreg block 10 40 10 40 ${zlo} ${zhi} +region boxreg block 10 40 10 40 -20 ${zhi} +region boxreg block 10 40 10 40 -20 50 +create_box 1 boxreg +Created orthogonal box = (10 10 -20) to (40 40 50) + 1 by 1 by 1 MPI processor grid + +pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 +pair_coeff * * + +neighbor ${skin} multi +neighbor 0.5 multi +thermo ${logfreq} +thermo 1000 + +comm_style brick +comm_modify mode multi group all vel yes +balance 1.1 shift xyz 20 1.1 +Balancing ... +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0 + ghost atom cutoff = 0 + binsize = 30, bins = 1 1 3 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hertz/history, perpetual + attributes: half, newton off, size, history + pair build: half/size/multi/newtoff + stencil: full/multi/3d + bin: multi +WARNING: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. (../comm_brick.cpp:210) +fix bal all balance 10000 1.1 shift xyz 20 1.01 + +####################### Options specific to pouring ######################### + +# insertion region for fix/pour + +region insreg cylinder z ${xc} ${yc} 10 30 50 side in units box +region insreg cylinder z 25 ${yc} 10 30 50 side in units box +region insreg cylinder z 25 25 10 30 50 side in units box + +# define cone and cylinder regions - see lammps doc on region command +# note new open options + +region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 #Top is open +region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 2 0 10 side in units box open 2 + +region conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 #Bottom and top are open +region conereg cone z 25 ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 20 ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 20 10 ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 20 10 50 side in units box open 1 open 2 + +region hopreg union 2 conereg cylreg + +fix grav all gravity ${gravity} vector 0 0 -1 +fix grav all gravity 1 vector 0 0 -1 +fix 1 all nve/sphere + + +fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg + +fix ins all pour 2000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 ${dhi} dens ${density} ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens ${density} ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 3000 every 59965 steps, 2000 by step 1 + +#dump 1 all custom ${dumpfreq} ${name}.dump # id type mass diameter x y z + +#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 3.0 # box no 0.0 axes no 0.0 0.0 +#dump_modify 2 pad 6 + +thermo_style custom step cpu atoms ke +WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:896) +thermo_modify flush yes lost warn + +# Initial run to fill up the cone + +run 20000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- neighbor multi command: doi:10.1016/j.cpc.2008.03.005, doi:10.1007/s40571-020-00361-2 + +@Article{Intveld08, + author = {in 't Veld, P. J. and S. J.~Plimpton and G. S. Grest}, + title = {Accurate and Efficient Methods for Modeling Colloidal + Mixtures in an Explicit Solvent using Molecular Dynamics}, + journal = {Comput.\ Phys.\ Commut.}, + year = 2008, + volume = 179, + pages = {320--329} +} + +@article{Shire2020, + author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin}, + title = {{DEM} Simulations of Polydisperse Media: Efficient Contact + Detection Applied to Investigate the Quasi-Static Limit}, + journal = {Computational Particle Mechanics}, + year = {2020} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.648 | 6.648 | 6.648 Mbytes + Step CPU Atoms KinEng + 0 0 0 -0 + 1000 0.39961733 2000 -0 + 2000 0.61811961 2000 -0 + 3000 0.83512725 2000 -0 + 4000 1.0492881 2000 -0 + 5000 1.2650657 2000 -0 + 6000 1.479921 2000 -0 + 7000 1.6970993 2000 -0 + 8000 1.9107924 2000 -0 + 9000 2.1251713 2000 -0 + 10000 2.3403682 2000 -0 + 11000 2.549912 2000 -0 + 12000 2.7584788 2000 -0 + 13000 2.9712482 2000 -0 + 14000 3.1877015 2000 -0 + 15000 3.4017175 2000 -0 + 16000 3.6127477 2000 -0 + 17000 3.8250134 2000 -0 + 18000 4.0320643 2000 -0 + 19000 4.2371057 2000 -0 + 20000 4.4450882 2000 -0 +Loop time of 4.44512 on 1 procs for 20000 steps with 2000 atoms + +98.7% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.40438 | 0.40438 | 0.40438 | 0.0 | 9.10 +Neigh | 0.078634 | 0.078634 | 0.078634 | 0.0 | 1.77 +Comm | 0.01999 | 0.01999 | 0.01999 | 0.0 | 0.45 +Output | 0.00069031 | 0.00069031 | 0.00069031 | 0.0 | 0.02 +Modify | 3.795 | 3.795 | 3.795 | 0.0 | 85.38 +Other | | 0.1464 | | | 3.29 + +Nlocal: 2000 ave 2000 max 2000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1607 ave 1607 max 1607 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1607 +Ave neighs/atom = 0.8035 +Neighbor list builds = 71 +Dangerous builds = 0 +unfix ins +run 150000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 12.69 | 12.69 | 12.69 Mbytes + Step CPU Atoms KinEng + 20000 0 2000 6652.2957 + 21000 0.2135317 2000 6807.2201 + 22000 0.4235523 2000 6973.9359 + 23000 0.63502794 2000 7142.3648 + 24000 0.84593615 2000 7276.9717 + 25000 1.0580291 2000 7369.4191 + 26000 1.2719892 2000 7497.6526 + 27000 1.4843056 2000 7638.946 + 28000 1.9685336 2000 7780.0339 + 29000 2.1850097 2000 7881.8177 + 30000 2.4033006 2000 7967.2641 + 31000 2.6219694 2000 7994.9273 + 32000 2.8455468 2000 7937.0671 + 33000 3.0720066 2000 7774.0508 + 34000 3.3070513 2000 7591.1491 + 35000 3.5468777 2000 7357.5176 + 36000 3.7908265 2000 7147.2024 + 37000 4.0388657 2000 6979.1604 + 38000 4.2873223 2000 6813.2152 + 39000 4.5424244 2000 6660.2701 + 40000 4.8055367 2000 6502.8957 + 41000 5.0754561 2000 6324.3951 + 42000 5.3564118 2000 6132.7516 + 43000 5.6357256 2000 5913.1841 + 44000 5.9130645 2000 5732.2095 + 45000 6.1943539 2000 5508.8322 + 46000 6.4862302 2000 5306.8932 + 47000 6.7796417 2000 5152.0521 + 48000 7.0750069 2000 5028.2274 + 49000 7.3705252 2000 4896.102 + 50000 7.6693894 2000 4723.5189 + 51000 7.9685182 2000 4583.7526 + 52000 8.2774033 2000 4447.0187 + 53000 8.591482 2000 4303.2307 + 54000 8.9156439 2000 4168.5251 + 55000 9.2437364 2000 4036.9704 + 56000 9.5745684 2000 3901.1183 + 57000 9.9173689 2000 3716.7071 + 58000 10.270229 2000 3473.5422 + 59000 10.629101 2000 3245.1223 + 60000 10.989479 2000 3039.7845 + 61000 11.349843 2000 2780.0187 + 62000 11.716916 2000 2577.3345 + 63000 12.093666 2000 2346.2488 + 64000 12.474788 2000 2116.7298 + 65000 12.861438 2000 1903.7828 + 66000 13.25464 2000 1631.1676 + 67000 13.658382 2000 1431.0198 + 68000 14.067584 2000 1212.875 + 69000 14.480877 2000 995.45046 + 70000 14.894765 2000 811.54766 + 71000 15.309158 2000 624.08622 + 72000 15.732937 2000 471.00862 + 73000 16.158388 2000 358.33486 + 74000 16.583847 2000 284.39416 + 75000 17.008335 2000 234.26671 + 76000 17.429582 2000 185.61836 + 77000 17.852799 2000 152.95918 + 78000 18.276783 2000 122.49023 + 79000 18.697016 2000 102.29396 + 80000 19.12318 2000 86.284684 + 81000 19.54992 2000 73.984781 + 82000 19.986149 2000 63.042918 + 83000 20.430305 2000 53.338428 + 84000 20.876061 2000 45.89585 + 85000 21.32714 2000 40.412826 + 86000 21.781352 2000 34.183381 + 87000 22.238656 2000 29.671524 + 88000 22.698093 2000 26.90414 + 89000 23.160614 2000 24.362631 + 90000 23.630639 2000 21.887341 + 91000 24.095463 2000 19.985662 + 92000 24.570659 2000 18.728162 + 93000 25.047431 2000 16.99941 + 94000 25.549041 2000 15.71941 + 95000 26.03281 2000 14.744057 + 96000 26.513659 2000 14.214918 + 97000 26.998918 2000 13.450182 + 98000 27.486584 2000 12.79222 + 99000 27.986785 2000 12.10595 + 100000 28.48799 2000 11.281863 + 101000 28.986622 2000 10.025419 + 102000 29.491312 2000 9.9574468 + 103000 29.999421 2000 9.4078117 + 104000 30.507211 2000 8.9079161 + 105000 31.016484 2000 8.6269302 + 106000 31.527511 2000 8.5512649 + 107000 32.042612 2000 8.4703948 + 108000 32.555041 2000 8.2747542 + 109000 33.07064 2000 8.2895118 + 110000 33.593773 2000 8.1785613 + 111000 34.107129 2000 7.8443234 + 112000 34.619185 2000 7.7436124 + 113000 35.13418 2000 7.8118604 + 114000 35.653352 2000 7.3806177 + 115000 36.179577 2000 7.0857235 + 116000 36.69882 2000 7.1346752 + 117000 37.224612 2000 7.0653751 + 118000 37.756738 2000 6.6314104 + 119000 38.283151 2000 6.2169614 + 120000 38.808288 2000 5.8988829 + 121000 39.334913 2000 5.4197277 + 122000 39.862081 2000 4.6381303 + 123000 40.390252 2000 4.4949206 + 124000 40.920744 2000 4.4261118 + 125000 41.4469 2000 4.4223703 + 126000 41.977937 2000 4.4858898 + 127000 42.51483 2000 4.3312536 + 128000 43.046324 2000 3.7124973 + 129000 43.573687 2000 3.5467396 + 130000 44.103102 2000 3.5104139 + 131000 44.629869 2000 3.5725612 + 132000 45.156621 2000 3.669455 + 133000 45.69364 2000 3.6168912 + 134000 46.23133 2000 3.3598517 + 135000 46.765487 2000 3.3743407 + 136000 47.323693 2000 3.1109764 + 137000 47.881617 2000 3.0720146 + 138000 48.439179 2000 3.1303776 + 139000 49.001417 2000 3.2052806 + 140000 49.558061 2000 2.8958882 + 141000 50.097789 2000 2.9931572 + 142000 50.636089 2000 3.0967832 + 143000 51.175873 2000 3.0576365 + 144000 51.706799 2000 3.2016943 + 145000 52.239356 2000 3.3817709 + 146000 52.769944 2000 3.4527239 + 147000 53.30872 2000 3.5928733 + 148000 53.847762 2000 3.7784682 + 149000 54.387455 2000 3.6587944 + 150000 54.931594 2000 3.7945669 + 151000 55.470076 2000 3.5551557 + 152000 56.01448 2000 3.6248848 + 153000 56.552259 2000 3.7361463 + 154000 57.092655 2000 3.8534319 + 155000 57.635767 2000 4.0101408 + 156000 58.180249 2000 3.7670652 + 157000 58.724032 2000 3.1487676 + 158000 59.262015 2000 2.980076 + 159000 59.794312 2000 3.0350592 + 160000 60.331617 2000 3.125389 + 161000 60.861827 2000 2.7516115 + 162000 61.396691 2000 2.413911 + 163000 61.930145 2000 2.297713 + 164000 62.466983 2000 2.3190806 + 165000 63.00535 2000 2.2868879 + 166000 63.546881 2000 2.1658547 + 167000 64.091461 2000 1.7511071 + 168000 64.63141 2000 1.4112478 + 169000 65.17459 2000 1.3623558 + 170000 65.719571 2000 1.3701579 +Loop time of 65.7196 on 1 procs for 150000 steps with 2000 atoms + +98.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 32.424 | 32.424 | 32.424 | 0.0 | 49.34 +Neigh | 0.65326 | 0.65326 | 0.65326 | 0.0 | 0.99 +Comm | 0.14207 | 0.14207 | 0.14207 | 0.0 | 0.22 +Output | 0.26326 | 0.26326 | 0.26326 | 0.0 | 0.40 +Modify | 31.109 | 31.109 | 31.109 | 0.0 | 47.34 +Other | | 1.128 | | | 1.72 + +Nlocal: 2000 ave 2000 max 2000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 15308 ave 15308 max 15308 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 15308 +Ave neighs/atom = 7.654 +Neighbor list builds = 367 +Dangerous builds = 0 + +# remove "plug" - need to redefine cylinder region & union + +region cylreg delete +region hopreg delete +region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 #Bottom & top are open +region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 2 0 10 side in units box open 1 open 2 + +region hopreg union 2 cylreg conereg + +unfix hopper3 +fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg + +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 12.69 | 12.69 | 12.69 Mbytes + Step CPU Atoms KinEng + 170000 0 2000 1.3701579 + 171000 0.54961146 2000 2.3724823 + 172000 1.0905775 2000 3.5881441 + 173000 1.6190656 2000 5.3771633 + 174000 2.1428619 2000 7.5896471 + 175000 2.6623327 2000 10.77251 + 176000 3.1738773 2000 14.806868 + 177000 3.6751053 2000 19.607624 + 178000 4.17465 2000 25.426227 + 179000 4.6736143 2000 32.23584 + 180000 5.1769137 2000 39.930468 + 181000 5.6766809 2000 47.686304 + 182000 6.1722504 2000 56.506806 + 183000 6.6603586 2000 66.514326 + 184000 7.1473381 2000 77.554644 + 185000 7.6343824 2000 89.224002 + 186000 8.1170225 2000 102.07846 + 187000 8.598305 2000 116.08141 + 188000 9.0708108 2000 130.97964 + 189000 9.5435695 2000 146.77806 + 190000 10.015069 2000 162.79858 + 191000 10.480992 2000 179.02052 + 192000 10.941896 2000 196.26683 + 193000 11.398748 2000 214.38928 + 194000 11.856098 2000 232.32068 + 195000 12.314324 2000 251.74644 + 196000 12.765746 2000 272.25231 + 197000 13.216453 2000 294.64075 + 198000 13.663698 2000 318.32895 + 199000 14.109901 2000 342.44005 + 200000 14.560399 2000 368.35469 + 201000 15.008158 2000 395.2465 + 202000 15.460487 2000 422.63599 + 203000 15.913115 2000 450.45248 + 204000 16.363656 2000 479.60812 + 205000 16.816929 2000 510.44155 + 206000 17.265488 2000 543.25751 + 207000 17.707782 2000 577.35928 + 208000 18.151051 2000 612.29718 + 209000 18.588363 2000 647.8951 + 210000 19.027167 2000 683.79409 + 211000 19.463213 2000 720.36556 + 212000 19.901783 2000 759.27331 + 213000 20.340436 2000 798.27302 + 214000 20.775782 2000 837.93849 + 215000 21.207465 2000 877.92945 + 216000 21.641572 2000 919.62532 + 217000 22.077351 2000 962.83509 + 218000 22.517089 2000 1008.5243 + 219000 22.948683 2000 1054.5769 + 220000 23.381029 2000 1103.1843 + 221000 23.809214 2000 1153.0349 + 222000 24.246127 2000 1204.5599 + 223000 24.677676 2000 1257.1367 + 224000 25.113989 2000 1308.6735 +WARNING: Lost atoms: original 2000 current 1999 (../thermo.cpp:486) + 225000 25.549621 1999 1360.1205 + 226000 25.977155 1998 1404.8405 + 227000 26.406475 1996 1448.4869 + 228000 26.832152 1992 1491.8112 + 229000 27.25327 1985 1518.7013 + 230000 27.672907 1971 1507.6699 + 231000 28.086761 1965 1533.5096 + 232000 28.500134 1948 1489.4128 + 233000 28.912212 1933 1477.4536 + 234000 29.320197 1915 1425.8398 + 235000 29.723669 1904 1410.1451 + 236000 30.124339 1892 1401.7595 + 237000 30.523539 1880 1368.893 + 238000 30.919483 1868 1341.8885 + 239000 31.313194 1850 1286.7968 + 240000 31.711659 1833 1219.5123 + 241000 32.106468 1820 1173.3608 + 242000 32.505486 1806 1106.0727 + 243000 32.905579 1788 1035.912 + 244000 33.303155 1779 1021.6147 + 245000 33.696614 1767 969.40032 + 246000 34.083545 1757 939.12022 + 247000 34.472486 1739 840.9396 + 248000 34.858907 1730 822.06575 + 249000 35.248061 1719 762.11057 + 250000 35.639608 1707 708.50308 + 251000 36.029812 1700 692.12647 + 252000 36.428881 1697 694.5812 + 253000 36.821304 1686 652.36951 + 254000 37.203008 1682 662.95256 + 255000 37.576678 1677 637.34619 + 256000 37.952398 1672 630.71277 + 257000 38.336834 1669 641.87365 + 258000 38.719421 1665 635.862 + 259000 39.104236 1664 658.5339 + 260000 39.484223 1662 669.95468 + 261000 39.861203 1660 676.93495 + 262000 40.240183 1657 681.72646 + 263000 40.614974 1655 687.4078 + 264000 40.99447 1651 681.61352 + 265000 41.368018 1647 673.20622 + 266000 41.740288 1644 677.30073 + 267000 42.111704 1641 671.05897 + 268000 42.479868 1639 689.55776 + 269000 42.851008 1637 711.98809 + 270000 43.22438 1633 705.29974 +Loop time of 43.2244 on 1 procs for 100000 steps with 1633 atoms + +99.2% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 22.312 | 22.312 | 22.312 | 0.0 | 51.62 +Neigh | 0.47451 | 0.47451 | 0.47451 | 0.0 | 1.10 +Comm | 0.093822 | 0.093822 | 0.093822 | 0.0 | 0.22 +Output | 0.0028326 | 0.0028326 | 0.0028326 | 0.0 | 0.01 +Modify | 19.626 | 19.626 | 19.626 | 0.0 | 45.40 +Other | | 0.7152 | | | 1.65 + +Nlocal: 1633 ave 1633 max 1633 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 11358 ave 11358 max 11358 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 11358 +Ave neighs/atom = 6.955297 +Neighbor list builds = 244 +Dangerous builds = 0 +Total wall time: 0:01:53 diff --git a/examples/granregion/log.15Sep22.granregion.funnel.g++.4 b/examples/granregion/log.15Sep22.granregion.funnel.g++.4 new file mode 100644 index 0000000000..3c18217deb --- /dev/null +++ b/examples/granregion/log.15Sep22.granregion.funnel.g++.4 @@ -0,0 +1,633 @@ +LAMMPS (15 Sep 2022) +# pour particles into cone-shaped funnel, settle them, let them run out bottom + +variable name string funnel_pour + +thermo_modify flush yes +units si +variable PI equal 3.141592653589 +variable seed equal 14314 + +############################################### +# Geometry-related parameters +############################################### + +variable xlo equal 10 +variable xhi equal 40 +variable ylo equal 10 +variable yhi equal 40 +variable zlo equal -20 +variable zhi equal 50 + +variable xc equal 25 +variable yc equal 25 + +variable zconehi equal 50 +variable zconelo equal 10 +variable zcyllo equal 0 +variable radconelo equal 2 +variable radconehi equal 20 + +################################################ +# Particle sizes +################################################ + +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable skin equal ${rhi} +variable skin equal 0.5 + +############################################### +# Granular contact parameters +############################################### + +variable coeffRes equal 0.1 +variable coeffFric equal 0.5 + +variable density equal 1.0 +variable EYoung equal 10^5 +variable Poisson equal 2.0/7.0 +variable GShear equal ${EYoung}/(2*(1+${Poisson})) +variable GShear equal 100000/(2*(1+${Poisson})) +variable GShear equal 100000/(2*(1+0.285714285714286)) + +variable gravity equal 1.0 + +variable reff equal 0.5*(${rhi}+${rlo}) +variable reff equal 0.5*(0.5+${rlo}) +variable reff equal 0.5*(0.5+0.25) +variable meff equal ${density}*4.0/3.0*${PI}*${reff}^3 +variable meff equal 1*4.0/3.0*${PI}*${reff}^3 +variable meff equal 1*4.0/3.0*3.141592653589*${reff}^3 +variable meff equal 1*4.0/3.0*3.141592653589*0.375^3 +variable min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*${rlo} +variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*0.25 +variable max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*${rhi}*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*${rhi}*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*${rhi} +variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*0.5 + +## Typical way to set kn, kt, etc.: +variable kn equal 4.0*${GShear}/(3*(1-${Poisson})) +variable kn equal 4.0*38888.8888888889/(3*(1-${Poisson})) +variable kn equal 4.0*38888.8888888889/(3*(1-0.285714285714286)) +variable kt equal 4.0*${GShear}/(2-${Poisson}) +variable kt equal 4.0*38888.8888888889/(2-${Poisson}) +variable kt equal 4.0*38888.8888888889/(2-0.285714285714286) + +variable a equal (-2.0*log(${coeffRes})/${PI})^2 +variable a equal (-2.0*log(0.1)/${PI})^2 +variable a equal (-2.0*log(0.1)/3.141592653589)^2 +variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*0.405284734569556)) +variable gamma_t equal ${gamma_n}*0.5 +variable gamma_t equal 903.503751814138*0.5 + +variable tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/${min_mass}-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-${gamma_n}/4.0) +variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-903.503751814138/4.0) + +variable dt equal ${tcol}*0.05 +variable dt equal 0.00210943016014969*0.05 +timestep ${dt} +timestep 0.000105471508007485 + +############################################### +variable dumpfreq equal 1000 +variable logfreq equal 1000 + +newton off +atom_style sphere + +boundary p p f + +region boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} +region boxreg block 10 ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} +region boxreg block 10 40 ${ylo} ${yhi} ${zlo} ${zhi} +region boxreg block 10 40 10 ${yhi} ${zlo} ${zhi} +region boxreg block 10 40 10 40 ${zlo} ${zhi} +region boxreg block 10 40 10 40 -20 ${zhi} +region boxreg block 10 40 10 40 -20 50 +create_box 1 boxreg +Created orthogonal box = (10 10 -20) to (40 40 50) + 1 by 1 by 4 MPI processor grid + +pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 +pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 +pair_coeff * * + +neighbor ${skin} multi +neighbor 0.5 multi +thermo ${logfreq} +thermo 1000 + +comm_style brick +comm_modify mode multi group all vel yes +balance 1.1 shift xyz 20 1.1 +Balancing ... +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0 + ghost atom cutoff = 0 + binsize = 30, bins = 1 1 3 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hertz/history, perpetual + attributes: half, newton off, size, history + pair build: half/size/multi/newtoff + stencil: full/multi/3d + bin: multi +WARNING: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. (../comm_brick.cpp:210) +fix bal all balance 10000 1.1 shift xyz 20 1.01 + +####################### Options specific to pouring ######################### + +# insertion region for fix/pour + +region insreg cylinder z ${xc} ${yc} 10 30 50 side in units box +region insreg cylinder z 25 ${yc} 10 30 50 side in units box +region insreg cylinder z 25 25 10 30 50 side in units box + +# define cone and cylinder regions - see lammps doc on region command +# note new open options + +region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 #Top is open +region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 2 +region cylreg cylinder z 25 25 2 0 10 side in units box open 2 + +region conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 #Bottom and top are open +region conereg cone z 25 ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 20 ${zconelo} ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 20 10 ${zconehi} side in units box open 1 open 2 +region conereg cone z 25 25 2 20 10 50 side in units box open 1 open 2 + +region hopreg union 2 conereg cylreg + +fix grav all gravity ${gravity} vector 0 0 -1 +fix grav all gravity 1 vector 0 0 -1 +fix 1 all nve/sphere + + +fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg + +fix ins all pour 2000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 ${dhi} dens ${density} ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens ${density} ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 ${density} +fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 3000 every 59965 steps, 2000 by step 1 + +#dump 1 all custom ${dumpfreq} ${name}.dump # id type mass diameter x y z + +#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 3.0 # box no 0.0 axes no 0.0 0.0 +#dump_modify 2 pad 6 + +thermo_style custom step cpu atoms ke +WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:896) +thermo_modify flush yes lost warn + +# Initial run to fill up the cone + +run 20000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- neighbor multi command: doi:10.1016/j.cpc.2008.03.005, doi:10.1007/s40571-020-00361-2 + +@Article{Intveld08, + author = {in 't Veld, P. J. and S. J.~Plimpton and G. S. Grest}, + title = {Accurate and Efficient Methods for Modeling Colloidal + Mixtures in an Explicit Solvent using Molecular Dynamics}, + journal = {Comput.\ Phys.\ Commut.}, + year = 2008, + volume = 179, + pages = {320--329} +} + +@article{Shire2020, + author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin}, + title = {{DEM} Simulations of Polydisperse Media: Efficient Contact + Detection Applied to Investigate the Quasi-Static Limit}, + journal = {Computational Particle Mechanics}, + year = {2020} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.049 | 6.049 | 6.049 Mbytes + Step CPU Atoms KinEng + 0 0 0 -0 + 1000 0.4194951 2000 -0 + 2000 0.61516729 2000 -0 + 3000 0.80702516 2000 -0 + 4000 0.99253349 2000 -0 + 5000 1.172741 2000 -0 + 6000 1.3484682 2000 -0 + 7000 1.5206253 2000 -0 + 8000 1.6875025 2000 -0 + 9000 1.8503087 2000 -0 + 10000 2.0125622 2000 -0 + 11000 2.0890872 2000 -0 + 12000 2.1663582 2000 -0 + 13000 2.2430386 2000 -0 + 14000 2.320045 2000 -0 + 15000 2.3989769 2000 -0 + 16000 2.4824747 2000 -0 + 17000 2.5693391 2000 -0 + 18000 2.6595183 2000 -0 + 19000 2.752627 2000 -0 + 20000 2.8503071 2000 -0 +Loop time of 2.85034 on 4 procs for 20000 steps with 2000 atoms + +98.0% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.04057 | 0.088166 | 0.18377 | 18.9 | 3.09 +Neigh | 0.0072649 | 0.014273 | 0.025073 | 5.5 | 0.50 +Comm | 0.097843 | 0.19506 | 0.29871 | 19.9 | 6.84 +Output | 0.00099986 | 0.0018246 | 0.0023299 | 1.2 | 0.06 +Modify | 0.68567 | 1.1174 | 1.9527 | 46.8 | 39.20 +Other | | 1.434 | | | 50.30 + +Nlocal: 500 ave 510 max 493 min +Histogram: 1 1 0 0 0 1 0 0 0 1 +Nghost: 154 ave 227 max 79 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Neighs: 415.5 ave 610 max 258 min +Histogram: 1 1 0 0 0 0 1 0 0 1 + +Total # of neighbors = 1662 +Ave neighs/atom = 0.831 +Neighbor list builds = 71 +Dangerous builds = 0 +unfix ins +run 150000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 12.33 | 12.5 | 12.68 Mbytes + Step CPU Atoms KinEng + 20000 0 2000 6652.2957 + 21000 0.069761009 2000 6807.2201 + 22000 0.14277925 2000 6973.9359 + 23000 0.21755553 2000 7142.3648 + 24000 0.29656838 2000 7276.9717 + 25000 0.3791331 2000 7369.4191 + 26000 0.46663378 2000 7497.6526 + 27000 0.55670237 2000 7638.946 + 28000 0.65212555 2000 7780.0339 + 29000 0.75032507 2000 7881.8177 + 30000 0.85580942 2000 7967.2641 + 31000 0.93204785 2000 7994.9273 + 32000 1.0168325 2000 7937.0672 + 33000 1.1081585 2000 7774.0508 + 34000 1.2084122 2000 7591.1511 + 35000 1.3164174 2000 7357.5032 + 36000 1.4326847 2000 7147.3776 + 37000 1.5548919 2000 6980.0719 + 38000 1.6806183 2000 6813.0872 + 39000 1.8171138 2000 6657.0693 + 40000 1.9655069 2000 6505.1155 + 41000 2.0788398 2000 6330.2864 + 42000 2.1972941 2000 6147.8022 + 43000 2.3180177 2000 5932.9244 + 44000 2.4424194 2000 5755.296 + 45000 2.5679759 2000 5511.622 + 46000 2.7042099 2000 5332.3171 + 47000 2.8436403 2000 5162.4926 + 48000 2.983017 2000 5044.5764 + 49000 3.1228322 2000 4901.1141 + 50000 3.2614172 2000 4731.1949 + 51000 3.3835559 2000 4575.418 + 52000 3.5097034 2000 4428.9425 + 53000 3.6438561 2000 4291.7282 + 54000 3.7823058 2000 4154.1885 + 55000 3.9269393 2000 3994.9402 + 56000 4.0761939 2000 3855.5977 + 57000 4.2262191 2000 3672.9504 + 58000 4.3809045 2000 3435.3395 + 59000 4.5439971 2000 3200.7379 + 60000 4.7111867 2000 2986.5411 + 61000 4.8700167 2000 2747.3628 + 62000 5.030656 2000 2542.0805 + 63000 5.1932098 2000 2336.7687 + 64000 5.3585095 2000 2151.6388 + 65000 5.5278279 2000 1933.6773 + 66000 5.7032072 2000 1699.0747 + 67000 5.8804545 2000 1467.7209 + 68000 6.0598984 2000 1227.3577 + 69000 6.2471961 2000 1016.2766 + 70000 6.4413532 2000 812.90843 + 71000 6.615215 2000 632.88108 + 72000 6.7897335 2000 470.67731 + 73000 6.964705 2000 360.47748 + 74000 7.1361808 2000 286.10584 + 75000 7.3068097 2000 229.70386 + 76000 7.4771974 2000 179.62654 + 77000 7.6485358 2000 142.40417 + 78000 7.8200771 2000 113.55745 + 79000 7.9923688 2000 93.787669 + 80000 8.164219 2000 80.646319 + 81000 8.3372059 2000 70.944319 + 82000 8.5130035 2000 59.2275 + 83000 8.6877383 2000 49.633808 + 84000 8.8675712 2000 42.882698 + 85000 9.0509682 2000 36.841824 + 86000 9.2393665 2000 31.776681 + 87000 9.4296116 2000 28.25076 + 88000 9.622196 2000 25.228966 + 89000 9.8176023 2000 22.593627 + 90000 10.01325 2000 21.15796 + 91000 10.204474 2000 19.941629 + 92000 10.399553 2000 18.375654 + 93000 10.596683 2000 17.056701 + 94000 10.796988 2000 16.192511 + 95000 10.998545 2000 15.572922 + 96000 11.200614 2000 14.827788 + 97000 11.402484 2000 13.919613 + 98000 11.606219 2000 13.19525 + 99000 11.81042 2000 11.993376 + 100000 12.018294 2000 11.258787 + 101000 12.223702 2000 10.641688 + 102000 12.432026 2000 10.430435 + 103000 12.640962 2000 9.518069 + 104000 12.849109 2000 9.1332086 + 105000 13.05872 2000 9.2151611 + 106000 13.269956 2000 9.0035132 + 107000 13.481882 2000 8.7835861 + 108000 13.693895 2000 8.5124479 + 109000 13.906381 2000 8.2975453 + 110000 14.120217 2000 8.3483043 + 111000 14.332078 2000 8.4658572 + 112000 14.54349 2000 8.4771784 + 113000 14.755719 2000 7.8937975 + 114000 14.968619 2000 7.2472953 + 115000 15.180485 2000 6.5812074 + 116000 15.394405 2000 5.5651566 + 117000 15.607523 2000 5.3015807 + 118000 15.821873 2000 5.0133941 + 119000 16.035675 2000 4.8746036 + 120000 16.24964 2000 4.9133073 + 121000 16.462102 2000 4.3337392 + 122000 16.676371 2000 4.3374836 + 123000 16.890252 2000 4.3721818 + 124000 17.106594 2000 4.3894508 + 125000 17.321433 2000 4.1811774 + 126000 17.536692 2000 4.3011002 + 127000 17.748238 2000 4.442228 + 128000 17.962609 2000 4.6170394 + 129000 18.175315 2000 4.8184318 + 130000 18.389056 2000 4.8442096 + 131000 18.600872 2000 4.9668117 + 132000 18.81412 2000 4.8364562 + 133000 19.027514 2000 4.6658645 + 134000 19.23975 2000 4.5758487 + 135000 19.451085 2000 4.7251949 + 136000 19.663874 2000 4.5846492 + 137000 19.87624 2000 4.7565986 + 138000 20.088654 2000 4.8186623 + 139000 20.29935 2000 4.6571647 + 140000 20.510911 2000 4.0730143 + 141000 20.722072 2000 4.0605542 + 142000 20.933113 2000 4.1457179 + 143000 21.143916 2000 4.3418042 + 144000 21.353873 2000 4.0323813 + 145000 21.567015 2000 3.8064958 + 146000 21.781334 2000 3.1802044 + 147000 21.996799 2000 2.7947641 + 148000 22.209808 2000 2.7384164 + 149000 22.423177 2000 2.7428829 + 150000 22.638044 2000 2.7802186 + 151000 22.851676 2000 2.6703451 + 152000 23.065354 2000 2.3357647 + 153000 23.278882 2000 1.9855305 + 154000 23.494254 2000 1.9442713 + 155000 23.708192 2000 1.7348027 + 156000 23.923005 2000 1.5699942 + 157000 24.13827 2000 1.5224944 + 158000 24.352068 2000 1.4850914 + 159000 24.565616 2000 1.4461048 + 160000 24.779118 2000 1.3759525 + 161000 24.99111 2000 0.83754463 + 162000 25.205935 2000 0.7952922 + 163000 25.420817 2000 0.69670143 + 164000 25.632672 2000 0.66253723 + 165000 25.846901 2000 0.64602969 + 166000 26.060074 2000 0.60229858 + 167000 26.273714 2000 0.5757589 + 168000 26.484855 2000 0.5996023 + 169000 26.698151 2000 0.62130448 + 170000 26.911208 2000 0.63888277 +Loop time of 26.9112 on 4 procs for 150000 steps with 2000 atoms + +95.1% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 4.5517 | 8.6135 | 10.872 | 82.7 | 32.01 +Neigh | 0.092491 | 0.15402 | 0.19598 | 9.7 | 0.57 +Comm | 2.0054 | 3.8686 | 4.6494 | 55.0 | 14.38 +Output | 0.0047033 | 0.0096766 | 0.016452 | 4.6 | 0.04 +Modify | 5.6498 | 7.9588 | 9.4012 | 49.7 | 29.57 +Other | | 6.307 | | | 23.43 + +Nlocal: 500 ave 538 max 419 min +Histogram: 1 0 0 0 0 0 0 1 0 2 +Nghost: 445.5 ave 688 max 200 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Neighs: 4500.25 ave 5610 max 3443 min +Histogram: 1 0 1 0 0 0 1 0 0 1 + +Total # of neighbors = 18001 +Ave neighs/atom = 9.0005 +Neighbor list builds = 362 +Dangerous builds = 0 + +# remove "plug" - need to redefine cylinder region & union + +region cylreg delete +region hopreg delete +region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 #Bottom & top are open +region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 1 open 2 +region cylreg cylinder z 25 25 2 0 10 side in units box open 1 open 2 + +region hopreg union 2 cylreg conereg + +unfix hopper3 +fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg +fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg + +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 12.34 | 12.53 | 12.68 Mbytes + Step CPU Atoms KinEng + 170000 0 2000 0.63888277 + 171000 0.21419748 2000 1.4139245 + 172000 0.42844271 2000 2.2400138 + 173000 0.64333145 2000 3.8034979 + 174000 0.85456696 2000 6.116727 + 175000 1.0672981 2000 8.9536458 + 176000 1.2790911 2000 12.74348 + 177000 1.491721 2000 17.410816 + 178000 1.7033452 2000 22.879174 + 179000 1.9168047 2000 28.966022 + 180000 2.1329071 2000 35.449239 + 181000 2.3490841 2000 42.694882 + 182000 2.565508 2000 50.913279 + 183000 2.780369 2000 60.098465 + 184000 2.9967771 2000 70.133474 + 185000 3.2116891 2000 80.950013 + 186000 3.4248923 2000 92.495525 + 187000 3.6394206 2000 104.83034 + 188000 3.8527533 2000 118.04659 + 189000 4.0650838 2000 132.7403 + 190000 4.2781031 2000 148.31955 + 191000 4.476226 2000 164.26321 + 192000 4.6750263 2000 180.6933 + 193000 4.8710737 2000 197.72012 + 194000 5.0677642 2000 215.43637 + 195000 5.2639974 2000 234.29738 + 196000 5.4599746 2000 254.03407 + 197000 5.6534894 2000 274.58626 + 198000 5.8462402 2000 296.88915 + 199000 6.0400194 2000 320.45001 + 200000 6.2329415 2000 344.75891 + 201000 6.4235068 2000 370.14016 + 202000 6.6142055 2000 395.72827 + 203000 6.8048206 2000 420.42026 + 204000 6.9987454 2000 446.08079 + 205000 7.1925778 2000 473.62963 + 206000 7.3846227 2000 501.05693 + 207000 7.5775122 2000 530.40427 + 208000 7.77052 2000 560.62015 + 209000 7.964984 2000 593.00113 + 210000 8.1601405 2000 626.36661 + 211000 8.3504978 2000 661.34861 + 212000 8.5425141 2000 697.41001 + 213000 8.736112 2000 735.12299 + 214000 8.9267615 2000 773.89126 + 215000 9.1154738 2000 813.83268 + 216000 9.3019826 2000 854.63669 + 217000 9.4878433 2000 896.59089 + 218000 9.6739682 2000 938.70251 + 219000 9.8566518 2000 982.10773 + 220000 10.042289 2000 1025.2953 + 221000 10.227275 2000 1069.8382 + 222000 10.412363 2000 1115.4449 + 223000 10.602757 2000 1161.6742 + 224000 10.789101 2000 1211.289 + 225000 10.974854 2000 1262.8074 + 226000 11.157089 2000 1316.6353 + 227000 11.337044 2000 1370.7434 +WARNING: Lost atoms: original 2000 current 1991 (../thermo.cpp:486) + 228000 11.518718 1991 1382.0924 + 229000 11.700488 1986 1407.1543 + 230000 11.883057 1975 1415.708 + 231000 12.063962 1968 1430.6498 + 232000 12.246917 1957 1421.0352 + 233000 12.429345 1939 1376.0322 + 234000 12.6113 1925 1350.1292 + 235000 12.791233 1912 1337.0529 + 236000 12.968444 1893 1273.2219 + 237000 13.146668 1879 1207.0473 + 238000 13.327542 1861 1132.0109 + 239000 13.50936 1846 1083.1042 + 240000 13.693504 1826 1004.3265 + 241000 13.863443 1819 989.36186 + 242000 14.03294 1812 983.26132 + 243000 14.20032 1805 985.79932 + 244000 14.366236 1794 936.34844 + 245000 14.532759 1784 889.17423 + 246000 14.703029 1770 846.65018 + 247000 14.873941 1753 751.16306 + 248000 15.045272 1740 709.23095 + 249000 15.217896 1732 687.61586 + 250000 15.388727 1721 638.82967 + 251000 15.558032 1714 618.71543 + 252000 15.725309 1709 611.25444 + 253000 15.888727 1705 606.6846 + 254000 16.050605 1702 601.7236 + 255000 16.212982 1697 575.97244 + 256000 16.378352 1695 577.1712 + 257000 16.547488 1691 576.93668 + 258000 16.718964 1688 586.63687 + 259000 16.892601 1686 581.52487 + 260000 17.066036 1682 566.49544 + 261000 17.22488 1681 586.18628 + 262000 17.379249 1678 582.11927 + 263000 17.534079 1675 589.96041 + 264000 17.690288 1672 577.55581 + 265000 17.847805 1669 570.45998 + 266000 18.006261 1666 574.0576 + 267000 18.1674 1662 578.07385 + 268000 18.326753 1660 587.65705 + 269000 18.488052 1657 584.43358 + 270000 18.647474 1654 591.22601 +Loop time of 18.6475 on 4 procs for 100000 steps with 1654 atoms + +94.4% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.7714 | 6.1879 | 8.8765 | 88.8 | 33.18 +Neigh | 0.094692 | 0.11244 | 0.13298 | 4.6 | 0.60 +Comm | 1.2471 | 2.918 | 3.5873 | 57.0 | 15.65 +Output | 0.0013438 | 0.0067176 | 0.014709 | 6.0 | 0.04 +Modify | 4.4355 | 5.0416 | 5.5692 | 21.9 | 27.04 +Other | | 4.381 | | | 23.49 + +Nlocal: 413.5 ave 429 max 408 min +Histogram: 3 0 0 0 0 0 0 0 0 1 +Nghost: 408.25 ave 653 max 182 min +Histogram: 1 0 0 1 0 1 0 0 0 1 +Neighs: 3486.25 ave 4367 max 2213 min +Histogram: 1 0 0 0 0 1 0 0 1 1 + +Total # of neighbors = 13945 +Ave neighs/atom = 8.4310762 +Neighbor list builds = 227 +Dangerous builds = 0 +Total wall time: 0:00:48 diff --git a/examples/granregion/log.15Sep22.granregion.mixer.g++.1 b/examples/granregion/log.15Sep22.granregion.mixer.g++.1 new file mode 100644 index 0000000000..2a3402c642 --- /dev/null +++ b/examples/granregion/log.15Sep22.granregion.mixer.g++.1 @@ -0,0 +1,632 @@ +LAMMPS (15 Sep 2022) +variable name string mixer + +thermo_modify flush yes +variable seed equal 14314 + +############################################### +# Particle parameters +################################################ + +variable rlo equal 0.3 +variable rhi equal 0.6 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.3 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.6 +variable skin equal ${rhi} +variable skin equal 0.6 + +variable coeffRes equal 0.1 +variable coeffFric equal 0.5 + +variable kn equal 10^5 +variable kt equal 0.2*${kn} +variable kt equal 0.2*100000 + +variable gravity equal 1.0 +variable density equal 1.0 + +variable min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*PI*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*PI*0.3*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*${rlo} +variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*0.3 +variable a equal (-2.0*log(${coeffRes})/PI)^2 +variable a equal (-2.0*log(0.1)/PI)^2 +variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*100000/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*0.405284734569351)) +variable gamma_t equal ${gamma_n}*0.5 +variable gamma_t equal 806.699778405191*0.5 + +variable tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) +variable tcol equal PI/sqrt(2*100000/${min_mass}-${gamma_n}/4.0) +variable tcol equal PI/sqrt(2*100000/0.113097335529233-${gamma_n}/4.0) +variable tcol equal PI/sqrt(2*100000/0.113097335529233-806.699778405191/4.0) + +variable dt equal ${tcol}*0.02 +variable dt equal 0.00236257621510454*0.02 +timestep ${dt} +timestep 4.72515243020908e-05 + +############################################### + +variable dumpfreq equal 1000 +variable logfreq equal 1000 + +newton on +atom_style sphere + +boundary p p f + +region boxreg block 0 20 0 20 0 20 +create_box 1 boxreg +Created orthogonal box = (0 0 0) to (20 20 20) + 1 by 1 by 1 MPI processor grid + +pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 +pair_coeff * * + +neighbor ${skin} multi +neighbor 0.6 multi +thermo ${logfreq} +thermo 1000 + +comm_style brick +comm_modify mode multi group all vel yes +balance 1.1 shift xyz 20 1.1 +Balancing ... +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0 + ghost atom cutoff = 0 + binsize = 20, bins = 1 1 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hertz/history, perpetual + attributes: half, newton on, size, history + pair build: half/size/multi/newton + stencil: half/multi/3d + bin: multi +WARNING: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. (../comm_brick.cpp:210) +fix bal all balance 10000 1.1 shift xyz 20 1.01 + +####################### Options specific to pouring ######################### + +region insreg cylinder z 10 10 8 10 18 side in units box +region cylreg cylinder z 10 10 10 0 20 side in units box + +variable theta equal (step/400000)*2*PI + +region b1 block 2 18 9 11 0 4 side out rotate v_theta 10 10 0 0 0 1 units box +region b2 block 9 11 2 18 0 3.99999 side out rotate v_theta 10 10 0 0 0 1 units box + +region mixer intersect 3 cylreg b1 b2 side in + +fix grav all gravity ${gravity} vector 0 0 -1 +fix grav all gravity 1 vector 0 0 -1 +fix 1 all nve/sphere + +fix mixwall all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 region mixer + +fix ins all pour 1000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 ${dhi} dens ${density} ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens ${density} ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 1 +Particle insertion: 444 every 84653 steps, 1000 by step 169307 + +#dump 1 all custom ${dumpfreq} ${name}_pour.dump # id type mass diameter x y z + +#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 1.5 # box no 0.0 axes no 0.0 0.0 +#dump_modify 2 pad 6 + +thermo_style custom step cpu atoms ke v_theta +WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:896) +thermo_modify flush yes lost warn + +run 200000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- neighbor multi command: doi:10.1016/j.cpc.2008.03.005, doi:10.1007/s40571-020-00361-2 + +@Article{Intveld08, + author = {in 't Veld, P. J. and S. J.~Plimpton and G. S. Grest}, + title = {Accurate and Efficient Methods for Modeling Colloidal + Mixtures in an Explicit Solvent using Molecular Dynamics}, + journal = {Comput.\ Phys.\ Commut.}, + year = 2008, + volume = 179, + pages = {320--329} +} + +@article{Shire2020, + author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin}, + title = {{DEM} Simulations of Polydisperse Media: Efficient Contact + Detection Applied to Investigate the Quasi-Static Limit}, + journal = {Computational Particle Mechanics}, + year = {2020} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.861 | 5.861 | 5.861 Mbytes + Step CPU Atoms KinEng v_theta + 0 0 0 -0 0 + 1000 0.10672296 444 -0 0.015707963 + 2000 0.2090638 444 -0 0.031415927 + 3000 0.31029663 444 -0 0.04712389 + 4000 0.41047624 444 -0 0.062831853 + 5000 0.51132361 444 -0 0.078539816 + 6000 0.61279172 444 -0 0.09424778 + 7000 0.71396622 444 -0 0.10995574 + 8000 0.81644319 444 -0 0.12566371 + 9000 0.91730959 444 -0 0.14137167 + 10000 1.0181635 444 -0 0.15707963 + 11000 1.1182214 444 -0 0.1727876 + 12000 1.2190013 444 -0 0.18849556 + 13000 1.3196138 444 -0 0.20420352 + 14000 1.4183593 444 -0 0.21991149 + 15000 1.5178458 444 -0 0.23561945 + 16000 1.6169535 444 -0 0.25132741 + 17000 1.7219188 444 -0 0.26703538 + 18000 1.8266303 444 -0 0.28274334 + 19000 1.9331589 444 -0 0.2984513 + 20000 2.0392693 444 -0 0.31415927 + 21000 2.1457521 444 -0 0.32986723 + 22000 2.2507526 444 -0 0.34557519 + 23000 2.3548243 444 -0 0.36128316 + 24000 2.4606335 444 -0 0.37699112 + 25000 2.5657643 444 -0 0.39269908 + 26000 2.6698254 444 -0 0.40840704 + 27000 2.7732221 444 -0 0.42411501 + 28000 2.8766441 444 -0 0.43982297 + 29000 2.9801547 444 -0 0.45553093 + 30000 3.0839748 444 -0 0.4712389 + 31000 3.1880063 444 -0 0.48694686 + 32000 3.2923439 444 -0 0.50265482 + 33000 3.3969501 444 -0 0.51836279 + 34000 3.5012646 444 -0 0.53407075 + 35000 3.6057831 444 -0 0.54977871 + 36000 3.7098273 444 -0 0.56548668 + 37000 3.8146061 444 -0 0.58119464 + 38000 3.9215588 444 -0 0.5969026 + 39000 4.0474026 444 -0 0.61261057 + 40000 4.1544945 444 -0 0.62831853 + 41000 4.2605761 444 -0 0.64402649 + 42000 4.3665287 444 -0 0.65973446 + 43000 4.4728216 444 -0 0.67544242 + 44000 4.5782483 444 -0 0.69115038 + 45000 4.6833043 444 -0 0.70685835 + 46000 4.7902207 444 -0 0.72256631 + 47000 4.8968527 444 -0 0.73827427 + 48000 5.0035027 444 -0 0.75398224 + 49000 5.1117191 444 -0 0.7696902 + 50000 5.2186233 444 -0 0.78539816 + 51000 5.3244005 444 -0 0.80110613 + 52000 5.4316153 444 -0 0.81681409 + 53000 5.5381785 444 -0 0.83252205 + 54000 5.6458179 444 -0 0.84823002 + 55000 5.759203 444 -0 0.86393798 + 56000 5.8779849 444 -0 0.87964594 + 57000 5.9953108 444 -0 0.89535391 + 58000 6.1115532 444 -0 0.91106187 + 59000 6.2298342 444 -0 0.92676983 + 60000 6.3474382 444 -0 0.9424778 + 61000 6.4642217 444 -0 0.95818576 + 62000 6.5815141 444 -0 0.97389372 + 63000 6.6999766 444 -0 0.98960169 + 64000 6.8181369 444 -0 1.0053096 + 65000 6.9368124 444 -0 1.0210176 + 66000 7.0560733 444 -0 1.0367256 + 67000 7.1761749 444 -0 1.0524335 + 68000 7.2942246 444 -0 1.0681415 + 69000 7.4146786 444 -0 1.0838495 + 70000 7.5364025 444 -0 1.0995574 + 71000 7.6565177 444 -0 1.1152654 + 72000 7.7776652 444 -0 1.1309734 + 73000 7.8972494 444 -0 1.1466813 + 74000 8.0183599 444 -0 1.1623893 + 75000 8.1423045 444 -0 1.1780972 + 76000 8.2667013 444 -0 1.1938052 + 77000 8.3876604 444 -0 1.2095132 + 78000 8.5095993 444 -0 1.2252211 + 79000 8.6317663 444 -0 1.2409291 + 80000 8.7562108 444 -0 1.2566371 + 81000 8.8812625 444 -0 1.272345 + 82000 9.006825 444 -0 1.288053 + 83000 9.1310939 444 -0 1.303761 + 84000 9.2540049 444 -0 1.3194689 + 85000 9.4210019 888 -0 1.3351769 + 86000 9.6509014 888 -0 1.3508848 + 87000 9.8827304 888 -0 1.3665928 + 88000 10.113857 888 -0 1.3823008 + 89000 10.34324 888 -0 1.3980087 + 90000 10.574203 888 -0 1.4137167 + 91000 10.806069 888 -0 1.4294247 + 92000 11.037044 888 -0 1.4451326 + 93000 11.262596 888 -0 1.4608406 + 94000 11.490532 888 -0 1.4765485 + 95000 11.716452 888 -0 1.4922565 + 96000 11.943883 888 -0 1.5079645 + 97000 12.171353 888 -0 1.5236724 + 98000 12.396787 888 -0 1.5393804 + 99000 12.623788 888 -0 1.5550884 + 100000 12.849633 888 -0 1.5707963 + 101000 13.082904 888 -0 1.5865043 + 102000 13.316986 888 -0 1.6022123 + 103000 13.54777 888 -0 1.6179202 + 104000 13.77928 888 -0 1.6336282 + 105000 14.014818 888 -0 1.6493361 + 106000 14.250986 888 -0 1.6650441 + 107000 14.485754 888 -0 1.6807521 + 108000 14.720106 888 -0 1.69646 + 109000 14.970869 888 -0 1.712168 + 110000 15.219203 888 -0 1.727876 + 111000 15.469876 888 -0 1.7435839 + 112000 15.721351 888 -0 1.7592919 + 113000 15.972099 888 -0 1.7749998 + 114000 16.222357 888 -0 1.7907078 + 115000 16.474863 888 -0 1.8064158 + 116000 16.725352 888 -0 1.8221237 + 117000 16.979634 888 -0 1.8378317 + 118000 17.231379 888 -0 1.8535397 + 119000 17.483691 888 -0 1.8692476 + 120000 17.737897 888 -0 1.8849556 + 121000 17.991241 888 -0 1.9006636 + 122000 18.245626 888 -0 1.9163715 + 123000 18.499984 888 -0 1.9320795 + 124000 18.754367 888 -0 1.9477874 + 125000 19.006448 888 -0 1.9634954 + 126000 19.260545 888 -0 1.9792034 + 127000 19.513633 888 -0 1.9949113 + 128000 19.769389 888 -0 2.0106193 + 129000 20.025088 888 -0 2.0263273 + 130000 20.277534 888 -0 2.0420352 + 131000 20.529284 888 -0 2.0577432 + 132000 20.785132 888 -0 2.0734512 + 133000 21.038442 888 -0 2.0891591 + 134000 21.293932 888 -0 2.1048671 + 135000 21.545354 888 -0 2.120575 + 136000 21.799547 888 -0 2.136283 + 137000 22.053639 888 -0 2.151991 + 138000 22.310106 888 -0 2.1676989 + 139000 22.569362 888 -0 2.1834069 + 140000 22.829416 888 -0 2.1991149 + 141000 23.089132 888 -0 2.2148228 + 142000 23.345737 888 -0 2.2305308 + 143000 23.60621 888 -0 2.2462387 + 144000 23.867414 888 -0 2.2619467 + 145000 24.132954 888 -0 2.2776547 + 146000 24.39395 888 -0 2.2933626 + 147000 24.657881 888 -0 2.3090706 + 148000 24.918563 888 -0 2.3247786 + 149000 25.177446 888 -0 2.3404865 + 150000 25.446598 888 -0 2.3561945 + 151000 25.715494 888 -0 2.3719025 + 152000 25.985991 888 -0 2.3876104 + 153000 26.256676 888 -0 2.4033184 + 154000 26.525639 888 -0 2.4190263 + 155000 26.82656 888 -0 2.4347343 + 156000 27.157272 888 -0 2.4504423 + 157000 27.481755 888 -0 2.4661502 + 158000 27.80198 888 -0 2.4818582 + 159000 28.123258 888 -0 2.4975662 + 160000 28.437502 888 -0 2.5132741 + 161000 28.756496 888 -0 2.5289821 + 162000 29.080609 888 -0 2.54469 + 163000 29.399252 888 -0 2.560398 + 164000 29.718986 888 -0 2.576106 + 165000 30.045206 888 -0 2.5918139 + 166000 30.365168 888 -0 2.6075219 + 167000 30.684007 888 -0 2.6232299 + 168000 31.006154 888 -0 2.6389378 + 169000 31.330336 888 -0 2.6546458 + 170000 31.681761 1000 -0 2.6703538 + 171000 32.049778 1000 -0 2.6860617 + 172000 32.421067 1000 -0 2.7017697 + 173000 32.79935 1000 -0 2.7174776 + 174000 33.178002 1000 -0 2.7331856 + 175000 33.54236 1000 -0 2.7488936 + 176000 33.904734 1000 -0 2.7646015 + 177000 34.269671 1000 -0 2.7803095 + 178000 34.633106 1000 -0 2.7960175 + 179000 35.001441 1000 -0 2.8117254 + 180000 35.374769 1000 -0 2.8274334 + 181000 35.742362 1000 -0 2.8431414 + 182000 36.115908 1000 -0 2.8588493 + 183000 36.490149 1000 -0 2.8745573 + 184000 36.866289 1000 -0 2.8902652 + 185000 37.252911 1000 -0 2.9059732 + 186000 37.644586 1000 -0 2.9216812 + 187000 38.028002 1000 -0 2.9373891 + 188000 38.40724 1000 -0 2.9530971 + 189000 38.77431 1000 -0 2.9688051 + 190000 39.14138 1000 -0 2.984513 + 191000 39.519083 1000 -0 3.000221 + 192000 39.895243 1000 -0 3.0159289 + 193000 40.237532 1000 -0 3.0316369 + 194000 40.587663 1000 -0 3.0473449 + 195000 40.939032 1000 -0 3.0630528 + 196000 41.290257 1000 -0 3.0787608 + 197000 41.643778 1000 -0 3.0944688 + 198000 41.992818 1000 -0 3.1101767 + 199000 42.335934 1000 -0 3.1258847 + 200000 42.681071 1000 -0 3.1415927 +Loop time of 42.6811 on 1 procs for 200000 steps with 1000 atoms + +Performance: 19130.397 tau/day, 4685.915 timesteps/s, 4.686 Matom-step/s +98.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.6365 | 2.6365 | 2.6365 | 0.0 | 6.18 +Neigh | 0.051681 | 0.051681 | 0.051681 | 0.0 | 0.12 +Comm | 0.52007 | 0.52007 | 0.52007 | 0.0 | 1.22 +Output | 0.02209 | 0.02209 | 0.02209 | 0.0 | 0.05 +Modify | 38.71 | 38.71 | 38.71 | 0.0 | 90.70 +Other | | 0.7407 | | | 1.74 + +Nlocal: 1000 ave 1000 max 1000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 183 ave 183 max 183 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3757 ave 3757 max 3757 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 3757 +Ave neighs/atom = 3.757 +Neighbor list builds = 200 +Dangerous builds = 0 +unfix ins +run 200000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 11.89 | 11.89 | 11.89 Mbytes + Step CPU Atoms KinEng v_theta + 200000 0 1000 1.0515941 3.1415927 + 201000 0.35477257 1000 1.0348185 3.1573006 + 202000 0.71436123 1000 1.0220859 3.1730086 + 203000 1.0642832 1000 1.0225785 3.1887165 + 204000 1.4165213 1000 1.0206121 3.2044245 + 205000 1.7728133 1000 1.009961 3.2201325 + 206000 2.1279101 1000 0.9993323 3.2358404 + 207000 2.480623 1000 0.99602628 3.2515484 + 208000 2.8321106 1000 0.98341818 3.2672564 + 209000 3.2138945 1000 0.96700718 3.2829643 + 210000 3.5921146 1000 0.95226699 3.2986723 + 211000 3.9643569 1000 0.93911691 3.3143802 + 212000 4.3368151 1000 0.92920029 3.3300882 + 213000 4.7130192 1000 0.91893472 3.3457962 + 214000 5.0881313 1000 0.90873324 3.3615041 + 215000 5.4660106 1000 0.88925817 3.3772121 + 216000 5.8455926 1000 0.89108236 3.3929201 + 217000 6.2204827 1000 0.90176711 3.408628 + 218000 6.6046736 1000 0.90149435 3.424336 + 219000 6.9931145 1000 0.89629307 3.440044 + 220000 7.3771565 1000 0.90390589 3.4557519 + 221000 7.7635603 1000 0.87858148 3.4714599 + 222000 8.1502771 1000 0.88862314 3.4871678 + 223000 8.5393557 1000 0.90394098 3.5028758 + 224000 8.9327212 1000 0.91005462 3.5185838 + 225000 9.315331 1000 0.91753865 3.5342917 + 226000 9.6930994 1000 0.91741233 3.5499997 + 227000 10.077148 1000 0.9041879 3.5657077 + 228000 10.463223 1000 0.9085712 3.5814156 + 229000 10.850271 1000 0.8937854 3.5971236 + 230000 11.230235 1000 0.88740571 3.6128316 + 231000 11.61003 1000 0.88350028 3.6285395 + 232000 11.988134 1000 0.88344474 3.6442475 + 233000 12.365856 1000 0.88003311 3.6599554 + 234000 12.745397 1000 0.87416727 3.6756634 + 235000 13.120344 1000 0.86154585 3.6913714 + 236000 13.489521 1000 0.85705071 3.7070793 + 237000 13.858736 1000 0.85297378 3.7227873 + 238000 14.230242 1000 0.84879486 3.7384953 + 239000 14.609692 1000 0.86978407 3.7542032 + 240000 14.998899 1000 0.86758733 3.7699112 + 241000 15.40773 1000 0.86123097 3.7856191 + 242000 15.81537 1000 0.86088136 3.8013271 + 243000 16.221448 1000 0.85270311 3.8170351 + 244000 16.619008 1000 0.8524395 3.832743 + 245000 17.003986 1000 0.84054009 3.848451 + 246000 17.380362 1000 0.82623612 3.864159 + 247000 17.756477 1000 0.82787746 3.8798669 + 248000 18.136456 1000 0.83027177 3.8955749 + 249000 18.521277 1000 0.83307565 3.9112829 + 250000 18.906407 1000 0.82612362 3.9269908 + 251000 19.28348 1000 0.8404639 3.9426988 + 252000 19.66549 1000 0.83550946 3.9584067 + 253000 20.053842 1000 0.81516472 3.9741147 + 254000 20.451357 1000 0.79127421 3.9898227 + 255000 20.844416 1000 0.78373024 4.0055306 + 256000 21.228637 1000 0.79885661 4.0212386 + 257000 21.613641 1000 0.80322118 4.0369466 + 258000 21.99162 1000 0.79861523 4.0526545 + 259000 22.367158 1000 0.79216962 4.0683625 + 260000 22.746158 1000 0.79543097 4.0840704 + 261000 23.125626 1000 0.79394211 4.0997784 + 262000 23.504282 1000 0.79269346 4.1154864 + 263000 23.883609 1000 0.80022854 4.1311943 + 264000 24.261864 1000 0.79885184 4.1469023 + 265000 24.639269 1000 0.79595018 4.1626103 + 266000 25.016335 1000 0.78191184 4.1783182 + 267000 25.389754 1000 0.76329279 4.1940262 + 268000 25.762053 1000 0.7342663 4.2097342 + 269000 26.133966 1000 0.72303366 4.2254421 + 270000 26.511157 1000 0.70016481 4.2411501 + 271000 26.888842 1000 0.68891731 4.256858 + 272000 27.26804 1000 0.68545775 4.272566 + 273000 27.644067 1000 0.68712156 4.288274 + 274000 28.024704 1000 0.69249813 4.3039819 + 275000 28.404842 1000 0.70187847 4.3196899 + 276000 28.785799 1000 0.70679419 4.3353979 + 277000 29.165857 1000 0.70955357 4.3511058 + 278000 29.545291 1000 0.70183408 4.3668138 + 279000 29.926113 1000 0.69979273 4.3825218 + 280000 30.302095 1000 0.70822139 4.3982297 + 281000 30.684406 1000 0.71629209 4.4139377 + 282000 31.065873 1000 0.73094905 4.4296456 + 283000 31.445972 1000 0.74554115 4.4453536 + 284000 31.828184 1000 0.74390104 4.4610616 + 285000 32.207807 1000 0.74675359 4.4767695 + 286000 32.58802 1000 0.75330713 4.4924775 + 287000 32.964457 1000 0.75525926 4.5081855 + 288000 33.343222 1000 0.75174884 4.5238934 + 289000 33.717663 1000 0.74062375 4.5396014 + 290000 34.094722 1000 0.72784613 4.5553093 + 291000 34.46982 1000 0.72151574 4.5710173 + 292000 34.843777 1000 0.71712409 4.5867253 + 293000 35.208307 1000 0.71803758 4.6024332 + 294000 35.576207 1000 0.71002715 4.6181412 + 295000 35.942972 1000 0.7070911 4.6338492 + 296000 36.3107 1000 0.71082175 4.6495571 + 297000 36.682044 1000 0.70438977 4.6652651 + 298000 37.054664 1000 0.70240345 4.6809731 + 299000 37.424717 1000 0.70525357 4.696681 + 300000 37.796148 1000 0.70636846 4.712389 + 301000 38.166828 1000 0.70443346 4.7280969 + 302000 38.538428 1000 0.71187973 4.7438049 + 303000 38.907221 1000 0.71047139 4.7595129 + 304000 39.280263 1000 0.71405925 4.7752208 + 305000 39.652902 1000 0.71277063 4.7909288 + 306000 40.02752 1000 0.72005331 4.8066368 + 307000 40.402955 1000 0.72466112 4.8223447 + 308000 40.784177 1000 0.72001329 4.8380527 + 309000 41.173226 1000 0.70611982 4.8537606 + 310000 41.559195 1000 0.70810918 4.8694686 + 311000 41.946697 1000 0.70377166 4.8851766 + 312000 42.337059 1000 0.70434458 4.9008845 + 313000 42.728304 1000 0.70707385 4.9165925 + 314000 43.120803 1000 0.71412995 4.9323005 + 315000 43.510705 1000 0.72228946 4.9480084 + 316000 43.901867 1000 0.72715835 4.9637164 + 317000 44.295667 1000 0.73833476 4.9794244 + 318000 44.687503 1000 0.75953014 4.9951323 + 319000 45.077121 1000 0.76413836 5.0108403 + 320000 45.465317 1000 0.76745045 5.0265482 + 321000 45.86931 1000 0.75813288 5.0422562 + 322000 46.277029 1000 0.75324661 5.0579642 + 323000 46.680799 1000 0.75004276 5.0736721 + 324000 47.082361 1000 0.74316264 5.0893801 + 325000 47.481252 1000 0.74087383 5.1050881 + 326000 47.87511 1000 0.73244882 5.120796 + 327000 48.274582 1000 0.73096631 5.136504 + 328000 48.671718 1000 0.72955403 5.152212 + 329000 49.066335 1000 0.73464916 5.1679199 + 330000 49.459765 1000 0.73130257 5.1836279 + 331000 49.850698 1000 0.73008711 5.1993358 + 332000 50.241012 1000 0.72561074 5.2150438 + 333000 50.643245 1000 0.7214495 5.2307518 + 334000 51.039153 1000 0.71274232 5.2464597 + 335000 51.430328 1000 0.71335777 5.2621677 + 336000 51.819148 1000 0.71317423 5.2778757 + 337000 52.202763 1000 0.70965743 5.2935836 + 338000 52.585061 1000 0.69648518 5.3092916 + 339000 52.967678 1000 0.68985842 5.3249995 + 340000 53.351472 1000 0.6846783 5.3407075 + 341000 53.737731 1000 0.69031602 5.3564155 + 342000 54.131413 1000 0.69035259 5.3721234 + 343000 54.526384 1000 0.69843983 5.3878314 + 344000 54.921609 1000 0.69566088 5.4035394 + 345000 55.314258 1000 0.68309182 5.4192473 + 346000 55.701119 1000 0.68360919 5.4349553 + 347000 56.088194 1000 0.68034628 5.4506633 + 348000 56.467878 1000 0.67155093 5.4663712 + 349000 56.857709 1000 0.66504603 5.4820792 + 350000 57.250758 1000 0.66533658 5.4977871 + 351000 57.643438 1000 0.67726804 5.5134951 + 352000 58.04256 1000 0.68880987 5.5292031 + 353000 58.437369 1000 0.71377276 5.544911 + 354000 58.832421 1000 0.71715625 5.560619 + 355000 59.222221 1000 0.71729576 5.576327 + 356000 59.621431 1000 0.71088872 5.5920349 + 357000 60.013262 1000 0.70564615 5.6077429 + 358000 60.406494 1000 0.69291739 5.6234508 + 359000 60.800632 1000 0.68237469 5.6391588 + 360000 61.195364 1000 0.69105856 5.6548668 + 361000 61.588291 1000 0.69563351 5.6705747 + 362000 61.984821 1000 0.69762747 5.6862827 + 363000 62.377158 1000 0.69717346 5.7019907 + 364000 62.77604 1000 0.69413964 5.7176986 + 365000 63.165863 1000 0.68584257 5.7334066 + 366000 63.5503 1000 0.67653762 5.7491146 + 367000 63.930717 1000 0.66880284 5.7648225 + 368000 64.313698 1000 0.66024732 5.7805305 + 369000 64.708193 1000 0.65451701 5.7962384 + 370000 65.10142 1000 0.64352268 5.8119464 + 371000 65.49169 1000 0.63715296 5.8276544 + 372000 65.879115 1000 0.63840106 5.8433623 + 373000 66.268258 1000 0.64537192 5.8590703 + 374000 66.661807 1000 0.64498753 5.8747783 + 375000 67.052521 1000 0.64666103 5.8904862 + 376000 67.443168 1000 0.65957055 5.9061942 + 377000 67.835892 1000 0.65964257 5.9219022 + 378000 68.229282 1000 0.65720396 5.9376101 + 379000 68.623557 1000 0.66304265 5.9533181 + 380000 69.015967 1000 0.67465814 5.969026 + 381000 69.408981 1000 0.68582945 5.984734 + 382000 69.796561 1000 0.69516677 6.000442 + 383000 70.186403 1000 0.69835516 6.0161499 + 384000 70.5765 1000 0.70403284 6.0318579 + 385000 70.966205 1000 0.6955862 6.0475659 + 386000 71.360054 1000 0.704932 6.0632738 + 387000 71.757912 1000 0.71954173 6.0789818 + 388000 72.147544 1000 0.72347529 6.0946897 + 389000 72.535029 1000 0.72738907 6.1103977 + 390000 72.925842 1000 0.74783091 6.1261057 + 391000 73.306871 1000 0.76739039 6.1418136 + 392000 73.692746 1000 0.77184224 6.1575216 + 393000 74.053385 1000 0.76813357 6.1732296 + 394000 74.416323 1000 0.75994091 6.1889375 + 395000 74.777021 1000 0.74970188 6.2046455 + 396000 75.139847 1000 0.7523174 6.2203535 + 397000 75.502888 1000 0.74652931 6.2360614 + 398000 75.865442 1000 0.74418096 6.2517694 + 399000 76.225245 1000 0.75110038 6.2674773 + 400000 76.590032 1000 0.7609274 6.2831853 +Loop time of 76.5901 on 1 procs for 200000 steps with 1000 atoms + +Performance: 10660.735 tau/day, 2611.305 timesteps/s, 2.611 Matom-step/s +99.0% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 8.693 | 8.693 | 8.693 | 0.0 | 11.35 +Neigh | 0.082655 | 0.082655 | 0.082655 | 0.0 | 0.11 +Comm | 1.1618 | 1.1618 | 1.1618 | 0.0 | 1.52 +Output | 0.0052644 | 0.0052644 | 0.0052644 | 0.0 | 0.01 +Modify | 65.713 | 65.713 | 65.713 | 0.0 | 85.80 +Other | | 0.934 | | | 1.22 + +Nlocal: 1000 ave 1000 max 1000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 268 ave 268 max 268 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 5015 ave 5015 max 5015 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 5015 +Ave neighs/atom = 5.015 +Neighbor list builds = 163 +Dangerous builds = 0 +Total wall time: 0:01:59 diff --git a/examples/granregion/log.15Sep22.granregion.mixer.g++.4 b/examples/granregion/log.15Sep22.granregion.mixer.g++.4 new file mode 100644 index 0000000000..57c517a063 --- /dev/null +++ b/examples/granregion/log.15Sep22.granregion.mixer.g++.4 @@ -0,0 +1,632 @@ +LAMMPS (15 Sep 2022) +variable name string mixer + +thermo_modify flush yes +variable seed equal 14314 + +############################################### +# Particle parameters +################################################ + +variable rlo equal 0.3 +variable rhi equal 0.6 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.3 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.6 +variable skin equal ${rhi} +variable skin equal 0.6 + +variable coeffRes equal 0.1 +variable coeffFric equal 0.5 + +variable kn equal 10^5 +variable kt equal 0.2*${kn} +variable kt equal 0.2*100000 + +variable gravity equal 1.0 +variable density equal 1.0 + +variable min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*PI*${rlo}*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*PI*0.3*${rlo}*${rlo} +variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*${rlo} +variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*0.3 +variable a equal (-2.0*log(${coeffRes})/PI)^2 +variable a equal (-2.0*log(0.1)/PI)^2 +variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*${kn}/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*100000/${min_mass}/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*$a)) +variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*0.405284734569351)) +variable gamma_t equal ${gamma_n}*0.5 +variable gamma_t equal 806.699778405191*0.5 + +variable tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) +variable tcol equal PI/sqrt(2*100000/${min_mass}-${gamma_n}/4.0) +variable tcol equal PI/sqrt(2*100000/0.113097335529233-${gamma_n}/4.0) +variable tcol equal PI/sqrt(2*100000/0.113097335529233-806.699778405191/4.0) + +variable dt equal ${tcol}*0.02 +variable dt equal 0.00236257621510454*0.02 +timestep ${dt} +timestep 4.72515243020908e-05 + +############################################### + +variable dumpfreq equal 1000 +variable logfreq equal 1000 + +newton on +atom_style sphere + +boundary p p f + +region boxreg block 0 20 0 20 0 20 +create_box 1 boxreg +Created orthogonal box = (0 0 0) to (20 20 20) + 1 by 2 by 2 MPI processor grid + +pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 +pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 +pair_coeff * * + +neighbor ${skin} multi +neighbor 0.6 multi +thermo ${logfreq} +thermo 1000 + +comm_style brick +comm_modify mode multi group all vel yes +balance 1.1 shift xyz 20 1.1 +Balancing ... +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0 + ghost atom cutoff = 0 + binsize = 20, bins = 1 1 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hertz/history, perpetual + attributes: half, newton on, size, history + pair build: half/size/multi/newton + stencil: half/multi/3d + bin: multi +WARNING: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. (../comm_brick.cpp:210) +fix bal all balance 10000 1.1 shift xyz 20 1.01 + +####################### Options specific to pouring ######################### + +region insreg cylinder z 10 10 8 10 18 side in units box +region cylreg cylinder z 10 10 10 0 20 side in units box + +variable theta equal (step/400000)*2*PI + +region b1 block 2 18 9 11 0 4 side out rotate v_theta 10 10 0 0 0 1 units box +region b2 block 9 11 2 18 0 3.99999 side out rotate v_theta 10 10 0 0 0 1 units box + +region mixer intersect 3 cylreg b1 b2 side in + +fix grav all gravity ${gravity} vector 0 0 -1 +fix grav all gravity 1 vector 0 0 -1 +fix 1 all nve/sphere + +fix mixwall all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 region mixer +fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 region mixer + +fix ins all pour 1000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 ${dhi} dens ${density} ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens ${density} ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 ${density} +fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 1 +Particle insertion: 444 every 84653 steps, 1000 by step 169307 + +#dump 1 all custom ${dumpfreq} ${name}_pour.dump # id type mass diameter x y z + +#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 1.5 # box no 0.0 axes no 0.0 0.0 +#dump_modify 2 pad 6 + +thermo_style custom step cpu atoms ke v_theta +WARNING: New thermo_style command, previous thermo_modify settings will be lost (../output.cpp:896) +thermo_modify flush yes lost warn + +run 200000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- neighbor multi command: doi:10.1016/j.cpc.2008.03.005, doi:10.1007/s40571-020-00361-2 + +@Article{Intveld08, + author = {in 't Veld, P. J. and S. J.~Plimpton and G. S. Grest}, + title = {Accurate and Efficient Methods for Modeling Colloidal + Mixtures in an Explicit Solvent using Molecular Dynamics}, + journal = {Comput.\ Phys.\ Commut.}, + year = 2008, + volume = 179, + pages = {320--329} +} + +@article{Shire2020, + author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin}, + title = {{DEM} Simulations of Polydisperse Media: Efficient Contact + Detection Applied to Investigate the Quasi-Static Limit}, + journal = {Computational Particle Mechanics}, + year = {2020} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 5.816 | 5.816 | 5.816 Mbytes + Step CPU Atoms KinEng v_theta + 0 0 0 -0 0 + 1000 0.089993907 444 -0 0.015707963 + 2000 0.14885989 444 -0 0.031415927 + 3000 0.20954563 444 -0 0.04712389 + 4000 0.27002257 444 -0 0.062831853 + 5000 0.33034347 444 -0 0.078539816 + 6000 0.39049526 444 -0 0.09424778 + 7000 0.45002664 444 -0 0.10995574 + 8000 0.50911338 444 -0 0.12566371 + 9000 0.56771745 444 -0 0.14137167 + 10000 0.62699472 444 -0 0.15707963 + 11000 0.67300351 444 -0 0.1727876 + 12000 0.71981356 444 -0 0.18849556 + 13000 0.76697682 444 -0 0.20420352 + 14000 0.81412229 444 -0 0.21991149 + 15000 0.86284749 444 -0 0.23561945 + 16000 0.91199522 444 -0 0.25132741 + 17000 0.96230663 444 -0 0.26703538 + 18000 1.0118327 444 -0 0.28274334 + 19000 1.0617397 444 -0 0.2984513 + 20000 1.111586 444 -0 0.31415927 + 21000 1.1556637 444 -0 0.32986723 + 22000 1.2005913 444 -0 0.34557519 + 23000 1.2455061 444 -0 0.36128316 + 24000 1.2910181 444 -0 0.37699112 + 25000 1.3370577 444 -0 0.39269908 + 26000 1.383595 444 -0 0.40840704 + 27000 1.430922 444 -0 0.42411501 + 28000 1.478627 444 -0 0.43982297 + 29000 1.5278607 444 -0 0.45553093 + 30000 1.576597 444 -0 0.4712389 + 31000 1.6202694 444 -0 0.48694686 + 32000 1.6646667 444 -0 0.50265482 + 33000 1.7092726 444 -0 0.51836279 + 34000 1.7535573 444 -0 0.53407075 + 35000 1.7985995 444 -0 0.54977871 + 36000 1.8440346 444 -0 0.56548668 + 37000 1.8900841 444 -0 0.58119464 + 38000 1.9368772 444 -0 0.5969026 + 39000 1.9842867 444 -0 0.61261057 + 40000 2.0318482 444 -0 0.62831853 + 41000 2.0753049 444 -0 0.64402649 + 42000 2.1196274 444 -0 0.65973446 + 43000 2.1647071 444 -0 0.67544242 + 44000 2.2101195 444 -0 0.69115038 + 45000 2.2564642 444 -0 0.70685835 + 46000 2.3033573 444 -0 0.72256631 + 47000 2.3500515 444 -0 0.73827427 + 48000 2.3972268 444 -0 0.75398224 + 49000 2.4444727 444 -0 0.7696902 + 50000 2.4921003 444 -0 0.78539816 + 51000 2.535088 444 -0 0.80110613 + 52000 2.5785564 444 -0 0.81681409 + 53000 2.6221392 444 -0 0.83252205 + 54000 2.6664169 444 -0 0.84823002 + 55000 2.7108951 444 -0 0.86393798 + 56000 2.7560522 444 -0 0.87964594 + 57000 2.8010254 444 -0 0.89535391 + 58000 2.8484456 444 -0 0.91106187 + 59000 2.8951674 444 -0 0.92676983 + 60000 2.9424205 444 -0 0.9424778 + 61000 2.9885999 444 -0 0.95818576 + 62000 3.0338676 444 -0 0.97389372 + 63000 3.0793674 444 -0 0.98960169 + 64000 3.1253557 444 -0 1.0053096 + 65000 3.1723823 444 -0 1.0210176 + 66000 3.2203846 444 -0 1.0367256 + 67000 3.2690443 444 -0 1.0524335 + 68000 3.317707 444 -0 1.0681415 + 69000 3.3670196 444 -0 1.0838495 + 70000 3.4160505 444 -0 1.0995574 + 71000 3.4621197 444 -0 1.1152654 + 72000 3.5086434 444 -0 1.1309734 + 73000 3.555691 444 -0 1.1466813 + 74000 3.6032072 444 -0 1.1623893 + 75000 3.6514849 444 -0 1.1780972 + 76000 3.7002713 444 -0 1.1938052 + 77000 3.7497321 444 -0 1.2095132 + 78000 3.7997711 444 -0 1.2252211 + 79000 3.8504338 444 -0 1.2409291 + 80000 3.9020416 444 -0 1.2566371 + 81000 3.9496762 444 -0 1.272345 + 82000 3.9968215 444 -0 1.288053 + 83000 4.04496 444 -0 1.303761 + 84000 4.0936477 444 -0 1.3194689 + 85000 4.1618384 888 -0 1.3351769 + 86000 4.2472086 888 -0 1.3508848 + 87000 4.3322855 888 -0 1.3665928 + 88000 4.4169835 888 -0 1.3823008 + 89000 4.5014588 888 -0 1.3980087 + 90000 4.5861842 888 -0 1.4137167 + 91000 4.653654 888 -0 1.4294247 + 92000 4.7217642 888 -0 1.4451326 + 93000 4.791842 888 -0 1.4608406 + 94000 4.8601789 888 -0 1.4765485 + 95000 4.92849 888 -0 1.4922565 + 96000 4.9976811 888 -0 1.5079645 + 97000 5.0687073 888 -0 1.5236724 + 98000 5.1387234 888 -0 1.5393804 + 99000 5.2086037 888 -0 1.5550884 + 100000 5.2786924 888 -0 1.5707963 + 101000 5.3466895 888 -0 1.5865043 + 102000 5.417132 888 -0 1.6022123 + 103000 5.4865633 888 -0 1.6179202 + 104000 5.5565911 888 -0 1.6336282 + 105000 5.6266394 888 -0 1.6493361 + 106000 5.6975394 888 -0 1.6650441 + 107000 5.7687753 888 -0 1.6807521 + 108000 5.8408498 888 -0 1.69646 + 109000 5.9132618 888 -0 1.712168 + 110000 5.9872629 888 -0 1.727876 + 111000 6.0588115 888 -0 1.7435839 + 112000 6.1308729 888 -0 1.7592919 + 113000 6.2047311 888 -0 1.7749998 + 114000 6.2780757 888 -0 1.7907078 + 115000 6.3528542 888 -0 1.8064158 + 116000 6.4277704 888 -0 1.8221237 + 117000 6.5034683 888 -0 1.8378317 + 118000 6.5795779 888 -0 1.8535397 + 119000 6.655928 888 -0 1.8692476 + 120000 6.7335119 888 -0 1.8849556 + 121000 6.806827 888 -0 1.9006636 + 122000 6.881052 888 -0 1.9163715 + 123000 6.9559647 888 -0 1.9320795 + 124000 7.0300829 888 -0 1.9477874 + 125000 7.1047925 888 -0 1.9634954 + 126000 7.1797025 888 -0 1.9792034 + 127000 7.2556934 888 -0 1.9949113 + 128000 7.3317803 888 -0 2.0106193 + 129000 7.4088096 888 -0 2.0263273 + 130000 7.4862461 888 -0 2.0420352 + 131000 7.5633585 888 -0 2.0577432 + 132000 7.641939 888 -0 2.0734512 + 133000 7.7192741 888 -0 2.0891591 + 134000 7.7970156 888 -0 2.1048671 + 135000 7.8760712 888 -0 2.120575 + 136000 7.9563099 888 -0 2.136283 + 137000 8.0381808 888 -0 2.151991 + 138000 8.1210957 888 -0 2.1676989 + 139000 8.20401 888 -0 2.1834069 + 140000 8.2871705 888 -0 2.1991149 + 141000 8.364321 888 -0 2.2148228 + 142000 8.4426744 888 -0 2.2305308 + 143000 8.5238377 888 -0 2.2462387 + 144000 8.6050517 888 -0 2.2619467 + 145000 8.6865872 888 -0 2.2776547 + 146000 8.767621 888 -0 2.2933626 + 147000 8.8496616 888 -0 2.3090706 + 148000 8.9329599 888 -0 2.3247786 + 149000 9.0165929 888 -0 2.3404865 + 150000 9.1015214 888 -0 2.3561945 + 151000 9.1847289 888 -0 2.3719025 + 152000 9.2689185 888 -0 2.3876104 + 153000 9.3518862 888 -0 2.4033184 + 154000 9.4367057 888 -0 2.4190263 + 155000 9.5227466 888 -0 2.4347343 + 156000 9.6087196 888 -0 2.4504423 + 157000 9.6955661 888 -0 2.4661502 + 158000 9.7838227 888 -0 2.4818582 + 159000 9.8731804 888 -0 2.4975662 + 160000 9.9626648 888 -0 2.5132741 + 161000 10.050473 888 -0 2.5289821 + 162000 10.137725 888 -0 2.54469 + 163000 10.227259 888 -0 2.560398 + 164000 10.318501 888 -0 2.576106 + 165000 10.409218 888 -0 2.5918139 + 166000 10.502055 888 -0 2.6075219 + 167000 10.593786 888 -0 2.6232299 + 168000 10.688536 888 -0 2.6389378 + 169000 10.786033 888 -0 2.6546458 + 170000 10.886377 1000 -0 2.6703538 + 171000 10.987493 1000 -0 2.6860617 + 172000 11.084584 1000 -0 2.7017697 + 173000 11.181502 1000 -0 2.7174776 + 174000 11.28434 1000 -0 2.7331856 + 175000 11.387838 1000 -0 2.7488936 + 176000 11.490915 1000 -0 2.7646015 + 177000 11.595473 1000 -0 2.7803095 + 178000 11.699823 1000 -0 2.7960175 + 179000 11.803927 1000 -0 2.8117254 + 180000 11.90548 1000 -0 2.8274334 + 181000 12.00857 1000 -0 2.8431414 + 182000 12.112787 1000 -0 2.8588493 + 183000 12.217943 1000 -0 2.8745573 + 184000 12.322668 1000 -0 2.8902652 + 185000 12.428332 1000 -0 2.9059732 + 186000 12.535414 1000 -0 2.9216812 + 187000 12.642404 1000 -0 2.9373891 + 188000 12.749332 1000 -0 2.9530971 + 189000 12.856872 1000 -0 2.9688051 + 190000 12.965335 1000 -0 2.984513 + 191000 13.073275 1000 -0 3.000221 + 192000 13.180122 1000 -0 3.0159289 + 193000 13.288112 1000 -0 3.0316369 + 194000 13.394688 1000 -0 3.0473449 + 195000 13.501251 1000 -0 3.0630528 + 196000 13.607472 1000 -0 3.0787608 + 197000 13.71396 1000 -0 3.0944688 + 198000 13.821133 1000 -0 3.1101767 + 199000 13.929192 1000 -0 3.1258847 + 200000 14.036724 1000 -0 3.1415927 +Loop time of 14.0368 on 4 procs for 200000 steps with 1000 atoms + +Performance: 58169.166 tau/day, 14248.307 timesteps/s, 14.248 Matom-step/s +95.5% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.47004 | 0.75698 | 1.1 | 33.1 | 5.39 +Neigh | 0.0078501 | 0.010659 | 0.013902 | 2.7 | 0.08 +Comm | 3.9589 | 4.4102 | 4.9322 | 21.6 | 31.42 +Output | 0.0031054 | 0.0046208 | 0.0069341 | 2.1 | 0.03 +Modify | 6.1829 | 6.8363 | 7.6135 | 24.8 | 48.70 +Other | | 2.018 | | | 14.38 + +Nlocal: 250 ave 260 max 242 min +Histogram: 1 0 1 0 0 1 0 0 0 1 +Nghost: 279.25 ave 325 max 232 min +Histogram: 1 1 0 0 0 0 0 0 1 1 +Neighs: 939.75 ave 1397 max 509 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 3759 +Ave neighs/atom = 3.759 +Neighbor list builds = 201 +Dangerous builds = 0 +unfix ins +run 200000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 11.87 | 11.88 | 11.89 Mbytes + Step CPU Atoms KinEng v_theta + 200000 0 1000 1.0071568 3.1415927 + 201000 0.099357585 1000 1.0036239 3.1573006 + 202000 0.19922889 1000 0.99846844 3.1730086 + 203000 0.29896537 1000 0.98236169 3.1887165 + 204000 0.39875771 1000 0.98625572 3.2044245 + 205000 0.49759454 1000 0.9893407 3.2201325 + 206000 0.59609243 1000 1.0012123 3.2358404 + 207000 0.69408206 1000 1.0231892 3.2515484 + 208000 0.79216806 1000 1.0265912 3.2672564 + 209000 0.8902274 1000 1.0190202 3.2829643 + 210000 0.98909509 1000 1.0267754 3.2986723 + 211000 1.0882901 1000 1.0186847 3.3143802 + 212000 1.1895753 1000 1.0159848 3.3300882 + 213000 1.2891277 1000 0.99326329 3.3457962 + 214000 1.387486 1000 0.97263135 3.3615041 + 215000 1.4850078 1000 0.97246409 3.3772121 + 216000 1.58405 1000 0.96000626 3.3929201 + 217000 1.6853829 1000 0.95730432 3.408628 + 218000 1.7911163 1000 0.95605591 3.424336 + 219000 1.8974141 1000 0.94983 3.440044 + 220000 2.0029829 1000 0.95291888 3.4557519 + 221000 2.108723 1000 0.93612997 3.4714599 + 222000 2.2151561 1000 0.93414081 3.4871678 + 223000 2.3220866 1000 0.93321246 3.5028758 + 224000 2.4285504 1000 0.93026943 3.5185838 + 225000 2.5356173 1000 0.930478 3.5342917 + 226000 2.6415516 1000 0.92909096 3.5499997 + 227000 2.747634 1000 0.92308495 3.5657077 + 228000 2.8524082 1000 0.91075986 3.5814156 + 229000 2.9570172 1000 0.9006662 3.5971236 + 230000 3.0627535 1000 0.88869212 3.6128316 + 231000 3.1683919 1000 0.8877611 3.6285395 + 232000 3.2749534 1000 0.89409636 3.6442475 + 233000 3.3824185 1000 0.90866091 3.6599554 + 234000 3.4917899 1000 0.90454601 3.6756634 + 235000 3.6009156 1000 0.89408327 3.6913714 + 236000 3.7111309 1000 0.8881044 3.7070793 + 237000 3.8197619 1000 0.89322168 3.7227873 + 238000 3.9302291 1000 0.89018045 3.7384953 + 239000 4.0407242 1000 0.88771268 3.7542032 + 240000 4.1521989 1000 0.88957717 3.7699112 + 241000 4.2639861 1000 0.89362036 3.7856191 + 242000 4.3782856 1000 0.90967472 3.8013271 + 243000 4.4925107 1000 0.91366381 3.8170351 + 244000 4.6057342 1000 0.9150959 3.832743 + 245000 4.7199383 1000 0.92725789 3.848451 + 246000 4.8346784 1000 0.93024722 3.864159 + 247000 4.9515438 1000 0.93297974 3.8798669 + 248000 5.0696512 1000 0.94755869 3.8955749 + 249000 5.1838845 1000 0.94761679 3.9112829 + 250000 5.297991 1000 0.92701064 3.9269908 + 251000 5.412562 1000 0.91365252 3.9426988 + 252000 5.5274859 1000 0.90918381 3.9584067 + 253000 5.6418647 1000 0.90612685 3.9741147 + 254000 5.7593721 1000 0.90352142 3.9898227 + 255000 5.8759086 1000 0.90421567 4.0055306 + 256000 5.993588 1000 0.90024688 4.0212386 + 257000 6.1142027 1000 0.88540341 4.0369466 + 258000 6.2318882 1000 0.87890423 4.0526545 + 259000 6.3502765 1000 0.86833748 4.0683625 + 260000 6.4677878 1000 0.85465694 4.0840704 + 261000 6.5875341 1000 0.83941242 4.0997784 + 262000 6.7063481 1000 0.81790404 4.1154864 + 263000 6.8249742 1000 0.82284562 4.1311943 + 264000 6.9421188 1000 0.80961447 4.1469023 + 265000 7.0588866 1000 0.80567073 4.1626103 + 266000 7.1763855 1000 0.79577448 4.1783182 + 267000 7.295632 1000 0.78489106 4.1940262 + 268000 7.4144463 1000 0.77348757 4.2097342 + 269000 7.5333839 1000 0.76606696 4.2254421 + 270000 7.6527119 1000 0.7649744 4.2411501 + 271000 7.7704222 1000 0.76050309 4.256858 + 272000 7.8903012 1000 0.75378759 4.272566 + 273000 8.0106197 1000 0.75633811 4.288274 + 274000 8.1309707 1000 0.75703106 4.3039819 + 275000 8.2522837 1000 0.75227453 4.3196899 + 276000 8.3730898 1000 0.76003902 4.3353979 + 277000 8.4955037 1000 0.76274661 4.3511058 + 278000 8.6153206 1000 0.75888482 4.3668138 + 279000 8.7339569 1000 0.75071875 4.3825218 + 280000 8.8515447 1000 0.75454927 4.3982297 + 281000 8.9685253 1000 0.75617824 4.4139377 + 282000 9.0856168 1000 0.75230835 4.4296456 + 283000 9.2018894 1000 0.75417571 4.4453536 + 284000 9.3179777 1000 0.74559345 4.4610616 + 285000 9.4341721 1000 0.73274661 4.4767695 + 286000 9.5498722 1000 0.72385193 4.4924775 + 287000 9.6651326 1000 0.72398899 4.5081855 + 288000 9.7810274 1000 0.72009027 4.5238934 + 289000 9.8959471 1000 0.72026686 4.5396014 + 290000 10.010007 1000 0.72330145 4.5553093 + 291000 10.123304 1000 0.71630656 4.5710173 + 292000 10.238277 1000 0.71089192 4.5867253 + 293000 10.351465 1000 0.70584923 4.6024332 + 294000 10.464794 1000 0.71350398 4.6181412 + 295000 10.57818 1000 0.72781836 4.6338492 + 296000 10.692249 1000 0.72285512 4.6495571 + 297000 10.80741 1000 0.71649517 4.6652651 + 298000 10.923694 1000 0.71132209 4.6809731 + 299000 11.039173 1000 0.73602072 4.696681 + 300000 11.157002 1000 0.74400837 4.712389 + 301000 11.272462 1000 0.76618562 4.7280969 + 302000 11.386581 1000 0.77476041 4.7438049 + 303000 11.499191 1000 0.77124283 4.7595129 + 304000 11.611585 1000 0.7625748 4.7752208 + 305000 11.725012 1000 0.74979361 4.7909288 + 306000 11.838032 1000 0.74515733 4.8066368 + 307000 11.949194 1000 0.74302741 4.8223447 + 308000 12.060586 1000 0.73732959 4.8380527 + 309000 12.171445 1000 0.73368237 4.8537606 + 310000 12.283518 1000 0.72374292 4.8694686 + 311000 12.393447 1000 0.72107784 4.8851766 + 312000 12.505136 1000 0.72944426 4.9008845 + 313000 12.616959 1000 0.73958637 4.9165925 + 314000 12.730312 1000 0.75160847 4.9323005 + 315000 12.846163 1000 0.74419683 4.9480084 + 316000 12.960328 1000 0.74652593 4.9637164 + 317000 13.073994 1000 0.74933482 4.9794244 + 318000 13.186549 1000 0.74200509 4.9951323 + 319000 13.296925 1000 0.7346024 5.0108403 + 320000 13.406825 1000 0.72806145 5.0265482 + 321000 13.51703 1000 0.72147888 5.0422562 + 322000 13.628261 1000 0.71460041 5.0579642 + 323000 13.74063 1000 0.70255075 5.0736721 + 324000 13.853826 1000 0.70640327 5.0893801 + 325000 13.968533 1000 0.70643428 5.1050881 + 326000 14.081456 1000 0.69751794 5.120796 + 327000 14.195505 1000 0.69035108 5.136504 + 328000 14.310048 1000 0.68068243 5.152212 + 329000 14.426048 1000 0.69123492 5.1679199 + 330000 14.543349 1000 0.70326515 5.1836279 + 331000 14.662021 1000 0.70551726 5.1993358 + 332000 14.782194 1000 0.70514444 5.2150438 + 333000 14.901573 1000 0.71102045 5.2307518 + 334000 15.020642 1000 0.71336747 5.2464597 + 335000 15.136739 1000 0.70816388 5.2621677 + 336000 15.252554 1000 0.69502472 5.2778757 + 337000 15.368496 1000 0.69314289 5.2935836 + 338000 15.483744 1000 0.68565794 5.3092916 + 339000 15.599584 1000 0.67268053 5.3249995 + 340000 15.717342 1000 0.68313196 5.3407075 + 341000 15.835594 1000 0.68782815 5.3564155 + 342000 15.954546 1000 0.6989326 5.3721234 + 343000 16.074184 1000 0.694926 5.3878314 + 344000 16.193902 1000 0.7006474 5.4035394 + 345000 16.314878 1000 0.70783177 5.4192473 + 346000 16.434704 1000 0.71334276 5.4349553 + 347000 16.554708 1000 0.72917419 5.4506633 + 348000 16.673034 1000 0.74315705 5.4663712 + 349000 16.791269 1000 0.76731311 5.4820792 + 350000 16.912554 1000 0.79761434 5.4977871 + 351000 17.03323 1000 0.80447724 5.5134951 + 352000 17.155644 1000 0.80118728 5.5292031 + 353000 17.281134 1000 0.77990459 5.544911 + 354000 17.406672 1000 0.76453299 5.560619 + 355000 17.532346 1000 0.76538392 5.576327 + 356000 17.657256 1000 0.76310698 5.5920349 + 357000 17.782477 1000 0.75897095 5.6077429 + 358000 17.909642 1000 0.75071115 5.6234508 + 359000 18.035032 1000 0.74034801 5.6391588 + 360000 18.160696 1000 0.72671924 5.6548668 + 361000 18.285089 1000 0.72111017 5.6705747 + 362000 18.408849 1000 0.71875181 5.6862827 + 363000 18.533901 1000 0.71469706 5.7019907 + 364000 18.659326 1000 0.70470493 5.7176986 + 365000 18.784109 1000 0.70863047 5.7334066 + 366000 18.911344 1000 0.70850561 5.7491146 + 367000 19.039756 1000 0.71413452 5.7648225 + 368000 19.169907 1000 0.71314184 5.7805305 + 369000 19.299066 1000 0.71309549 5.7962384 + 370000 19.428116 1000 0.71132937 5.8119464 + 371000 19.553027 1000 0.70788039 5.8276544 + 372000 19.678121 1000 0.71780071 5.8433623 + 373000 19.804465 1000 0.72352571 5.8590703 + 374000 19.92949 1000 0.71723739 5.8747783 + 375000 20.053554 1000 0.71556941 5.8904862 + 376000 20.177991 1000 0.70935312 5.9061942 + 377000 20.301972 1000 0.71551157 5.9219022 + 378000 20.427612 1000 0.7235163 5.9376101 + 379000 20.554742 1000 0.73896421 5.9533181 + 380000 20.680899 1000 0.74906169 5.969026 + 381000 20.805515 1000 0.75303336 5.984734 + 382000 20.931483 1000 0.75359492 6.000442 + 383000 21.05731 1000 0.75579354 6.0161499 + 384000 21.184712 1000 0.75178368 6.0318579 + 385000 21.310667 1000 0.74412159 6.0475659 + 386000 21.433509 1000 0.7360955 6.0632738 + 387000 21.554251 1000 0.73461103 6.0789818 + 388000 21.674477 1000 0.72496617 6.0946897 + 389000 21.794698 1000 0.7219047 6.1103977 + 390000 21.914083 1000 0.71837013 6.1261057 + 391000 22.033188 1000 0.71495923 6.1418136 + 392000 22.152689 1000 0.71436707 6.1575216 + 393000 22.271183 1000 0.71447834 6.1732296 + 394000 22.389775 1000 0.71334298 6.1889375 + 395000 22.509106 1000 0.71510229 6.2046455 + 396000 22.628068 1000 0.7121714 6.2203535 + 397000 22.746926 1000 0.70818894 6.2360614 + 398000 22.865086 1000 0.70059455 6.2517694 + 399000 22.982394 1000 0.69960089 6.2674773 + 400000 23.100381 1000 0.70261998 6.2831853 +Loop time of 23.1004 on 4 procs for 200000 steps with 1000 atoms + +Performance: 35345.963 tau/day, 8657.854 timesteps/s, 8.658 Matom-step/s +92.9% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.263 | 2.1388 | 3.0295 | 58.6 | 9.26 +Neigh | 0.012633 | 0.017793 | 0.023147 | 3.7 | 0.08 +Comm | 7.8521 | 9.0474 | 10.284 | 39.6 | 39.17 +Output | 0.0029549 | 0.004916 | 0.0068506 | 2.0 | 0.02 +Modify | 8.3635 | 9.8066 | 11.142 | 41.0 | 42.45 +Other | | 2.085 | | | 9.03 + +Nlocal: 250 ave 258 max 241 min +Histogram: 1 0 0 0 1 0 0 1 0 1 +Nghost: 412 ave 492 max 332 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 1258.5 ave 1588 max 953 min +Histogram: 2 0 0 0 0 0 0 0 1 1 + +Total # of neighbors = 5034 +Ave neighs/atom = 5.034 +Neighbor list builds = 159 +Dangerous builds = 0 +Total wall time: 0:00:37 diff --git a/examples/granregion/log.27Nov18.granregion.box.g++.1 b/examples/granregion/log.27Nov18.granregion.box.g++.1 deleted file mode 100644 index ef004b7398..0000000000 --- a/examples/granregion/log.27Nov18.granregion.box.g++.1 +++ /dev/null @@ -1,475 +0,0 @@ -LAMMPS (27 Nov 2018) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87) - using 1 OpenMP thread(s) per MPI task -# pouring spheres into container box - -units lj -atom_style sphere -boundary f f f -dimension 3 -comm_modify vel yes - -region box block -10 10 -10 10 -10 10 units box -create_box 2 box -Created orthogonal box = (-10 -10 -10) to (10 10 10) - 1 by 1 by 1 MPI processor grid - -pair_style hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1 -pair_coeff * * gran/hooke - -region container block -6 6 -6 6 -6 6 units box -fix container all wall/gran/region hooke/history 4000.0 NULL 100.0 NULL 0.5 1 region container - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 2 all nve/sphere -fix 3 all gravity 1.0 vector 0 0 -1 - -region slab block -2 2 -2 2 -2 2 units box -fix ins all pour 100 2 4767548 vol 0.4 10 diam one 1.0 region slab ignore -Particle insertion: 48 every 566 steps, 100 by step 1133 - -timestep 0.005 - -compute 1 all temp -compute_modify 1 dynamic/dof yes - -compute 2 all temp/sphere -compute_modify 2 dynamic/dof yes - -thermo 100 -thermo_style custom step atoms temp c_1 c_2 press -thermo_modify lost ignore -compute_modify thermo_temp dynamic/dof yes - -#dump 2 all image 100 image.*.jpg type type # zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03 -#dump_modify 2 pad 5 - -run 5000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.3 - ghost atom cutoff = 1.3 - binsize = 0.65, bins = 31 31 31 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair gran/hooke, perpetual - attributes: half, newton on, size - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 0.5855 | 0.5855 | 0.5855 Mbytes -Step Atoms Temp c_1 c_2 Press - 0 0 0 0 0 0 - 100 21 0.54270729 0.54270729 0.26473526 0.0013567682 - 200 21 0.87606961 0.87606961 0.42735103 0.002190174 - 300 21 1.1428374 1.1428374 0.55748167 0.0028570936 - 400 21 1.3543103 1.3543103 0.66829516 0.0033857758 - 500 21 1.0677786 1.0677786 0.53582407 0.0045048164 - 600 56 0.6744286 0.6744286 0.3502938 0.0047464584 - 700 56 0.75569283 0.75569283 0.39779462 0.0051953882 - 800 56 0.61597505 0.61597505 0.32943642 0.0086022783 - 900 56 0.65260802 0.65260802 0.34474044 0.0059298996 - 1000 56 0.51624952 0.51624952 0.28326898 0.0067827337 - 1100 56 0.46050076 0.46050076 0.25656319 0.0061891094 - 1200 81 0.39112346 0.39112346 0.21690172 0.0086559316 - 1300 81 0.33302617 0.33302617 0.19109398 0.0033381104 - 1400 81 0.3933533 0.3933533 0.21221692 0.004135078 - 1500 81 0.35495297 0.35495297 0.19925984 0.0037374946 - 1600 81 0.34150606 0.34150606 0.19025811 0.0053492835 - 1700 100 0.2561647 0.2561647 0.14186278 0.0090767057 - 1800 100 0.21124278 0.21124278 0.12154878 0.0028545759 - 1900 100 0.21793955 0.21793955 0.12173867 0.0029049155 - 2000 100 0.25530858 0.25530858 0.13892272 0.0035528009 - 2100 100 0.24671808 0.24671808 0.13687783 0.0076812435 - 2200 100 0.22465216 0.22465216 0.12513603 0.0042528715 - 2300 100 0.19362854 0.19362854 0.10914305 0.0061173739 - 2400 100 0.061627608 0.061627608 0.045907717 0.0010422721 - 2500 100 0.052700901 0.052700901 0.038883014 0.0019341647 - 2600 100 0.037332018 0.037332018 0.028357146 0.0028364476 - 2700 100 0.033526602 0.033526602 0.024609055 0.00044524562 - 2800 100 0.0194148 0.0194148 0.014491377 0.00056526591 - 2900 100 0.012346108 0.012346108 0.009857017 0.00081855699 - 3000 100 0.0107344 0.0107344 0.008669364 0.00040371396 - 3100 100 0.0092678291 0.0092678291 0.0073003108 0.00033287397 - 3200 100 0.0085847001 0.0085847001 0.0064045591 0.00023253547 - 3300 100 0.0049475182 0.0049475182 0.0041173627 0.00019876269 - 3400 100 0.0030471097 0.0030471097 0.0026940466 0.00013462604 - 3500 100 0.0031188371 0.0031188371 0.002612223 0.00026148578 - 3600 100 0.0017616584 0.0017616584 0.0017464137 0.00019049724 - 3700 100 0.0015475923 0.0015475923 0.0015560356 0.00025062814 - 3800 100 0.0012547887 0.0012547887 0.0012622678 0.00014132236 - 3900 100 0.0010047282 0.0010047282 0.0010379262 9.7665594e-05 - 4000 100 0.00080895307 0.00080895307 0.00088263027 8.1278842e-05 - 4100 100 0.00079078739 0.00079078739 0.00085810727 8.1271694e-05 - 4200 100 0.00075192318 0.00075192318 0.00083085046 8.9352453e-05 - 4300 100 0.00063546457 0.00063546457 0.00073222177 8.9264255e-05 - 4400 100 0.00062398391 0.00062398391 0.00071312118 8.4200615e-05 - 4500 100 0.00056464934 0.00056464934 0.00066087801 9.2097641e-05 - 4600 100 0.00066951894 0.00066951894 0.00071633313 8.2457941e-05 - 4700 100 0.001128837 0.001128837 0.00095293877 0.00011716361 - 4800 100 0.00049580391 0.00049580391 0.00056710488 0.00010718794 - 4900 100 0.00054374371 0.00054374371 0.00058671699 5.6580257e-05 - 5000 100 0.00043016232 0.00043016232 0.00050264172 2.8640786e-05 -Loop time of 0.0807264 on 1 procs for 5000 steps with 100 atoms - -Performance: 26757050.955 tau/day, 61937.618 timesteps/s -97.4% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0089066 | 0.0089066 | 0.0089066 | 0.0 | 11.03 -Neigh | 0.017107 | 0.017107 | 0.017107 | 0.0 | 21.19 -Comm | 0.00091505 | 0.00091505 | 0.00091505 | 0.0 | 1.13 -Output | 0.00051451 | 0.00051451 | 0.00051451 | 0.0 | 0.64 -Modify | 0.047671 | 0.047671 | 0.047671 | 0.0 | 59.05 -Other | | 0.005612 | | | 6.95 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 158 ave 158 max 158 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 158 -Ave neighs/atom = 1.58 -Neighbor list builds = 310 -Dangerous builds = 0 - -region container delete -variable theta equal (step-5000)*(4.0*PI/5000) -region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 0 0 1 -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.836 | 5.836 | 5.836 Mbytes -Step Atoms Temp c_1 c_2 Press - 5000 100 0.00043016232 0.00043016232 0.00050264172 2.8677624e-05 - 5100 100 0.56489668 0.56489668 0.31137762 0.011848041 - 5200 100 0.66068288 0.66068288 0.35915482 0.010199755 - 5300 100 0.74068022 0.74068022 0.39643217 0.010806409 - 5400 100 0.80913562 0.80913562 0.42748505 0.01190892 - 5500 100 0.89409135 0.89409135 0.46135116 0.013093474 - 5600 100 0.97585093 0.97585093 0.50021126 0.013588886 - 5700 100 1.0151954 1.0151954 0.5174624 0.01601347 - 5800 100 1.0452728 1.0452728 0.53122496 0.01879329 - 5900 100 1.0881689 1.0881689 0.55152229 0.017120714 - 6000 100 1.1133186 1.1133186 0.5638022 0.017284617 - 6100 100 1.1532099 1.1532099 0.58310076 0.017031384 - 6200 100 1.1798849 1.1798849 0.5959516 0.017971323 - 6300 100 1.19387 1.19387 0.60173877 0.020140984 - 6400 100 1.2126705 1.2126705 0.61086899 0.018426638 - 6500 100 1.2137646 1.2137646 0.61284198 0.019127381 - 6600 100 1.2339012 1.2339012 0.62199324 0.019378799 - 6700 100 1.2439326 1.2439326 0.62488425 0.021049447 - 6800 100 1.2489549 1.2489549 0.6278167 0.019552409 - 6900 100 1.2733303 1.2733303 0.63898149 0.020237284 - 7000 100 1.2835029 1.2835029 0.6440245 0.020798586 - 7100 100 1.2866111 1.2866111 0.64522896 0.020355019 - 7200 100 1.2886381 1.2886381 0.6467497 0.02062322 - 7300 100 1.2885085 1.2885085 0.64617988 0.020350755 - 7400 100 1.2912349 1.2912349 0.64691898 0.020197503 - 7500 100 1.2963062 1.2963062 0.64926335 0.020349791 - 7600 100 1.3016488 1.3016488 0.65150178 0.021001457 - 7700 100 1.3009311 1.3009311 0.65106234 0.021546471 - 7800 100 1.3016987 1.3016987 0.65143099 0.020994967 - 7900 100 1.3028811 1.3028811 0.65164558 0.022200425 - 8000 100 1.3087855 1.3087855 0.65439023 0.021310808 - 8100 100 1.3102001 1.3102001 0.65514941 0.021177764 - 8200 100 1.3133931 1.3133931 0.65681861 0.021591267 - 8300 100 1.3148898 1.3148898 0.65775353 0.021335384 - 8400 100 1.3160355 1.3160355 0.65845913 0.021238095 - 8500 100 1.3171797 1.3171797 0.65934185 0.021172983 - 8600 100 1.3176785 1.3176785 0.65964311 0.020747457 - 8700 100 1.3180425 1.3180425 0.66019624 0.021275913 - 8800 100 1.3287501 1.3287501 0.66444242 0.021832635 - 8900 100 1.3249847 1.3249847 0.6625848 0.021337451 - 9000 100 1.326216 1.326216 0.66297827 0.021470663 - 9100 100 1.3261662 1.3261662 0.66303852 0.021423573 - 9200 100 1.3312132 1.3312132 0.6653609 0.021385943 - 9300 100 1.3300976 1.3300976 0.66504574 0.021489888 - 9400 100 1.3377335 1.3377335 0.66820989 0.021565001 - 9500 100 1.3421956 1.3421956 0.67027168 0.022402346 - 9600 100 1.3464217 1.3464217 0.67228206 0.021991922 - 9700 100 1.3470623 1.3470623 0.67258349 0.022035729 - 9800 100 1.3446725 1.3446725 0.67135725 0.022295251 - 9900 100 1.343146 1.343146 0.67066672 0.022049041 - 10000 100 1.3435397 1.3435397 0.67093067 0.022451365 -Loop time of 0.247549 on 1 procs for 5000 steps with 100 atoms - -Performance: 8725560.044 tau/day, 20198.056 timesteps/s -99.4% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.031783 | 0.031783 | 0.031783 | 0.0 | 12.84 -Neigh | 0.038383 | 0.038383 | 0.038383 | 0.0 | 15.51 -Comm | 0.0012343 | 0.0012343 | 0.0012343 | 0.0 | 0.50 -Output | 0.00056028 | 0.00056028 | 0.00056028 | 0.0 | 0.23 -Modify | 0.1687 | 0.1687 | 0.1687 | 0.0 | 68.15 -Other | | 0.00689 | | | 2.78 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 199 ave 199 max 199 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 199 -Ave neighs/atom = 1.99 -Neighbor list builds = 621 -Dangerous builds = 0 - -region container delete -region container block -6 6 -6 6 -6 6 units box -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.836 | 5.836 | 5.836 Mbytes -Step Atoms Temp c_1 c_2 Press - 10000 100 1.3435397 1.3435397 0.67093067 0.022411116 - 10100 100 0.31352763 0.31352763 0.18877908 0.01321582 - 10200 100 0.13367611 0.13367611 0.090010637 0.0074171016 - 10300 100 0.068195658 0.068195658 0.052632714 0.0019696287 - 10400 100 0.053814936 0.053814936 0.043037586 0.0017121584 - 10500 100 0.04032072 0.04032072 0.032944572 0.0011809154 - 10600 100 0.029178161 0.029178161 0.023951873 0.0007804529 - 10700 100 0.025978206 0.025978206 0.021045025 0.00099531465 - 10800 100 0.023205036 0.023205036 0.01898502 0.00040036401 - 10900 100 0.019994638 0.019994638 0.016451227 0.00027385559 - 11000 100 0.017838131 0.017838131 0.014730762 0.00040399762 - 11100 100 0.014863196 0.014863196 0.012314308 0.00019097464 - 11200 100 0.012131256 0.012131256 0.010102122 0.00018514926 - 11300 100 0.010881385 0.010881385 0.0090013541 0.00016579157 - 11400 100 0.0076519814 0.0076519814 0.0064604568 0.00035399997 - 11500 100 0.0067507315 0.0067507315 0.0057378868 0.00049116726 - 11600 100 0.0053146649 0.0053146649 0.0047005938 0.00019625233 - 11700 100 0.0044162463 0.0044162463 0.0039534657 0.00012548039 - 11800 100 0.0037025387 0.0037025387 0.0033604103 6.2969827e-05 - 11900 100 0.0032632211 0.0032632211 0.0030406641 8.1600622e-05 - 12000 100 0.0028944057 0.0028944057 0.0026875858 6.6435833e-05 - 12100 100 0.0027644728 0.0027644728 0.0025859762 5.5899271e-05 - 12200 100 0.002480367 0.002480367 0.0023685117 6.0201418e-05 - 12300 100 0.0024136475 0.0024136475 0.0023107986 4.4386874e-05 - 12400 100 0.0021911567 0.0021911567 0.0021413262 5.0213175e-05 - 12500 100 0.0019775905 0.0019775905 0.0019927698 0.00035250097 - 12600 100 0.0017410363 0.0017410363 0.001830428 5.7885177e-05 - 12700 100 0.0015749276 0.0015749276 0.0016816771 4.5530192e-05 - 12800 100 0.0015187705 0.0015187705 0.0016218625 4.0589413e-05 - 12900 100 0.0014778376 0.0014778376 0.001580232 4.0085455e-05 - 13000 100 0.0014693491 0.0014693491 0.0015681809 4.0407656e-05 - 13100 100 0.0014434495 0.0014434495 0.0015356278 5.7849212e-05 - 13200 100 0.0014121959 0.0014121959 0.0015058758 3.2720737e-05 - 13300 100 0.0012876041 0.0012876041 0.0013838998 3.7725702e-05 - 13400 100 0.0012304951 0.0012304951 0.0013373457 3.6784546e-05 - 13500 100 0.0011954303 0.0011954303 0.0012877627 3.6584963e-05 - 13600 100 0.0011028947 0.0011028947 0.0011955404 2.3767582e-05 - 13700 100 0.0010611762 0.0010611762 0.0011504675 3.485879e-05 - 13800 100 0.0010080835 0.0010080835 0.0010997919 3.7905404e-05 - 13900 100 0.00096495712 0.00096495712 0.0010530767 3.5273885e-05 - 14000 100 0.00094945029 0.00094945029 0.0010409175 3.3718395e-05 - 14100 100 0.00092386757 0.00092386757 0.0010217415 3.3313256e-05 - 14200 100 0.00088928389 0.00088928389 0.000983023 3.290941e-05 - 14300 100 0.00082696485 0.00082696485 0.00092690771 3.1651431e-05 - 14400 100 0.00081086188 0.00081086188 0.00091681096 3.1845632e-05 - 14500 100 0.00077732305 0.00077732305 0.00087592983 4.8087361e-05 - 14600 100 0.00073386005 0.00073386005 0.00082546873 3.0892065e-05 - 14700 100 0.00068701098 0.00068701098 0.00075953521 0.00010208859 - 14800 100 0.00065860451 0.00065860451 0.00073738846 2.9272912e-05 - 14900 100 0.00064706564 0.00064706564 0.00072748391 2.9817955e-05 - 15000 100 0.00064227996 0.00064227996 0.00070964586 3.2547768e-05 -Loop time of 0.0840213 on 1 procs for 5000 steps with 100 atoms - -Performance: 25707757.817 tau/day, 59508.699 timesteps/s -98.2% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.01004 | 0.01004 | 0.01004 | 0.0 | 11.95 -Neigh | 0.0057366 | 0.0057366 | 0.0057366 | 0.0 | 6.83 -Comm | 0.00086808 | 0.00086808 | 0.00086808 | 0.0 | 1.03 -Output | 0.00049472 | 0.00049472 | 0.00049472 | 0.0 | 0.59 -Modify | 0.060893 | 0.060893 | 0.060893 | 0.0 | 72.47 -Other | | 0.005989 | | | 7.13 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 151 ave 151 max 151 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 151 -Ave neighs/atom = 1.51 -Neighbor list builds = 92 -Dangerous builds = 0 - -region container delete -variable theta equal (step-15000)*(4.0*PI/5000) -region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 1 1 1 -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.836 | 5.836 | 5.836 Mbytes -Step Atoms Temp c_1 c_2 Press - 15000 100 0.00064227996 0.00064227996 0.00070964586 3.2291286e-05 - 15100 100 0.81230775 0.81230775 0.53266834 0.010948517 - 15200 100 0.87957637 0.87957637 0.57559572 0.012401402 - 15300 100 1.0262431 1.0262431 0.66535656 0.015239294 - 15400 100 1.2863564 1.2863564 0.82026439 0.020115365 - 15500 100 1.4721549 1.4721549 0.92138954 0.022400442 - 15600 100 1.7140429 1.7140429 1.0103822 0.02558084 - 15700 100 1.8963287 1.8963287 1.0916756 0.032032318 - 15800 100 2.0741177 2.0741177 1.1706233 0.034251942 - 15900 100 2.1434733 2.1434733 1.2054242 0.030132271 - 16000 100 2.1409892 2.1409892 1.2019761 0.030914205 - 16100 100 2.2496058 2.2496058 1.2476438 0.030939743 - 16200 100 2.233356 2.233356 1.2499888 0.030097445 - 16300 100 2.2673491 2.2673491 1.272321 0.030968524 - 16400 100 2.3735648 2.3735648 1.3126117 0.034532377 - 16500 100 2.4510087 2.4510087 1.3588349 0.036685351 - 16600 100 2.497406 2.497406 1.3811443 0.032019982 - 16700 100 2.6800518 2.6800518 1.4661941 0.037455527 - 16800 100 2.8673997 2.8673997 1.5558303 0.03606532 - 16900 100 3.1229488 3.1229488 1.6918439 0.039753213 - 17000 100 3.117815 3.117815 1.6996841 0.046210837 - 17100 100 3.3336225 3.3336225 1.7834517 0.047865361 - 17200 100 3.1773164 3.1773164 1.7113961 0.047778334 - 17300 100 3.4336759 3.4336759 1.8343073 0.049673718 - 17400 100 3.3142326 3.3142326 1.7796613 0.055329946 - 17500 100 3.3205493 3.3205493 1.7853946 0.043558145 - 17600 100 3.2764553 3.2764553 1.7640702 0.051463316 - 17700 100 3.1909643 3.1909643 1.7407995 0.043248948 - 17800 100 3.1958324 3.1958324 1.735056 0.050123145 - 17900 100 3.2431806 3.2431806 1.7380638 0.050838878 - 18000 100 3.2967417 3.2967417 1.7705821 0.042176084 - 18100 100 3.4270672 3.4270672 1.8459819 0.043589925 - 18200 100 3.3638494 3.3638494 1.8159436 0.048949648 - 18300 100 3.3192279 3.3192279 1.8122198 0.043629595 - 18400 100 3.2627211 3.2627211 1.796316 0.045504529 - 18500 100 3.5669172 3.5669172 1.9257062 0.048460393 - 18600 100 3.5546411 3.5546411 1.9154318 0.046890968 - 18700 100 3.7288485 3.7288485 2.011106 0.046906531 - 18800 100 3.6800347 3.6800347 1.9936406 0.049985172 - 18900 100 3.7151898 3.7151898 2.007659 0.050394561 - 19000 100 3.9693368 3.9693368 2.1311549 0.053710204 - 19100 100 3.6907732 3.6907732 1.9939387 0.05480136 - 19200 100 3.8808777 3.8808777 2.0790125 0.055093552 - 19300 100 3.8422142 3.8422142 2.0756951 0.058090774 - 19400 100 3.7836875 3.7836875 2.0399805 0.06965907 - 19500 100 4.0480195 4.0480195 2.169214 0.053420651 - 19600 100 3.965917 3.965917 2.1245227 0.059077084 - 19700 100 3.8980869 3.8980869 2.0956306 0.050857062 - 19800 100 4.008079 4.008079 2.1501421 0.054938689 - 19900 100 3.7244506 3.7244506 2.0080877 0.055481507 - 20000 100 3.8146094 3.8146094 2.0541416 0.053187111 -Loop time of 0.210396 on 1 procs for 5000 steps with 100 atoms - -Performance: 10266363.999 tau/day, 23764.731 timesteps/s -98.3% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.013991 | 0.013991 | 0.013991 | 0.0 | 6.65 -Neigh | 0.056947 | 0.056947 | 0.056947 | 0.0 | 27.07 -Comm | 0.0013928 | 0.0013928 | 0.0013928 | 0.0 | 0.66 -Output | 0.00054646 | 0.00054646 | 0.00054646 | 0.0 | 0.26 -Modify | 0.13027 | 0.13027 | 0.13027 | 0.0 | 61.92 -Other | | 0.007249 | | | 3.45 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 144 ave 144 max 144 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 144 -Ave neighs/atom = 1.44 -Neighbor list builds = 910 -Dangerous builds = 0 - -region container delete -region container block -6 6 -6 6 -6 6 units box -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.836 | 5.836 | 5.836 Mbytes -Step Atoms Temp c_1 c_2 Press - 20000 100 3.8146094 3.8146094 2.0541416 0.052956687 - 20100 100 1.3848453 1.3848453 0.82244153 0.017544632 - 20200 100 0.89469578 0.89469578 0.55929611 0.0111604 - 20300 100 0.83962013 0.83962013 0.52665461 0.010396174 - 20400 100 0.77264252 0.77264252 0.48961142 0.0095493901 - 20500 100 0.78613208 0.78613208 0.48683715 0.012166835 - 20600 100 0.88411633 0.88411633 0.52854942 0.011725323 - 20700 100 0.89833225 0.89833225 0.52549693 0.012193413 - 20800 100 0.90216089 0.90216089 0.51167019 0.014289685 - 20900 100 0.98665057 0.98665057 0.5468893 0.013794318 - 21000 100 0.7576342 0.7576342 0.42758791 0.011720156 - 21100 100 0.3821563 0.3821563 0.23426423 0.005324458 - 21200 100 0.17486973 0.17486973 0.12876582 0.0029726352 - 21300 100 0.17940562 0.17940562 0.12400155 0.0026179917 - 21400 100 0.15526876 0.15526876 0.10526802 0.002341177 - 21500 100 0.079493361 0.079493361 0.062289324 0.0017379534 - 21600 100 0.057299519 0.057299519 0.047939171 0.0020095941 - 21700 100 0.056900097 0.056900097 0.045799124 0.0017782068 - 21800 100 0.039847861 0.039847861 0.035138066 0.0018265057 - 21900 100 0.03919167 0.03919167 0.031815619 0.0012160098 - 22000 100 0.025499317 0.025499317 0.022126202 0.0010056809 - 22100 100 0.018956113 0.018956113 0.017843095 0.0016109368 - 22200 100 0.017337018 0.017337018 0.016063068 0.00042537508 - 22300 100 0.014785686 0.014785686 0.013007571 0.00049466367 - 22400 100 0.011754087 0.011754087 0.010399793 0.00042349151 - 22500 100 0.010362474 0.010362474 0.009077435 0.00025198478 - 22600 100 0.0089484896 0.0089484896 0.0079474121 0.00035239475 - 22700 100 0.0089936432 0.0089936432 0.0077908763 0.00018548371 - 22800 100 0.0068663718 0.0068663718 0.0064061667 0.00025641972 - 22900 100 0.0050272392 0.0050272392 0.0046676214 0.00040466013 - 23000 100 0.0049250142 0.0049250142 0.0044849467 0.00035704909 - 23100 100 0.0050508148 0.0050508148 0.0043117775 0.00030051828 - 23200 100 0.0037293467 0.0037293467 0.0033592517 0.00038108923 - 23300 100 0.0032823722 0.0032823722 0.0030511575 0.00040421775 - 23400 100 0.0026913866 0.0026913866 0.0025493429 9.2813733e-05 - 23500 100 0.0025590632 0.0025590632 0.0024466447 8.4695125e-05 - 23600 100 0.0025270441 0.0025270441 0.0024236554 8.4237376e-05 - 23700 100 0.0026406527 0.0026406527 0.0024501963 0.00015009901 - 23800 100 0.0024633391 0.0024633391 0.0023470594 3.8990761e-05 - 23900 100 0.0029505606 0.0029505606 0.0025122613 4.9810757e-05 - 24000 100 0.0019535519 0.0019535519 0.0019112421 3.5804751e-05 - 24100 100 0.0017505151 0.0017505151 0.001726233 2.380737e-05 - 24200 100 0.0015864857 0.0015864857 0.0015479949 1.963276e-05 - 24300 100 0.0014535898 0.0014535898 0.0014221262 3.6607862e-05 - 24400 100 0.0013744934 0.0013744934 0.0013523293 1.4522467e-05 - 24500 100 0.0013286378 0.0013286378 0.0013097089 3.2389792e-05 - 24600 100 0.0012093624 0.0012093624 0.0011617482 4.848694e-05 - 24700 100 0.0011817062 0.0011817062 0.0011409092 3.8898899e-05 - 24800 100 0.0011142524 0.0011142524 0.0010877723 1.4560662e-05 - 24900 100 0.0010941199 0.0010941199 0.0010614415 7.0209336e-05 - 25000 100 0.0010773559 0.0010773559 0.0010389783 1.3332279e-05 -Loop time of 0.0912137 on 1 procs for 5000 steps with 100 atoms - -Performance: 23680652.416 tau/day, 54816.325 timesteps/s -99.3% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.010053 | 0.010053 | 0.010053 | 0.0 | 11.02 -Neigh | 0.017597 | 0.017597 | 0.017597 | 0.0 | 19.29 -Comm | 0.00092912 | 0.00092912 | 0.00092912 | 0.0 | 1.02 -Output | 0.00049806 | 0.00049806 | 0.00049806 | 0.0 | 0.55 -Modify | 0.056085 | 0.056085 | 0.056085 | 0.0 | 61.49 -Other | | 0.006052 | | | 6.63 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 143 ave 143 max 143 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 143 -Ave neighs/atom = 1.43 -Neighbor list builds = 289 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/granregion/log.27Nov18.granregion.box.g++.4 b/examples/granregion/log.27Nov18.granregion.box.g++.4 deleted file mode 100644 index 170c8be867..0000000000 --- a/examples/granregion/log.27Nov18.granregion.box.g++.4 +++ /dev/null @@ -1,475 +0,0 @@ -LAMMPS (27 Nov 2018) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87) - using 1 OpenMP thread(s) per MPI task -# pouring spheres into container box - -units lj -atom_style sphere -boundary f f f -dimension 3 -comm_modify vel yes - -region box block -10 10 -10 10 -10 10 units box -create_box 2 box -Created orthogonal box = (-10 -10 -10) to (10 10 10) - 1 by 2 by 2 MPI processor grid - -pair_style hybrid gran/hooke 4000.0 NULL 100.0 NULL 0.5 1 -pair_coeff * * gran/hooke - -region container block -6 6 -6 6 -6 6 units box -fix container all wall/gran/region hooke/history 4000.0 NULL 100.0 NULL 0.5 1 region container - -neighbor 0.3 bin -neigh_modify delay 0 every 1 check yes - -fix 2 all nve/sphere -fix 3 all gravity 1.0 vector 0 0 -1 - -region slab block -2 2 -2 2 -2 2 units box -fix ins all pour 100 2 4767548 vol 0.4 10 diam one 1.0 region slab ignore -Particle insertion: 48 every 566 steps, 100 by step 1133 - -timestep 0.005 - -compute 1 all temp -compute_modify 1 dynamic/dof yes - -compute 2 all temp/sphere -compute_modify 2 dynamic/dof yes - -thermo 100 -thermo_style custom step atoms temp c_1 c_2 press -thermo_modify lost ignore -compute_modify thermo_temp dynamic/dof yes - -#dump 2 all image 100 image.*.jpg type type # zoom 1.4 adiam 1.0 box no 0.0 axes yes 0.9 0.03 -#dump_modify 2 pad 5 - -run 5000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.3 - ghost atom cutoff = 1.3 - binsize = 0.65, bins = 31 31 31 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair gran/hooke, perpetual - attributes: half, newton on, size - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 0.4834 | 0.4834 | 0.4834 Mbytes -Step Atoms Temp c_1 c_2 Press - 0 0 0 0 0 0 - 100 21 0.54270729 0.54270729 0.26473526 0.0013567682 - 200 21 0.87606961 0.87606961 0.42735103 0.002190174 - 300 21 1.1428374 1.1428374 0.55748167 0.0028570936 - 400 21 1.3543103 1.3543103 0.66829516 0.0033857758 - 500 21 1.0677786 1.0677786 0.53582407 0.0045048164 - 600 56 0.6744286 0.6744286 0.3502938 0.0047464584 - 700 56 0.75569283 0.75569283 0.39779462 0.0051953882 - 800 56 0.61597505 0.61597505 0.32943642 0.0086022783 - 900 56 0.65260802 0.65260802 0.34474044 0.0059298996 - 1000 56 0.51624952 0.51624952 0.28326898 0.0067827337 - 1100 56 0.46050076 0.46050076 0.25656319 0.0061891094 - 1200 81 0.39112346 0.39112346 0.21690172 0.0086559316 - 1300 81 0.33302617 0.33302617 0.19109398 0.0033381104 - 1400 81 0.3933533 0.3933533 0.21221692 0.004135078 - 1500 81 0.35495297 0.35495297 0.19925984 0.0037374946 - 1600 81 0.34150606 0.34150606 0.19025811 0.0053492835 - 1700 100 0.2561647 0.2561647 0.14186278 0.0090767057 - 1800 100 0.21124278 0.21124278 0.12154878 0.002854576 - 1900 100 0.21793955 0.21793955 0.12173867 0.0029049175 - 2000 100 0.25530858 0.25530858 0.13892272 0.0035528022 - 2100 100 0.24671805 0.24671805 0.13687782 0.0076812357 - 2200 100 0.22465212 0.22465212 0.12513612 0.0042526344 - 2300 100 0.19362805 0.19362805 0.10914275 0.0061175383 - 2400 100 0.061626039 0.061626039 0.045905953 0.0010393593 - 2500 100 0.052690575 0.052690575 0.038879745 0.0018543933 - 2600 100 0.037256691 0.037256691 0.02833916 0.0027683815 - 2700 100 0.033416362 0.033416362 0.024551243 0.00046725913 - 2800 100 0.019617758 0.019617758 0.014619416 0.00064550316 - 2900 100 0.012313874 0.012313874 0.0098188153 0.00033470181 - 3000 100 0.010948455 0.010948455 0.0087981878 0.00034401243 - 3100 100 0.009359431 0.009359431 0.0073642412 0.00045497356 - 3200 100 0.008129885 0.008129885 0.0061460516 0.00029944201 - 3300 100 0.0050682533 0.0050682533 0.0042692811 0.00026543293 - 3400 100 0.0031539312 0.0031539312 0.0027256511 0.00012475748 - 3500 100 0.0023621311 0.0023621311 0.0021691817 0.0001186392 - 3600 100 0.0018305354 0.0018305354 0.0018004128 0.00015926282 - 3700 100 0.0016522492 0.0016522492 0.0017231072 0.0002193159 - 3800 100 0.0011715102 0.0011715102 0.0012739973 0.0001747857 - 3900 100 0.0010607606 0.0010607606 0.0010974725 0.00012476088 - 4000 100 0.00087570802 0.00087570802 0.00095828935 6.5544103e-05 - 4100 100 0.00078598203 0.00078598203 0.00088068743 9.4560761e-05 - 4200 100 0.00088317454 0.00088317454 0.00092784605 8.1108122e-05 - 4300 100 0.0015013254 0.0015013254 0.0012069505 8.8289686e-05 - 4400 100 0.00070054041 0.00070054041 0.00079451193 5.195712e-05 - 4500 100 0.00096259073 0.00096259073 0.00091232511 3.4895669e-05 - 4600 100 0.00056641848 0.00056641848 0.00069083146 3.9657253e-05 - 4700 100 0.0005455099 0.0005455099 0.00064816699 2.8131762e-05 - 4800 100 0.00048254366 0.00048254366 0.00057192255 4.7914432e-05 - 4900 100 0.00037108125 0.00037108125 0.00048035333 6.4711817e-05 - 5000 100 0.00031290399 0.00031290399 0.00042398478 4.6025975e-05 -Loop time of 0.075416 on 4 procs for 5000 steps with 100 atoms - -Performance: 28641126.336 tau/day, 66298.904 timesteps/s -93.7% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0022948 | 0.0041364 | 0.0061705 | 2.8 | 5.48 -Neigh | 0.0043123 | 0.0057145 | 0.0070784 | 1.8 | 7.58 -Comm | 0.014259 | 0.018658 | 0.024313 | 3.3 | 24.74 -Output | 0.0011525 | 0.001404 | 0.0015383 | 0.4 | 1.86 -Modify | 0.0030508 | 0.014543 | 0.026602 | 9.5 | 19.28 -Other | | 0.03096 | | | 41.05 - -Nlocal: 25 ave 51 max 0 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Nghost: 5.5 ave 12 max 0 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Neighs: 39.75 ave 84 max 0 min -Histogram: 2 0 0 0 0 0 0 0 1 1 - -Total # of neighbors = 159 -Ave neighs/atom = 1.59 -Neighbor list builds = 310 -Dangerous builds = 0 - -region container delete -variable theta equal (step-5000)*(4.0*PI/5000) -region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 0 0 1 -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.733 | 5.733 | 5.734 Mbytes -Step Atoms Temp c_1 c_2 Press - 5000 100 0.00031290399 0.00031290399 0.00042398478 4.4282259e-05 - 5100 100 0.62661084 0.62661084 0.33840611 0.012020153 - 5200 100 0.67371678 0.67371678 0.36218522 0.0093514044 - 5300 100 0.75892331 0.75892331 0.4000747 0.010693252 - 5400 100 0.86207426 0.86207426 0.44630388 0.013540097 - 5500 100 0.96205334 0.96205334 0.49432848 0.017375079 - 5600 100 1.0261194 1.0261194 0.52203912 0.016045333 - 5700 100 1.0584366 1.0584366 0.53794336 0.018621676 - 5800 100 1.0881674 1.0881674 0.55300469 0.01930602 - 5900 100 1.1214233 1.1214233 0.56613492 0.021141141 - 6000 100 1.1666836 1.1666836 0.58759377 0.017655361 - 6100 100 1.1785775 1.1785775 0.59365148 0.01829443 - 6200 100 1.2092305 1.2092305 0.60798809 0.018752443 - 6300 100 1.2331787 1.2331787 0.62003386 0.020291021 - 6400 100 1.2561616 1.2561616 0.63143643 0.019899235 - 6500 100 1.284432 1.284432 0.6460504 0.02083284 - 6600 100 1.2678801 1.2678801 0.63882384 0.019456553 - 6700 100 1.2662641 1.2662641 0.63676836 0.020235578 - 6800 100 1.2785484 1.2785484 0.64129093 0.020335162 - 6900 100 1.2916608 1.2916608 0.64764298 0.020154225 - 7000 100 1.2907774 1.2907774 0.64724849 0.020550885 - 7100 100 1.3074473 1.3074473 0.65460147 0.020847362 - 7200 100 1.3124592 1.3124592 0.65641332 0.020897348 - 7300 100 1.3206191 1.3206191 0.66011491 0.021444077 - 7400 100 1.3273988 1.3273988 0.66350669 0.02129418 - 7500 100 1.3343911 1.3343911 0.66707269 0.021337376 - 7600 100 1.3368998 1.3368998 0.66869327 0.021415901 - 7700 100 1.330658 1.330658 0.66535295 0.021500761 - 7800 100 1.330801 1.330801 0.66555123 0.022806058 - 7900 100 1.3392828 1.3392828 0.66926796 0.02194009 - 8000 100 1.3432728 1.3432728 0.67142337 0.022393719 - 8100 100 1.3411612 1.3411612 0.66989302 0.022366895 - 8200 100 1.3427451 1.3427451 0.67054285 0.021966329 - 8300 100 1.3418147 1.3418147 0.67023132 0.022513459 - 8400 100 1.346493 1.346493 0.67247837 0.022705366 - 8500 100 1.3513958 1.3513958 0.6749092 0.022834077 - 8600 100 1.3520297 1.3520297 0.67506261 0.023227676 - 8700 100 1.3517157 1.3517157 0.67485073 0.023043414 - 8800 100 1.3530071 1.3530071 0.67547212 0.022933766 - 8900 100 1.3550454 1.3550454 0.67657277 0.022744182 - 9000 100 1.3554069 1.3554069 0.67673505 0.022802134 - 9100 100 1.3556675 1.3556675 0.67698335 0.022868449 - 9200 100 1.3534709 1.3534709 0.67600677 0.022537792 - 9300 100 1.3525103 1.3525103 0.67569499 0.022687849 - 9400 100 1.3612673 1.3612673 0.67967213 0.022703588 - 9500 100 1.3649439 1.3649439 0.68147385 0.023498539 - 9600 100 1.3629376 1.3629376 0.68063814 0.023515579 - 9700 100 1.3648924 1.3648924 0.68137104 0.023641856 - 9800 100 1.3662063 1.3662063 0.68196538 0.023576884 - 9900 100 1.3689695 1.3689695 0.68326751 0.023572622 - 10000 100 1.3701139 1.3701139 0.68383343 0.023720885 -Loop time of 0.174251 on 4 procs for 5000 steps with 100 atoms - -Performance: 12395939.906 tau/day, 28694.305 timesteps/s -96.5% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0024631 | 0.010709 | 0.020461 | 8.0 | 6.15 -Neigh | 0.0078361 | 0.012368 | 0.016955 | 4.0 | 7.10 -Comm | 0.0059071 | 0.013641 | 0.023547 | 6.6 | 7.83 -Output | 0.0011749 | 0.0021775 | 0.0030091 | 1.4 | 1.25 -Modify | 0.015055 | 0.055709 | 0.097013 | 17.2 | 31.97 -Other | | 0.07965 | | | 45.71 - -Nlocal: 25 ave 51 max 0 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Nghost: 4.5 ave 10 max 0 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Neighs: 49.25 ave 101 max 0 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 197 -Ave neighs/atom = 1.97 -Neighbor list builds = 627 -Dangerous builds = 0 - -region container delete -region container block -6 6 -6 6 -6 6 units box -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.733 | 5.733 | 5.734 Mbytes -Step Atoms Temp c_1 c_2 Press - 10000 100 1.3701139 1.3701139 0.68383343 0.023895921 - 10100 100 0.25960098 0.25960098 0.15183967 0.0049554084 - 10200 100 0.15017576 0.15017576 0.10081112 0.0045433238 - 10300 100 0.10129671 0.10129671 0.078049099 0.0014012658 - 10400 100 0.06742425 0.06742425 0.055603816 0.0010184792 - 10500 100 0.053446366 0.053446366 0.045338293 0.00089291689 - 10600 100 0.041898231 0.041898231 0.036081995 0.00060703885 - 10700 100 0.03580041 0.03580041 0.031118724 0.00067731964 - 10800 100 0.030933755 0.030933755 0.026372348 0.00039362325 - 10900 100 0.027278004 0.027278004 0.022868898 0.0003680788 - 11000 100 0.021566952 0.021566952 0.017994879 0.0013056062 - 11100 100 0.019143625 0.019143625 0.015833865 0.00050998112 - 11200 100 0.015659868 0.015659868 0.013119379 0.00012755696 - 11300 100 0.013554605 0.013554605 0.01147808 0.00027393437 - 11400 100 0.01204033 0.01204033 0.010273026 0.00033430792 - 11500 100 0.010958991 0.010958991 0.0093924566 0.00049023273 - 11600 100 0.01012553 0.01012553 0.0084556996 0.00021457333 - 11700 100 0.0083584131 0.0083584131 0.0071118766 7.7149089e-05 - 11800 100 0.007044883 0.007044883 0.0058675523 0.00036165381 - 11900 100 0.0059875106 0.0059875106 0.0050610372 7.4095443e-05 - 12000 100 0.0045180275 0.0045180275 0.0039006565 0.00014607704 - 12100 100 0.0036631356 0.0036631356 0.0031154279 7.031064e-05 - 12200 100 0.0034443424 0.0034443424 0.0029190637 0.00020974475 - 12300 100 0.0030853504 0.0030853504 0.0026315266 3.4873541e-05 - 12400 100 0.0025451749 0.0025451749 0.0022290833 0.00041551536 - 12500 100 0.0021624857 0.0021624857 0.0019127734 2.6760761e-05 - 12600 100 0.0020637862 0.0020637862 0.0018186641 4.9446655e-05 - 12700 100 0.0019889538 0.0019889538 0.0017604689 3.326943e-05 - 12800 100 0.0018706349 0.0018706349 0.0016669237 2.3327318e-05 - 12900 100 0.0017472824 0.0017472824 0.001579469 8.816765e-05 - 13000 100 0.0016034824 0.0016034824 0.0014549852 3.5407524e-05 - 13100 100 0.00151798 0.00151798 0.0013826659 1.8754149e-05 - 13200 100 0.0013049781 0.0013049781 0.0012137907 0.00015263775 - 13300 100 0.0012270536 0.0012270536 0.0011590841 4.77636e-06 - 13400 100 0.0011395128 0.0011395128 0.0010860297 2.5606328e-05 - 13500 100 0.0010858414 0.0010858414 0.0010486713 5.8563931e-05 - 13600 100 0.0010474389 0.0010474389 0.001015904 1.4319658e-05 - 13700 100 0.00099241549 0.00099241549 0.00097825038 1.2281142e-05 - 13800 100 0.00084449252 0.00084449252 0.00084141963 1.0451215e-05 - 13900 100 0.00084004792 0.00084004792 0.00083755495 3.7174162e-05 - 14000 100 0.00082183505 0.00082183505 0.00082027058 1.0170209e-05 - 14100 100 0.00082377076 0.00082377076 0.00080489795 1.181976e-05 - 14200 100 0.00076903208 0.00076903208 0.00076216608 4.4590341e-05 - 14300 100 0.00075173269 0.00075173269 0.00074828209 2.2134371e-05 - 14400 100 0.00074379148 0.00074379148 0.00074072001 1.5746014e-05 - 14500 100 0.00072454029 0.00072454029 0.0007174429 8.9830398e-06 - 14600 100 0.00072372648 0.00072372648 0.00071678769 9.1111512e-06 - 14700 100 0.00071541587 0.00071541587 0.00070893868 7.8446375e-05 - 14800 100 0.0006820307 0.0006820307 0.00066675502 8.4401299e-06 - 14900 100 0.00067050627 0.00067050627 0.00065751846 0.0001228548 - 15000 100 0.00064977132 0.00064977132 0.00062305247 7.8887775e-06 -Loop time of 0.0746691 on 4 procs for 5000 steps with 100 atoms - -Performance: 28927619.905 tau/day, 66962.083 timesteps/s -96.6% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0021737 | 0.0042608 | 0.0063519 | 3.2 | 5.71 -Neigh | 0.0012126 | 0.0019009 | 0.0026193 | 1.6 | 2.55 -Comm | 0.0023425 | 0.0092477 | 0.016876 | 7.2 | 12.38 -Output | 0.0010619 | 0.0017995 | 0.0030522 | 1.8 | 2.41 -Modify | 0.00097013 | 0.017151 | 0.03415 | 12.3 | 22.97 -Other | | 0.04031 | | | 53.98 - -Nlocal: 25 ave 55 max 0 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Nghost: 3.75 ave 9 max 0 min -Histogram: 2 0 0 0 0 0 1 0 0 1 -Neighs: 42.5 ave 88 max 0 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 170 -Ave neighs/atom = 1.7 -Neighbor list builds = 97 -Dangerous builds = 0 - -region container delete -variable theta equal (step-15000)*(4.0*PI/5000) -region container block -6 6 -6 6 -6 6 units box rotate v_theta 0 0 0 1 1 1 -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.733 | 5.733 | 5.734 Mbytes -Step Atoms Temp c_1 c_2 Press - 15000 100 0.00064977132 0.00064977132 0.00062305247 7.9405607e-06 - 15100 100 1.0123899 1.0123899 0.66185504 0.014587215 - 15200 100 1.0332828 1.0332828 0.67443308 0.014002815 - 15300 100 1.0804076 1.0804076 0.72450056 0.016985272 - 15400 100 1.2868163 1.2868163 0.8708132 0.022190597 - 15500 100 1.5180471 1.5180471 0.99613124 0.026761866 - 15600 100 1.5422016 1.5422016 1.0021746 0.024490139 - 15700 100 1.7142241 1.7142241 1.0611146 0.0301368 - 15800 100 1.8747057 1.8747057 1.1207858 0.027612699 - 15900 100 1.9294819 1.9294819 1.1289025 0.027270228 - 16000 100 1.953275 1.953275 1.1264475 0.031568811 - 16100 100 2.0434228 2.0434228 1.1665365 0.026358952 - 16200 100 2.2129393 2.2129393 1.2448327 0.029613382 - 16300 100 2.2558224 2.2558224 1.2373264 0.028306021 - 16400 100 2.367398 2.367398 1.293448 0.029659303 - 16500 100 2.4221549 2.4221549 1.3198966 0.032541712 - 16600 100 2.510283 2.510283 1.3618001 0.034740544 - 16700 100 2.6776293 2.6776293 1.4508262 0.034556341 - 16800 100 2.8095841 2.8095841 1.5190571 0.035183782 - 16900 100 2.8485646 2.8485646 1.5344387 0.037153336 - 17000 100 3.0298285 3.0298285 1.6321623 0.040745906 - 17100 100 3.0218054 3.0218054 1.6187189 0.042082135 - 17200 100 3.1981705 3.1981705 1.7090597 0.041770208 - 17300 100 3.3178559 3.3178559 1.7723201 0.044604756 - 17400 100 3.3940903 3.3940903 1.8229846 0.049231759 - 17500 100 3.3274817 3.3274817 1.7870996 0.051649102 - 17600 100 3.3204358 3.3204358 1.791527 0.043875639 - 17700 100 3.2185649 3.2185649 1.7480866 0.049941218 - 17800 100 3.2507826 3.2507826 1.7727758 0.048622479 - 17900 100 3.2432767 3.2432767 1.7796296 0.044343902 - 18000 100 3.0841272 3.0841272 1.6978832 0.045344433 - 18100 100 3.0953909 3.0953909 1.699898 0.040070963 - 18200 100 3.1405704 3.1405704 1.7316463 0.042528194 - 18300 100 3.1904871 3.1904871 1.7555188 0.041141165 - 18400 100 3.3256779 3.3256779 1.8243767 0.043908318 - 18500 100 3.5161823 3.5161823 1.9150861 0.045165166 - 18600 100 3.5668273 3.5668273 1.9217975 0.048127705 - 18700 100 3.6648305 3.6648305 1.9685241 0.051205352 - 18800 100 3.9000502 3.9000502 2.0886668 0.05262835 - 18900 100 4.0217758 4.0217758 2.1465498 0.054502839 - 19000 100 3.8431174 3.8431174 2.0581611 0.054852333 - 19100 100 4.1721454 4.1721454 2.2221193 0.053831555 - 19200 100 3.9061181 3.9061181 2.096323 0.058077678 - 19300 100 4.0191085 4.0191085 2.1408069 0.05475437 - 19400 100 3.8840871 3.8840871 2.0887677 0.061905092 - 19500 100 3.8388062 3.8388062 2.0567095 0.051076414 - 19600 100 3.6331742 3.6331742 1.9574769 0.04748008 - 19700 100 3.6996954 3.6996954 1.9887285 0.053305043 - 19800 100 3.8649872 3.8649872 2.0827424 0.060484008 - 19900 100 3.8305733 3.8305733 2.0700281 0.052926584 - 20000 100 3.7948463 3.7948463 2.0657301 0.048516953 -Loop time of 0.156359 on 4 procs for 5000 steps with 100 atoms - -Performance: 13814330.011 tau/day, 31977.616 timesteps/s -94.9% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0040646 | 0.0058124 | 0.0074518 | 1.6 | 3.72 -Neigh | 0.014813 | 0.018389 | 0.020829 | 1.6 | 11.76 -Comm | 0.031892 | 0.034103 | 0.036658 | 1.0 | 21.81 -Output | 0.0013497 | 0.0019822 | 0.003484 | 2.0 | 1.27 -Modify | 0.031006 | 0.046878 | 0.056364 | 4.5 | 29.98 -Other | | 0.0492 | | | 31.46 - -Nlocal: 25 ave 37 max 10 min -Histogram: 1 0 0 0 0 1 0 1 0 1 -Nghost: 3.75 ave 6 max 2 min -Histogram: 1 0 1 0 0 1 0 0 0 1 -Neighs: 36.25 ave 57 max 9 min -Histogram: 1 0 0 0 0 0 2 0 0 1 - -Total # of neighbors = 145 -Ave neighs/atom = 1.45 -Neighbor list builds = 921 -Dangerous builds = 0 - -region container delete -region container block -6 6 -6 6 -6 6 units box -run 5000 -Per MPI rank memory allocation (min/avg/max) = 5.733 | 5.734 | 5.734 Mbytes -Step Atoms Temp c_1 c_2 Press - 20000 100 3.7948463 3.7948463 2.0657301 0.048381317 - 20100 100 1.1359931 1.1359931 0.70170151 0.015300556 - 20200 100 0.87354617 0.87354617 0.55969299 0.012181983 - 20300 100 0.84424484 0.84424484 0.52849351 0.017724782 - 20400 100 0.82422562 0.82422562 0.50175766 0.0098154181 - 20500 100 0.83731289 0.83731289 0.49814627 0.010465327 - 20600 100 0.93125924 0.93125924 0.53803834 0.011624902 - 20700 100 1.0810919 1.0810919 0.60974741 0.01425935 - 20800 100 1.0646343 1.0646343 0.60037545 0.013418132 - 20900 100 1.0608055 1.0608055 0.58353908 0.015119612 - 21000 100 0.68173094 0.68173094 0.3941588 0.0099947535 - 21100 100 0.35407592 0.35407592 0.21306735 0.0043859494 - 21200 100 0.19247432 0.19247432 0.12989264 0.0031808422 - 21300 100 0.13493768 0.13493768 0.093987634 0.0025990872 - 21400 100 0.085735857 0.085735857 0.062091707 0.001434207 - 21500 100 0.074307566 0.074307566 0.05224051 0.0022163094 - 21600 100 0.069932382 0.069932382 0.045388838 0.0020296572 - 21700 100 0.041749712 0.041749712 0.031422931 0.001211155 - 21800 100 0.03378055 0.03378055 0.026248846 0.0020596463 - 21900 100 0.030608528 0.030608528 0.022868294 0.0016282878 - 22000 100 0.025632448 0.025632448 0.019606402 0.0011659657 - 22100 100 0.013785062 0.013785062 0.011561769 0.00069006322 - 22200 100 0.013139066 0.013139066 0.010559726 0.00038424576 - 22300 100 0.01455318 0.01455318 0.011094558 0.00054735929 - 22400 100 0.0096885414 0.0096885414 0.008012617 0.00055875777 - 22500 100 0.0081193116 0.0081193116 0.006802973 0.00052914932 - 22600 100 0.0057159621 0.0057159621 0.0048680253 0.00054864875 - 22700 100 0.0052344376 0.0052344376 0.0045511708 0.00026333033 - 22800 100 0.0054554177 0.0054554177 0.0045005479 0.0002085972 - 22900 100 0.0039455776 0.0039455776 0.0035287888 0.00022514017 - 23000 100 0.0042620461 0.0042620461 0.0035747729 0.00020030999 - 23100 100 0.0035303095 0.0035303095 0.0031995108 0.00016007298 - 23200 100 0.0029747457 0.0029747457 0.0027095904 0.00029775807 - 23300 100 0.0032404433 0.0032404433 0.002769389 0.00019627995 - 23400 100 0.0024965262 0.0024965262 0.0022343473 0.00018870133 - 23500 100 0.00251617 0.00251617 0.0022533604 0.0002661237 - 23600 100 0.0025923653 0.0025923653 0.0022887204 0.00018475201 - 23700 100 0.0023016545 0.0023016545 0.0019829032 0.00014888334 - 23800 100 0.0028358441 0.0028358441 0.0021790504 0.00064613131 - 23900 100 0.0016682403 0.0016682403 0.0014930521 8.8407075e-05 - 24000 100 0.0016341577 0.0016341577 0.0014597606 0.00011262081 - 24100 100 0.0015433636 0.0015433636 0.0013981581 8.364568e-05 - 24200 100 0.0015033978 0.0015033978 0.0013582013 8.4539006e-05 - 24300 100 0.0014513098 0.0014513098 0.0012943981 0.00010546194 - 24400 100 0.0013293352 0.0013293352 0.001206366 8.4967509e-05 - 24500 100 0.0013732518 0.0013732518 0.001202532 0.00014787559 - 24600 100 0.00091890041 0.00091890041 0.00084499923 0.00010080638 - 24700 100 0.00083467915 0.00083467915 0.00077071316 5.3934025e-05 - 24800 100 0.00080701934 0.00080701934 0.0007477161 5.3982095e-05 - 24900 100 0.00080620771 0.00080620771 0.0007471026 5.3581294e-05 - 25000 100 0.00080568604 0.00080568604 0.00074625735 5.3574637e-05 -Loop time of 0.0792506 on 4 procs for 5000 steps with 100 atoms - -Performance: 27255302.560 tau/day, 63090.978 timesteps/s -95.0% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0023611 | 0.0047854 | 0.0077851 | 3.4 | 6.04 -Neigh | 0.0042653 | 0.005571 | 0.0067258 | 1.5 | 7.03 -Comm | 0.0077977 | 0.013373 | 0.019515 | 4.4 | 16.87 -Output | 0.0010924 | 0.0017727 | 0.0030222 | 1.8 | 2.24 -Modify | 0.0023608 | 0.015964 | 0.030545 | 10.5 | 20.14 -Other | | 0.03778 | | | 47.68 - -Nlocal: 25 ave 50 max 0 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Nghost: 5 ave 10 max 0 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Neighs: 35.75 ave 78 max 0 min -Histogram: 2 0 0 0 0 0 0 0 1 1 - -Total # of neighbors = 143 -Ave neighs/atom = 1.43 -Neighbor list builds = 287 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/granregion/log.27Nov18.granregion.funnel.g++.1 b/examples/granregion/log.27Nov18.granregion.funnel.g++.1 deleted file mode 100644 index 0268ed000a..0000000000 --- a/examples/granregion/log.27Nov18.granregion.funnel.g++.1 +++ /dev/null @@ -1,601 +0,0 @@ -LAMMPS (27 Nov 2018) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87) - using 1 OpenMP thread(s) per MPI task -# pour particles into cone-shaped funnel, settle them, let them run out bottom - -variable name string funnel_pour - -thermo_modify flush yes -units si -variable PI equal 3.141592653589 -variable seed equal 14314 - -############################################### -# Geometry-related parameters -############################################### - -variable xlo equal 10 -variable xhi equal 40 -variable ylo equal 10 -variable yhi equal 40 -variable zlo equal -20 -variable zhi equal 50 - -variable xc equal 25 -variable yc equal 25 - -variable zconehi equal 50 -variable zconelo equal 10 -variable zcyllo equal 0 -variable radconelo equal 2 -variable radconehi equal 20 - -################################################ -# Particle sizes -################################################ - -variable rlo equal 0.25 -variable rhi equal 0.5 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.25 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.5 - -variable skin equal ${rhi} -variable skin equal 0.5 - -############################################### -# Granular contact parameters -############################################### - -variable coeffRes equal 0.1 -variable coeffFric equal 0.5 - -variable density equal 1.0 -variable EYoung equal 10^5 -variable Poisson equal 2.0/7.0 -variable GShear equal ${EYoung}/(2*(1+${Poisson})) -variable GShear equal 100000/(2*(1+${Poisson})) -variable GShear equal 100000/(2*(1+0.285714285714286)) - -variable gravity equal 1.0 - -variable reff equal 0.5*(${rhi}+${rlo}) -variable reff equal 0.5*(0.5+${rlo}) -variable reff equal 0.5*(0.5+0.25) -variable meff equal ${density}*4.0/3.0*${PI}*${reff}^3 -variable meff equal 1*4.0/3.0*${PI}*${reff}^3 -variable meff equal 1*4.0/3.0*3.141592653589*${reff}^3 -variable meff equal 1*4.0/3.0*3.141592653589*0.375^3 -variable min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*0.25 -variable max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*${rhi}*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*0.5 - -## Typical way to set kn, kt, etc.: -variable kn equal 4.0*${GShear}/(3*(1-${Poisson})) -variable kn equal 4.0*38888.8888888889/(3*(1-${Poisson})) -variable kn equal 4.0*38888.8888888889/(3*(1-0.285714285714286)) -variable kt equal 4.0*${GShear}/(2-${Poisson}) -variable kt equal 4.0*38888.8888888889/(2-${Poisson}) -variable kt equal 4.0*38888.8888888889/(2-0.285714285714286) - -variable a equal (-2.0*log(${coeffRes})/${PI})^2 -variable a equal (-2.0*log(0.1)/${PI})^2 -variable a equal (-2.0*log(0.1)/3.141592653589)^2 -variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*0.405284734569556)) -variable gamma_t equal ${gamma_n}*0.5 -variable gamma_t equal 903.503751814138*0.5 - -variable tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/${min_mass}-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-903.503751814138/4.0) - -variable dt equal ${tcol}*0.05 -variable dt equal 0.00210943016014969*0.05 -timestep ${dt} -timestep 0.000105471508007485 - -############################################### -variable dumpfreq equal 1000 -variable logfreq equal 1000 - -newton off -atom_style sphere - -boundary p p f - -region boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} -region boxreg block 10 ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} -region boxreg block 10 40 ${ylo} ${yhi} ${zlo} ${zhi} -region boxreg block 10 40 10 ${yhi} ${zlo} ${zhi} -region boxreg block 10 40 10 40 ${zlo} ${zhi} -region boxreg block 10 40 10 40 -20 ${zhi} -region boxreg block 10 40 10 40 -20 50 -create_box 1 boxreg -Created orthogonal box = (10 10 -20) to (40 40 50) - 1 by 1 by 1 MPI processor grid - -pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 -pair_coeff * * - -neighbor ${skin} bin -neighbor 0.5 bin -thermo ${logfreq} -thermo 1000 - -comm_style brick -comm_modify mode multi group all vel yes -balance 1.1 shift xyz 20 1.1 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 30, bins = 1 1 3 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair gran/hertz/history, perpetual - attributes: half, newton off, size, history - pair build: half/size/bin/newtoff - stencil: half/bin/3d/newtoff - bin: standard -fix bal all balance 10000 1.1 shift xyz 20 1.01 - -####################### Options specific to pouring ######################### - -# insertion region for fix/pour - -region insreg cylinder z ${xc} ${yc} 10 30 50 side in units box -region insreg cylinder z 25 ${yc} 10 30 50 side in units box -region insreg cylinder z 25 25 10 30 50 side in units box - -# define cone and cylinder regions - see lammps doc on region command -# note new open options - -region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 #Top is open -region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 2 0 10 side in units box open 2 - -region conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 #Bottom and top are open -region conereg cone z 25 ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 20 ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 20 10 ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 20 10 50 side in units box open 1 open 2 - -region hopreg union 2 conereg cylreg - -fix grav all gravity ${gravity} vector 0 0 -1 -fix grav all gravity 1 vector 0 0 -1 -fix 1 all nve/sphere - - -fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg - -fix ins all pour 2000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 ${dhi} dens ${density} ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens ${density} ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 1 -Particle insertion: 3000 every 59965 steps, 2000 by step 1 - -#dump 1 all custom ${dumpfreq} ${name}.dump # id type mass diameter x y z - -#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 3.0 # box no 0.0 axes no 0.0 0.0 -#dump_modify 2 pad 6 - -thermo_style custom step cpu atoms ke -WARNING: New thermo_style command, previous thermo_modify settings will be lost (src/output.cpp:705) -thermo_modify flush yes lost warn - -# Initial run to fill up the cone - -run 20000 -Per MPI rank memory allocation (min/avg/max) = 6.649 | 6.649 | 6.649 Mbytes -Step CPU Atoms KinEng - 0 0 0 -0 - 1000 0.63593698 2000 -0 - 2000 1.0282419 2000 -0 - 3000 1.4184453 2000 -0 - 4000 1.8055785 2000 -0 - 5000 2.1941335 2000 -0 - 6000 2.5804653 2000 -0 - 7000 2.9660621 2000 -0 - 8000 3.3506265 2000 -0 - 9000 3.7344413 2000 -0 - 10000 4.1212304 2000 -0 - 11000 4.5044594 2000 -0 - 12000 4.8875456 2000 -0 - 13000 5.2698007 2000 -0 - 14000 5.6527214 2000 -0 - 15000 6.0349295 2000 -0 - 16000 6.4172938 2000 -0 - 17000 6.8001184 2000 -0 - 18000 7.1826644 2000 -0 - 19000 7.5654378 2000 -0 - 20000 7.9511659 2000 -0 -Loop time of 7.95118 on 1 procs for 20000 steps with 2000 atoms - -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.6189 | 0.6189 | 0.6189 | 0.0 | 7.78 -Neigh | 0.09361 | 0.09361 | 0.09361 | 0.0 | 1.18 -Comm | 0.016098 | 0.016098 | 0.016098 | 0.0 | 0.20 -Output | 0.00048828 | 0.00048828 | 0.00048828 | 0.0 | 0.01 -Modify | 6.9973 | 6.9973 | 6.9973 | 0.0 | 88.00 -Other | | 0.2248 | | | 2.83 - -Nlocal: 2000 ave 2000 max 2000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1537 ave 1537 max 1537 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 1537 -Ave neighs/atom = 0.7685 -Neighbor list builds = 69 -Dangerous builds = 0 -unfix ins -run 150000 -Per MPI rank memory allocation (min/avg/max) = 12.77 | 12.77 | 12.77 Mbytes -Step CPU Atoms KinEng - 20000 0 2000 6443.7665 - 21000 0.3826313 2000 6572.3531 - 22000 0.76688981 2000 6723.8376 - 23000 1.1534231 2000 6853.1812 - 24000 1.5391715 2000 6976.0209 - 25000 1.9263508 2000 7096.9955 - 26000 2.3168406 2000 7215.5795 - 27000 2.7065961 2000 7349.2382 - 28000 3.096664 2000 7471.8719 - 29000 3.4905531 2000 7574.8228 - 30000 3.8877606 2000 7659.3836 - 31000 4.2839894 2000 7703.6856 - 32000 4.6859732 2000 7644.279 - 33000 5.0932801 2000 7526.6944 - 34000 5.5045564 2000 7370.0821 - 35000 5.9206297 2000 7193.0457 - 36000 6.343729 2000 6990.9899 - 37000 6.7719142 2000 6849.2841 - 38000 7.2016783 2000 6701.7433 - 39000 7.6354482 2000 6538.9557 - 40000 8.078445 2000 6381.9346 - 41000 8.5191586 2000 6217.5253 - 42000 8.9630713 2000 6093.5344 - 43000 9.4097741 2000 5943.0479 - 44000 9.8652256 2000 5841.0782 - 45000 10.331057 2000 5652.8319 - 46000 10.803253 2000 5476.1466 - 47000 11.278766 2000 5267.7855 - 48000 11.759121 2000 5131.4036 - 49000 12.248896 2000 4972.7696 - 50000 12.747719 2000 4867.0868 - 51000 13.246704 2000 4681.897 - 52000 13.757842 2000 4506.8185 - 53000 14.276078 2000 4346.8045 - 54000 14.795933 2000 4193.8194 - 55000 15.311241 2000 4058.2049 - 56000 15.828737 2000 3879.0325 - 57000 16.359453 2000 3696.3154 - 58000 16.905406 2000 3504.0399 - 59000 17.460454 2000 3284.6522 - 60000 18.027276 2000 3061.0727 - 61000 18.586931 2000 2874.2926 - 62000 19.158563 2000 2653.0722 - 63000 19.738442 2000 2437.4941 - 64000 20.331411 2000 2124.1876 - 65000 20.936204 2000 1864.5661 - 66000 21.547443 2000 1610.2335 - 67000 22.166888 2000 1390.0428 - 68000 22.789106 2000 1163.7679 - 69000 23.416016 2000 933.0928 - 70000 24.038879 2000 745.66667 - 71000 24.663115 2000 605.58458 - 72000 25.294193 2000 444.31183 - 73000 25.932019 2000 357.19162 - 74000 26.568184 2000 291.16762 - 75000 27.203393 2000 230.58362 - 76000 27.836079 2000 197.59502 - 77000 28.467344 2000 166.55702 - 78000 29.099997 2000 139.89052 - 79000 29.741694 2000 117.1145 - 80000 30.388097 2000 100.12353 - 81000 31.036193 2000 85.233155 - 82000 31.688463 2000 71.145302 - 83000 32.343411 2000 61.545348 - 84000 32.999346 2000 54.099358 - 85000 33.652976 2000 46.922028 - 86000 34.306931 2000 41.606645 - 87000 34.967787 2000 37.462793 - 88000 35.633721 2000 33.698298 - 89000 36.310035 2000 29.340455 - 90000 36.995441 2000 26.072122 - 91000 37.67904 2000 23.20848 - 92000 38.367699 2000 21.015862 - 93000 39.058641 2000 20.134175 - 94000 39.749342 2000 19.196075 - 95000 40.442651 2000 18.285127 - 96000 41.140177 2000 17.476411 - 97000 41.840761 2000 16.55882 - 98000 42.543845 2000 15.444541 - 99000 43.256415 2000 14.41642 - 100000 43.97382 2000 13.818738 - 101000 44.684596 2000 12.878373 - 102000 45.401082 2000 12.11804 - 103000 46.120936 2000 11.016885 - 104000 46.83935 2000 10.531044 - 105000 47.559419 2000 10.46735 - 106000 48.286016 2000 10.246007 - 107000 49.012266 2000 9.6423041 - 108000 49.74013 2000 9.3948808 - 109000 50.471961 2000 9.5178141 - 110000 51.206152 2000 9.4143884 - 111000 51.939123 2000 9.5058226 - 112000 52.673443 2000 9.6911516 - 113000 53.410485 2000 9.7756849 - 114000 54.152537 2000 9.3876232 - 115000 54.891784 2000 8.6725333 - 116000 55.631474 2000 8.6691065 - 117000 56.371762 2000 8.0156055 - 118000 57.110131 2000 7.9150786 - 119000 57.8533 2000 7.5310892 - 120000 58.599064 2000 7.2940498 - 121000 59.340753 2000 6.8347898 - 122000 60.084676 2000 6.696484 - 123000 60.826952 2000 6.7799146 - 124000 61.569413 2000 6.7901567 - 125000 62.316334 2000 6.7532108 - 126000 63.061374 2000 6.762162 - 127000 63.806385 2000 6.6317366 - 128000 64.555969 2000 6.8246399 - 129000 65.308131 2000 6.9130358 - 130000 66.060967 2000 7.1750566 - 131000 66.809725 2000 6.9507379 - 132000 67.559796 2000 6.7987445 - 133000 68.314249 2000 6.8535775 - 134000 69.065513 2000 7.0255144 - 135000 69.817604 2000 6.7381064 - 136000 70.572079 2000 6.5567748 - 137000 71.324444 2000 6.2655395 - 138000 72.079147 2000 6.1923013 - 139000 72.831323 2000 6.0958081 - 140000 73.59117 2000 5.9185709 - 141000 74.343753 2000 5.9151241 - 142000 75.096509 2000 5.4743035 - 143000 75.852151 2000 5.438642 - 144000 76.605005 2000 4.6646664 - 145000 77.357571 2000 4.6899837 - 146000 78.113125 2000 4.5357917 - 147000 78.867751 2000 4.5993842 - 148000 79.625344 2000 4.7076884 - 149000 80.37992 2000 4.8306642 - 150000 81.143175 2000 4.8282147 - 151000 81.899326 2000 4.546308 - 152000 82.658645 2000 4.6700755 - 153000 83.41837 2000 4.7557633 - 154000 84.17509 2000 4.9004538 - 155000 84.934161 2000 5.0552949 - 156000 85.695466 2000 4.0672495 - 157000 86.453115 2000 3.5819543 - 158000 87.212663 2000 3.3533477 - 159000 87.967768 2000 3.3281001 - 160000 88.729631 2000 3.0831743 - 161000 89.498983 2000 3.0519269 - 162000 90.259424 2000 3.0951675 - 163000 91.019656 2000 2.9868352 - 164000 91.776359 2000 2.9195788 - 165000 92.536374 2000 2.5637813 - 166000 93.296332 2000 2.5553272 - 167000 94.05653 2000 2.0752912 - 168000 94.814559 2000 1.9689845 - 169000 95.576005 2000 1.9117916 - 170000 96.337863 2000 1.8568914 -Loop time of 96.3379 on 1 procs for 150000 steps with 2000 atoms - -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 37.121 | 37.121 | 37.121 | 0.0 | 38.53 -Neigh | 0.8454 | 0.8454 | 0.8454 | 0.0 | 0.88 -Comm | 0.11506 | 0.11506 | 0.11506 | 0.0 | 0.12 -Output | 0.004431 | 0.004431 | 0.004431 | 0.0 | 0.00 -Modify | 56.517 | 56.517 | 56.517 | 0.0 | 58.67 -Other | | 1.735 | | | 1.80 - -Nlocal: 2000 ave 2000 max 2000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 15524 ave 15524 max 15524 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 15524 -Ave neighs/atom = 7.762 -Neighbor list builds = 388 -Dangerous builds = 0 - -# remove "plug" - need to redefine cylinder region & union - -region cylreg delete -region hopreg delete -region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 #Bottom & top are open -region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 2 0 10 side in units box open 1 open 2 - -region hopreg union 2 cylreg conereg - -unfix hopper3 -fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg - -run 100000 -Per MPI rank memory allocation (min/avg/max) = 18.64 | 18.64 | 18.64 Mbytes -Step CPU Atoms KinEng - 170000 0 2000 1.8568914 - 171000 0.75704765 2000 2.4011583 - 172000 1.5101345 2000 3.176628 - 173000 2.2556529 2000 4.5364486 - 174000 2.9946566 2000 6.5494125 - 175000 3.7253478 2000 9.1934319 - 176000 4.4570525 2000 12.25765 - 177000 5.1876664 2000 15.799657 - 178000 5.9178619 2000 19.982558 - 179000 6.6439464 2000 24.927165 - 180000 7.3749168 2000 30.428362 - 181000 8.1011977 2000 36.74232 - 182000 8.8207343 2000 43.820448 - 183000 9.5397925 2000 50.903222 - 184000 10.253098 2000 59.425781 - 185000 10.965505 2000 69.143119 - 186000 11.673319 2000 79.210705 - 187000 12.373966 2000 90.411346 - 188000 13.075475 2000 102.35389 - 189000 13.770632 2000 114.93888 - 190000 14.469445 2000 128.63341 - 191000 15.158381 2000 143.44526 - 192000 15.846267 2000 159.04574 - 193000 16.527754 2000 174.3114 - 194000 17.204808 2000 190.42123 - 195000 17.881059 2000 207.70459 - 196000 18.556555 2000 224.90931 - 197000 19.229818 2000 242.64914 - 198000 19.905086 2000 261.48312 - 199000 20.578518 2000 281.28308 - 200000 21.25632 2000 302.95108 - 201000 21.921347 2000 325.95534 - 202000 22.583873 2000 350.6874 - 203000 23.244724 2000 376.31773 - 204000 23.904842 2000 404.21947 - 205000 24.562788 2000 432.96116 - 206000 25.217762 2000 462.4113 - 207000 25.875814 2000 491.91207 - 208000 26.531285 2000 522.15395 - 209000 27.184766 2000 553.1024 - 210000 27.842961 2000 585.7133 - 211000 28.489339 2000 619.96357 - 212000 29.139612 2000 653.96189 - 213000 29.783866 2000 689.8027 - 214000 30.426881 2000 727.28401 - 215000 31.06706 2000 766.40354 - 216000 31.706399 2000 805.65433 - 217000 32.343033 2000 845.40981 - 218000 32.989384 2000 884.24637 - 219000 33.633664 2000 923.5998 - 220000 34.285172 2000 965.01779 - 221000 34.931959 2000 1009.1763 - 222000 35.571624 2000 1054.7789 - 223000 36.207868 2000 1101.9922 - 224000 36.836062 2000 1151.1205 - 225000 37.464514 2000 1201.3979 - 226000 38.09746 2000 1252.4054 - 227000 38.732507 1999 1296.6784 - 228000 39.371367 1997 1342.3466 - 229000 40.012553 1992 1368.8559 - 230000 40.652111 1977 1360.2259 - 231000 41.275478 1965 1340.3793 - 232000 41.892734 1953 1318.8318 - 233000 42.50588 1938 1295.5667 - 234000 43.121427 1924 1270.0641 - 235000 43.740727 1914 1258.296 - 236000 44.359241 1902 1224.3945 - 237000 44.979463 1899 1248.3905 - 238000 45.597358 1885 1206.9229 - 239000 46.210114 1875 1195.5429 - 240000 46.818148 1861 1142.6591 - 241000 47.411079 1851 1131.5523 - 242000 48.002522 1841 1116.8741 - 243000 48.594254 1830 1099.9978 - 244000 49.191798 1822 1078.6068 - 245000 49.791332 1814 1072.1498 - 246000 50.389728 1803 1020.7842 - 247000 50.984212 1794 1000.1936 - 248000 51.571047 1781 942.02462 - 249000 52.149428 1772 916.83697 - 250000 52.726202 1758 825.10751 - 251000 53.29913 1748 789.06351 - 252000 53.871912 1739 753.92258 - 253000 54.441009 1729 697.83686 - 254000 55.010203 1718 648.98541 - 255000 55.573602 1710 620.38129 - 256000 56.134709 1705 622.43466 - 257000 56.701827 1700 595.79102 - 258000 57.264463 1698 608.49223 - 259000 57.827817 1695 614.0119 - 260000 58.398994 1690 601.50438 - 261000 58.964611 1687 608.5892 - 262000 59.526765 1683 597.07884 - 263000 60.082729 1682 618.65041 - 264000 60.640105 1678 615.47784 - 265000 61.195717 1675 605.27658 - 266000 61.751087 1671 583.69853 - 267000 62.305546 1669 600.11043 - 268000 62.86105 1666 598.79807 - 269000 63.417551 1663 588.40338 - 270000 63.974486 1660 579.59387 -Loop time of 63.9745 on 1 procs for 100000 steps with 1660 atoms - -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 26.514 | 26.514 | 26.514 | 0.0 | 41.44 -Neigh | 0.60324 | 0.60324 | 0.60324 | 0.0 | 0.94 -Comm | 0.075881 | 0.075881 | 0.075881 | 0.0 | 0.12 -Output | 0.0029137 | 0.0029137 | 0.0029137 | 0.0 | 0.00 -Modify | 35.686 | 35.686 | 35.686 | 0.0 | 55.78 -Other | | 1.092 | | | 1.71 - -Nlocal: 1660 ave 1660 max 1660 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 11681 ave 11681 max 11681 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 11681 -Ave neighs/atom = 7.03675 -Neighbor list builds = 249 -Dangerous builds = 0 -Total wall time: 0:02:48 diff --git a/examples/granregion/log.27Nov18.granregion.funnel.g++.4 b/examples/granregion/log.27Nov18.granregion.funnel.g++.4 deleted file mode 100644 index 67c307d212..0000000000 --- a/examples/granregion/log.27Nov18.granregion.funnel.g++.4 +++ /dev/null @@ -1,601 +0,0 @@ -LAMMPS (27 Nov 2018) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87) - using 1 OpenMP thread(s) per MPI task -# pour particles into cone-shaped funnel, settle them, let them run out bottom - -variable name string funnel_pour - -thermo_modify flush yes -units si -variable PI equal 3.141592653589 -variable seed equal 14314 - -############################################### -# Geometry-related parameters -############################################### - -variable xlo equal 10 -variable xhi equal 40 -variable ylo equal 10 -variable yhi equal 40 -variable zlo equal -20 -variable zhi equal 50 - -variable xc equal 25 -variable yc equal 25 - -variable zconehi equal 50 -variable zconelo equal 10 -variable zcyllo equal 0 -variable radconelo equal 2 -variable radconehi equal 20 - -################################################ -# Particle sizes -################################################ - -variable rlo equal 0.25 -variable rhi equal 0.5 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.25 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.5 - -variable skin equal ${rhi} -variable skin equal 0.5 - -############################################### -# Granular contact parameters -############################################### - -variable coeffRes equal 0.1 -variable coeffFric equal 0.5 - -variable density equal 1.0 -variable EYoung equal 10^5 -variable Poisson equal 2.0/7.0 -variable GShear equal ${EYoung}/(2*(1+${Poisson})) -variable GShear equal 100000/(2*(1+${Poisson})) -variable GShear equal 100000/(2*(1+0.285714285714286)) - -variable gravity equal 1.0 - -variable reff equal 0.5*(${rhi}+${rlo}) -variable reff equal 0.5*(0.5+${rlo}) -variable reff equal 0.5*(0.5+0.25) -variable meff equal ${density}*4.0/3.0*${PI}*${reff}^3 -variable meff equal 1*4.0/3.0*${PI}*${reff}^3 -variable meff equal 1*4.0/3.0*3.141592653589*${reff}^3 -variable meff equal 1*4.0/3.0*3.141592653589*0.375^3 -variable min_mass equal ${density}*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*${PI}*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*${rlo} -variable min_mass equal 1*4.0/3.0*3.141592653589*0.25*0.25*0.25 -variable max_mass equal ${density}*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*${PI}*${rhi}*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*${rhi}*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*${rhi}*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*${rhi} -variable max_mass equal 1*4.0/3.0*3.141592653589*0.5*0.5*0.5 - -## Typical way to set kn, kt, etc.: -variable kn equal 4.0*${GShear}/(3*(1-${Poisson})) -variable kn equal 4.0*38888.8888888889/(3*(1-${Poisson})) -variable kn equal 4.0*38888.8888888889/(3*(1-0.285714285714286)) -variable kt equal 4.0*${GShear}/(2-${Poisson}) -variable kt equal 4.0*38888.8888888889/(2-${Poisson}) -variable kt equal 4.0*38888.8888888889/(2-0.285714285714286) - -variable a equal (-2.0*log(${coeffRes})/${PI})^2 -variable a equal (-2.0*log(0.1)/${PI})^2 -variable a equal (-2.0*log(0.1)/3.141592653589)^2 -variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569556*2*72592.5925925926/0.0654498469497708/(1+0.25*0.405284734569556)) -variable gamma_t equal ${gamma_n}*0.5 -variable gamma_t equal 903.503751814138*0.5 - -variable tcol equal ${PI}/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/${min_mass}-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-${gamma_n}/4.0) -variable tcol equal 3.141592653589/sqrt(2*72592.5925925926/0.0654498469497708-903.503751814138/4.0) - -variable dt equal ${tcol}*0.05 -variable dt equal 0.00210943016014969*0.05 -timestep ${dt} -timestep 0.000105471508007485 - -############################################### -variable dumpfreq equal 1000 -variable logfreq equal 1000 - -newton off -atom_style sphere - -boundary p p f - -region boxreg block ${xlo} ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} -region boxreg block 10 ${xhi} ${ylo} ${yhi} ${zlo} ${zhi} -region boxreg block 10 40 ${ylo} ${yhi} ${zlo} ${zhi} -region boxreg block 10 40 10 ${yhi} ${zlo} ${zhi} -region boxreg block 10 40 10 40 ${zlo} ${zhi} -region boxreg block 10 40 10 40 -20 ${zhi} -region boxreg block 10 40 10 40 -20 50 -create_box 1 boxreg -Created orthogonal box = (10 10 -20) to (40 40 50) - 1 by 1 by 4 MPI processor grid - -pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 -pair_style gran/hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 -pair_coeff * * - -neighbor ${skin} bin -neighbor 0.5 bin -thermo ${logfreq} -thermo 1000 - -comm_style brick -comm_modify mode multi group all vel yes -balance 1.1 shift xyz 20 1.1 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 30, bins = 1 1 3 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair gran/hertz/history, perpetual - attributes: half, newton off, size, history - pair build: half/size/bin/newtoff - stencil: half/bin/3d/newtoff - bin: standard -fix bal all balance 10000 1.1 shift xyz 20 1.01 - -####################### Options specific to pouring ######################### - -# insertion region for fix/pour - -region insreg cylinder z ${xc} ${yc} 10 30 50 side in units box -region insreg cylinder z 25 ${yc} 10 30 50 side in units box -region insreg cylinder z 25 25 10 30 50 side in units box - -# define cone and cylinder regions - see lammps doc on region command -# note new open options - -region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 #Top is open -region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 2 -region cylreg cylinder z 25 25 2 0 10 side in units box open 2 - -region conereg cone z ${xc} ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 #Bottom and top are open -region conereg cone z 25 ${yc} ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 ${radconelo} ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 ${radconehi} ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 20 ${zconelo} ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 20 10 ${zconehi} side in units box open 1 open 2 -region conereg cone z 25 25 2 20 10 50 side in units box open 1 open 2 - -region hopreg union 2 conereg cylreg - -fix grav all gravity ${gravity} vector 0 0 -1 -fix grav all gravity 1 vector 0 0 -1 -fix 1 all nve/sphere - - -fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg - -fix ins all pour 2000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 ${dhi} dens ${density} ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens ${density} ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 ${density} -fix ins all pour 2000 1 42424 region insreg diam range 0.5 1 dens 1 1 -Particle insertion: 3000 every 59965 steps, 2000 by step 1 - -#dump 1 all custom ${dumpfreq} ${name}.dump # id type mass diameter x y z - -#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 3.0 # box no 0.0 axes no 0.0 0.0 -#dump_modify 2 pad 6 - -thermo_style custom step cpu atoms ke -WARNING: New thermo_style command, previous thermo_modify settings will be lost (src/output.cpp:705) -thermo_modify flush yes lost warn - -# Initial run to fill up the cone - -run 20000 -Per MPI rank memory allocation (min/avg/max) = 6.05 | 6.05 | 6.05 Mbytes -Step CPU Atoms KinEng - 0 0 0 -0 - 1000 0.63366675 2000 -0 - 2000 1.0221362 2000 -0 - 3000 1.3905275 2000 -0 - 4000 1.7514329 2000 -0 - 5000 2.1040537 2000 -0 - 6000 2.4468088 2000 -0 - 7000 2.7853072 2000 -0 - 8000 3.1109948 2000 -0 - 9000 3.4281557 2000 -0 - 10000 3.7435207 2000 -0 - 11000 3.8612552 2000 -0 - 12000 3.9786677 2000 -0 - 13000 4.0988154 2000 -0 - 14000 4.2249811 2000 -0 - 15000 4.3562138 2000 -0 - 16000 4.4940333 2000 -0 - 17000 4.6394637 2000 -0 - 18000 4.7909062 2000 -0 - 19000 4.9482198 2000 -0 - 20000 5.1116607 2000 -0 -Loop time of 5.11176 on 4 procs for 20000 steps with 2000 atoms - -97.4% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.050997 | 0.14884 | 0.36048 | 32.0 | 2.91 -Neigh | 0.01374 | 0.025199 | 0.043743 | 7.0 | 0.49 -Comm | 0.063387 | 0.1781 | 0.29748 | 22.6 | 3.48 -Output | 0.0016627 | 0.0060938 | 0.015082 | 6.8 | 0.12 -Modify | 1.1198 | 1.987 | 3.7195 | 72.6 | 38.87 -Other | | 2.767 | | | 54.12 - -Nlocal: 500 ave 505 max 493 min -Histogram: 1 0 0 0 0 1 0 1 0 1 -Nghost: 159.25 ave 254 max 71 min -Histogram: 1 0 0 1 0 1 0 0 0 1 -Neighs: 397.5 ave 616 max 214 min -Histogram: 1 0 1 0 0 0 1 0 0 1 - -Total # of neighbors = 1590 -Ave neighs/atom = 0.795 -Neighbor list builds = 69 -Dangerous builds = 0 -unfix ins -run 150000 -Per MPI rank memory allocation (min/avg/max) = 12.37 | 12.51 | 12.7 Mbytes -Step CPU Atoms KinEng - 20000 0 2000 6443.7665 - 21000 0.11261106 2000 6572.3531 - 22000 0.23091817 2000 6723.8376 - 23000 0.35577631 2000 6853.1812 - 24000 0.48790455 2000 6976.0209 - 25000 0.63509274 2000 7096.9955 - 26000 0.78251743 2000 7215.5795 - 27000 0.93707466 2000 7349.2382 - 28000 1.1032445 2000 7471.8719 - 29000 1.2721858 2000 7574.8228 - 30000 1.449265 2000 7659.3836 - 31000 1.5742557 2000 7703.6856 - 32000 1.7076068 2000 7644.279 - 33000 1.8527873 2000 7526.6944 - 34000 2.009855 2000 7370.0821 - 35000 2.1766446 2000 7193.0459 - 36000 2.3557482 2000 6990.9912 - 37000 2.5468907 2000 6849.286 - 38000 2.7480681 2000 6701.7548 - 39000 2.9574037 2000 6538.6915 - 40000 3.1807711 2000 6382.3209 - 41000 3.3486595 2000 6216.424 - 42000 3.5162592 2000 6091.29 - 43000 3.687057 2000 5945.3256 - 44000 3.8662596 2000 5840.875 - 45000 4.0557241 2000 5649.763 - 46000 4.2541051 2000 5476.2837 - 47000 4.4571214 2000 5277.0701 - 48000 4.6628008 2000 5123.9796 - 49000 4.8686502 2000 4968.3344 - 50000 5.0788848 2000 4869.5754 - 51000 5.2552598 2000 4704.8517 - 52000 5.4428713 2000 4522.8978 - 53000 5.6520596 2000 4393.8047 - 54000 5.8613031 2000 4235.438 - 55000 6.0776098 2000 4082.3073 - 56000 6.2998042 2000 3901.0483 - 57000 6.5321434 2000 3718.0882 - 58000 6.7745438 2000 3504.621 - 59000 7.0237701 2000 3285.7484 - 60000 7.2791855 2000 3047.3386 - 61000 7.489058 2000 2875.4032 - 62000 7.7044094 2000 2647.83 - 63000 7.9194827 2000 2396.5343 - 64000 8.1429474 2000 2107.2113 - 65000 8.3745618 2000 1858.1977 - 66000 8.610673 2000 1615.8096 - 67000 8.8505244 2000 1416.5065 - 68000 9.0955915 2000 1206.8534 - 69000 9.3609676 2000 953.93974 - 70000 9.6382594 2000 766.9148 - 71000 9.8719468 2000 611.45063 - 72000 10.095534 2000 464.94805 - 73000 10.317962 2000 364.31415 - 74000 10.547287 2000 298.77524 - 75000 10.764052 2000 245.73022 - 76000 10.978769 2000 207.8035 - 77000 11.199921 2000 179.1305 - 78000 11.410296 2000 151.21032 - 79000 11.624499 2000 124.49675 - 80000 11.849562 2000 106.71504 - 81000 12.077449 2000 93.299034 - 82000 12.306904 2000 81.220408 - 83000 12.539016 2000 67.383955 - 84000 12.773108 2000 57.287165 - 85000 13.009487 2000 49.255887 - 86000 13.252544 2000 44.082536 - 87000 13.502564 2000 40.193574 - 88000 13.747198 2000 36.903867 - 89000 13.993028 2000 33.55332 - 90000 14.240036 2000 30.730912 - 91000 14.472719 2000 28.650574 - 92000 14.708542 2000 26.377609 - 93000 14.948106 2000 24.433165 - 94000 15.186653 2000 22.933076 - 95000 15.428022 2000 22.31788 - 96000 15.676323 2000 20.829124 - 97000 15.916326 2000 19.401354 - 98000 16.160197 2000 18.943699 - 99000 16.404796 2000 17.690599 - 100000 16.659731 2000 17.215943 - 101000 16.904498 2000 15.948087 - 102000 17.150993 2000 15.140324 - 103000 17.39584 2000 14.885674 - 104000 17.643707 2000 14.414752 - 105000 17.889343 2000 14.270676 - 106000 18.136159 2000 13.943799 - 107000 18.383653 2000 13.840145 - 108000 18.630952 2000 12.826341 - 109000 18.878218 2000 12.209012 - 110000 19.125558 2000 11.916194 - 111000 19.3726 2000 11.970849 - 112000 19.621494 2000 11.56909 - 113000 19.869978 2000 11.390562 - 114000 20.123402 2000 11.276545 - 115000 20.370963 2000 11.171298 - 116000 20.619975 2000 11.686225 - 117000 20.869585 2000 11.379805 - 118000 21.118875 2000 10.539511 - 119000 21.36837 2000 10.064595 - 120000 21.629511 2000 10.003722 - 121000 21.877867 2000 9.6974586 - 122000 22.127922 2000 9.7156209 - 123000 22.378215 2000 9.615256 - 124000 22.630463 2000 8.8979008 - 125000 22.882154 2000 8.2220003 - 126000 23.135763 2000 8.3153866 - 127000 23.392389 2000 8.0945497 - 128000 23.645521 2000 7.8942467 - 129000 23.89965 2000 7.4794776 - 130000 24.153195 2000 7.3635341 - 131000 24.406239 2000 7.5757743 - 132000 24.66016 2000 7.7047492 - 133000 24.914093 2000 8.0142133 - 134000 25.173429 2000 8.1716714 - 135000 25.433318 2000 7.7803343 - 136000 25.692997 2000 6.3545482 - 137000 25.947787 2000 6.313769 - 138000 26.200427 2000 6.4948596 - 139000 26.452514 2000 6.6183259 - 140000 26.714963 2000 6.7922281 - 141000 26.968235 2000 7.0752448 - 142000 27.220962 2000 7.2328717 - 143000 27.474819 2000 7.626453 - 144000 27.728029 2000 7.4576787 - 145000 27.981958 2000 7.124435 - 146000 28.236591 2000 7.2581589 - 147000 28.489842 2000 7.0622049 - 148000 28.744432 2000 7.1672801 - 149000 28.998739 2000 7.3248363 - 150000 29.253511 2000 7.0092266 - 151000 29.50567 2000 6.8124438 - 152000 29.759836 2000 6.9808705 - 153000 30.015359 2000 7.1516731 - 154000 30.275488 2000 6.6245443 - 155000 30.533407 2000 5.5867165 - 156000 30.788683 2000 5.318949 - 157000 31.043126 2000 5.1195805 - 158000 31.297011 2000 5.2045485 - 159000 31.551327 2000 5.24992 - 160000 31.807728 2000 5.3270577 - 161000 32.061371 2000 4.995281 - 162000 32.315467 2000 5.0755874 - 163000 32.57628 2000 5.0788135 - 164000 32.83119 2000 4.5917317 - 165000 33.085634 2000 4.6255452 - 166000 33.344148 2000 4.2563299 - 167000 33.599342 2000 3.3808566 - 168000 33.853488 2000 3.218931 - 169000 34.121464 2000 3.0839289 - 170000 34.378727 2000 3.0358838 -Loop time of 34.3788 on 4 procs for 150000 steps with 2000 atoms - -98.5% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 6.5861 | 10.058 | 12.152 | 68.4 | 29.26 -Neigh | 0.17612 | 0.25274 | 0.30005 | 9.2 | 0.74 -Comm | 1.5024 | 2.6626 | 3.4174 | 44.9 | 7.74 -Output | 0.006542 | 0.019532 | 0.046425 | 11.5 | 0.06 -Modify | 11.945 | 14.674 | 16.29 | 42.7 | 42.68 -Other | | 6.711 | | | 19.52 - -Nlocal: 500 ave 508 max 489 min -Histogram: 1 0 0 1 0 0 0 0 0 2 -Nghost: 446.75 ave 708 max 191 min -Histogram: 1 0 0 1 0 1 0 0 0 1 -Neighs: 4498 ave 5441 max 3786 min -Histogram: 1 1 0 0 0 0 1 0 0 1 - -Total # of neighbors = 17992 -Ave neighs/atom = 8.996 -Neighbor list builds = 403 -Dangerous builds = 0 - -# remove "plug" - need to redefine cylinder region & union - -region cylreg delete -region hopreg delete -region cylreg cylinder z ${xc} ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 #Bottom & top are open -region cylreg cylinder z 25 ${yc} ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 ${radconelo} ${zcyllo} ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 2 ${zcyllo} ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 2 0 ${zconelo} side in units box open 1 open 2 -region cylreg cylinder z 25 25 2 0 10 side in units box open 1 open 2 - -region hopreg union 2 cylreg conereg - -unfix hopper3 -fix hopper3 all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 ${gamma_n} ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 ${gamma_t} ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 ${coeffFric} 1 region hopreg -fix hopper3 all wall/gran/region hertz/history 72592.5925925926 90740.7407407408 903.503751814138 451.751875907069 0.5 1 region hopreg - -run 100000 -Per MPI rank memory allocation (min/avg/max) = 13.68 | 15.35 | 16.59 Mbytes -Step CPU Atoms KinEng - 170000 0 2000 3.0358838 - 171000 0.25455499 2000 3.7725185 - 172000 0.50768304 2000 4.727285 - 173000 0.76122355 2000 5.9840449 - 174000 1.0141416 2000 8.0335022 - 175000 1.2750733 2000 10.177259 - 176000 1.5277736 2000 13.655163 - 177000 1.7810826 2000 17.987975 - 178000 2.0348532 2000 23.266471 - 179000 2.2915859 2000 29.266364 - 180000 2.547174 2000 35.84089 - 181000 2.8009758 2000 43.130989 - 182000 3.0531759 2000 51.177142 - 183000 3.3130636 2000 60.031831 - 184000 3.5651338 2000 69.52374 - 185000 3.8185399 2000 79.941907 - 186000 4.070199 2000 91.195382 - 187000 4.3204038 2000 102.1696 - 188000 4.5699775 2000 112.73657 - 189000 4.8184452 2000 123.57252 - 190000 5.0653601 2000 135.59942 - 191000 5.3119307 2000 147.37757 - 192000 5.5574484 2000 159.12931 - 193000 5.8029084 2000 170.90271 - 194000 6.0463562 2000 185.71189 - 195000 6.2883332 2000 201.83733 - 196000 6.5281694 2000 218.30785 - 197000 6.7682493 2000 236.05694 - 198000 7.0084231 2000 255.23099 - 199000 7.2519951 2000 273.94566 - 200000 7.5010133 2000 293.91107 - 201000 7.7396591 2000 316.52142 - 202000 7.9784184 2000 340.91391 - 203000 8.224021 2000 364.81801 - 204000 8.4597676 2000 390.06478 - 205000 8.6934731 2000 415.90918 - 206000 8.9342225 2000 441.0995 - 207000 9.1714027 2000 467.40314 - 208000 9.4081488 2000 494.93631 - 209000 9.6457636 2000 524.70539 - 210000 9.8831718 2000 556.52058 - 211000 10.118018 2000 589.36821 - 212000 10.3541 2000 622.6887 - 213000 10.587226 2000 657.05888 - 214000 10.820744 2000 691.14292 - 215000 11.055785 2000 726.94959 - 216000 11.298702 2000 762.92802 - 217000 11.534793 2000 801.23648 - 218000 11.769849 2000 841.1559 - 219000 12.000917 2000 882.4342 - 220000 12.232812 2000 924.8466 - 221000 12.461166 2000 968.86229 - 222000 12.698451 2000 1013.1381 - 223000 12.930287 2000 1058.2988 - 224000 13.172862 2000 1105.2911 - 225000 13.405001 2000 1152.8617 - 226000 13.633187 1999 1197.6777 - 227000 13.857126 1998 1243.1211 - 228000 14.079622 1992 1262.1402 - 229000 14.303362 1987 1281.9162 - 230000 14.530392 1973 1264.0674 - 231000 14.756486 1964 1277.8347 - 232000 14.984495 1953 1266.7926 - 233000 15.213102 1940 1244.0038 - 234000 15.441666 1925 1206.4472 - 235000 15.667547 1914 1193.33 - 236000 15.895047 1901 1160.4096 - 237000 16.120833 1890 1141.6816 - 238000 16.346628 1883 1149.1584 - 239000 16.573303 1877 1141.7514 - 240000 16.801035 1871 1146.8662 - 241000 17.024775 1866 1152.561 - 242000 17.248651 1858 1148.2529 - 243000 17.47241 1847 1114.7239 - 244000 17.70222 1832 1070.9996 - 245000 17.926477 1824 1066.7549 - 246000 18.157588 1813 1027.1865 - 247000 18.378868 1804 1011.5024 - 248000 18.599988 1797 993.10451 - 249000 18.819007 1787 951.89778 - 250000 19.044634 1777 926.30475 - 251000 19.254408 1764 875.07091 - 252000 19.465788 1755 824.89358 - 253000 19.676327 1742 742.51957 - 254000 19.887648 1731 708.30958 - 255000 20.094912 1722 690.09761 - 256000 20.299963 1713 638.00218 - 257000 20.506153 1705 596.86839 - 258000 20.713994 1701 583.71937 - 259000 20.919755 1691 549.0049 - 260000 21.123122 1688 549.4278 - 261000 21.332215 1684 535.35719 - 262000 21.533673 1682 546.74031 - 263000 21.737042 1678 532.69324 - 264000 21.941306 1676 537.89254 - 265000 22.15135 1676 559.50898 - 266000 22.358371 1670 540.21452 - 267000 22.563236 1668 557.19857 - 268000 22.764648 1665 569.52869 - 269000 22.96391 1658 543.77057 - 270000 23.172415 1656 550.23716 -Loop time of 23.1725 on 4 procs for 100000 steps with 1656 atoms - -98.5% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 3.3849 | 7.3002 | 10.192 | 91.3 | 31.50 -Neigh | 0.14271 | 0.16781 | 0.19054 | 4.5 | 0.72 -Comm | 1.086 | 1.9721 | 2.6157 | 42.7 | 8.51 -Output | 0.0018437 | 0.013918 | 0.041359 | 13.5 | 0.06 -Modify | 8.6598 | 9.3198 | 9.8874 | 16.6 | 40.22 -Other | | 4.399 | | | 18.98 - -Nlocal: 414 ave 454 max 385 min -Histogram: 2 0 0 0 0 0 1 0 0 1 -Nghost: 395.25 ave 645 max 157 min -Histogram: 1 0 0 1 0 1 0 0 0 1 -Neighs: 3498.5 ave 4524 max 2034 min -Histogram: 1 0 0 0 1 0 0 0 0 2 - -Total # of neighbors = 13994 -Ave neighs/atom = 8.45048 -Neighbor list builds = 240 -Dangerous builds = 0 -Total wall time: 0:01:02 diff --git a/examples/granregion/log.27Nov18.granregion.mixer.g++.1 b/examples/granregion/log.27Nov18.granregion.mixer.g++.1 deleted file mode 100644 index f2ba9d7122..0000000000 --- a/examples/granregion/log.27Nov18.granregion.mixer.g++.1 +++ /dev/null @@ -1,602 +0,0 @@ -LAMMPS (27 Nov 2018) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87) - using 1 OpenMP thread(s) per MPI task -variable name string mixer - -thermo_modify flush yes -variable seed equal 14314 - -############################################### -# Particle parameters -################################################ - -variable rlo equal 0.3 -variable rhi equal 0.6 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.3 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.6 -variable skin equal ${rhi} -variable skin equal 0.6 - -variable coeffRes equal 0.1 -variable coeffFric equal 0.5 - -variable kn equal 10^5 -variable kt equal 0.2*${kn} -variable kt equal 0.2*100000 - -variable gravity equal 1.0 -variable density equal 1.0 - -variable min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*PI*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*PI*0.3*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*${rlo} -variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*0.3 -variable a equal (-2.0*log(${coeffRes})/PI)^2 -variable a equal (-2.0*log(0.1)/PI)^2 -variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*100000/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*0.405284734569351)) -variable gamma_t equal ${gamma_n}*0.5 -variable gamma_t equal 806.699778405191*0.5 - -variable tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) -variable tcol equal PI/sqrt(2*100000/${min_mass}-${gamma_n}/4.0) -variable tcol equal PI/sqrt(2*100000/0.113097335529233-${gamma_n}/4.0) -variable tcol equal PI/sqrt(2*100000/0.113097335529233-806.699778405191/4.0) - -variable dt equal ${tcol}*0.02 -variable dt equal 0.00236257621510454*0.02 -timestep ${dt} -timestep 4.72515243020908e-05 - -############################################### - -variable dumpfreq equal 1000 -variable logfreq equal 1000 - -newton on -atom_style sphere - -boundary p p f - -region boxreg block 0 20 0 20 0 20 -create_box 1 boxreg -Created orthogonal box = (0 0 0) to (20 20 20) - 1 by 1 by 1 MPI processor grid - -pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 -pair_coeff * * - -neighbor ${skin} bin -neighbor 0.6 bin -thermo ${logfreq} -thermo 1000 - -comm_style brick -comm_modify mode multi group all vel yes -balance 1.1 shift xyz 20 1.1 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 20, bins = 1 1 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair gran/hertz/history, perpetual - attributes: half, newton on, size, history - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -fix bal all balance 10000 1.1 shift xyz 20 1.01 - -####################### Options specific to pouring ######################### - -region insreg cylinder z 10 10 8 10 18 side in units box -region cylreg cylinder z 10 10 10 0 20 side in units box - -variable theta equal (step/400000)*2*PI - -region b1 block 2 18 9 11 0 4 side out rotate v_theta 10 10 0 0 0 1 units box -region b2 block 9 11 2 18 0 3.99999 side out rotate v_theta 10 10 0 0 0 1 units box - -region mixer intersect 3 cylreg b1 b2 side in - -fix grav all gravity ${gravity} vector 0 0 -1 -fix grav all gravity 1 vector 0 0 -1 -fix 1 all nve/sphere - -fix mixwall all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 region mixer - -fix ins all pour 1000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 ${dhi} dens ${density} ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens ${density} ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 1 -Particle insertion: 444 every 84653 steps, 1000 by step 169307 - -#dump 1 all custom ${dumpfreq} ${name}_pour.dump # id type mass diameter x y z - -#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 1.5 # box no 0.0 axes no 0.0 0.0 -#dump_modify 2 pad 6 - -thermo_style custom step cpu atoms ke v_theta -WARNING: New thermo_style command, previous thermo_modify settings will be lost (src/output.cpp:705) -thermo_modify flush yes lost warn - -run 200000 -Per MPI rank memory allocation (min/avg/max) = 5.862 | 5.862 | 5.862 Mbytes -Step CPU Atoms KinEng v_theta - 0 0 0 -0 0 - 1000 0.15327144 444 -0 0.015707963 - 2000 0.30070925 444 -0 0.031415927 - 3000 0.44653535 444 -0 0.04712389 - 4000 0.59226131 444 -0 0.062831853 - 5000 0.73794818 444 -0 0.078539816 - 6000 0.88327622 444 -0 0.09424778 - 7000 1.0286083 444 -0 0.10995574 - 8000 1.1740625 444 -0 0.12566371 - 9000 1.3224797 444 -0 0.14137167 - 10000 1.4717772 444 -0 0.15707963 - 11000 1.6204555 444 -0 0.1727876 - 12000 1.7690799 444 -0 0.18849556 - 13000 1.918304 444 -0 0.20420352 - 14000 2.0670426 444 -0 0.21991149 - 15000 2.2157068 444 -0 0.23561945 - 16000 2.3642888 444 -0 0.25132741 - 17000 2.5129776 444 -0 0.26703538 - 18000 2.6614521 444 -0 0.28274334 - 19000 2.8100598 444 -0 0.2984513 - 20000 2.9591351 444 -0 0.31415927 - 21000 3.1073661 444 -0 0.32986723 - 22000 3.2557554 444 -0 0.34557519 - 23000 3.4041324 444 -0 0.36128316 - 24000 3.5526814 444 -0 0.37699112 - 25000 3.700824 444 -0 0.39269908 - 26000 3.8496137 444 -0 0.40840704 - 27000 3.9986103 444 -0 0.42411501 - 28000 4.1475384 444 -0 0.43982297 - 29000 4.2963772 444 -0 0.45553093 - 30000 4.4454341 444 -0 0.4712389 - 31000 4.5942066 444 -0 0.48694686 - 32000 4.7434044 444 -0 0.50265482 - 33000 4.893549 444 -0 0.51836279 - 34000 5.0427935 444 -0 0.53407075 - 35000 5.1920972 444 -0 0.54977871 - 36000 5.3411844 444 -0 0.56548668 - 37000 5.4904606 444 -0 0.58119464 - 38000 5.6397707 444 -0 0.5969026 - 39000 5.7900345 444 -0 0.61261057 - 40000 5.9405882 444 -0 0.62831853 - 41000 6.089345 444 -0 0.64402649 - 42000 6.2388933 444 -0 0.65973446 - 43000 6.3888056 444 -0 0.67544242 - 44000 6.5379841 444 -0 0.69115038 - 45000 6.6875141 444 -0 0.70685835 - 46000 6.8370855 444 -0 0.72256631 - 47000 6.9866009 444 -0 0.73827427 - 48000 7.1364653 444 -0 0.75398224 - 49000 7.2859883 444 -0 0.7696902 - 50000 7.4368248 444 -0 0.78539816 - 51000 7.5870779 444 -0 0.80110613 - 52000 7.7370813 444 -0 0.81681409 - 53000 7.8879561 444 -0 0.83252205 - 54000 8.0383027 444 -0 0.84823002 - 55000 8.1916294 444 -0 0.86393798 - 56000 8.3458471 444 -0 0.87964594 - 57000 8.5010631 444 -0 0.89535391 - 58000 8.6560545 444 -0 0.91106187 - 59000 8.8110209 444 -0 0.92676983 - 60000 8.9674675 444 -0 0.9424778 - 61000 9.1231239 444 -0 0.95818576 - 62000 9.2785382 444 -0 0.97389372 - 63000 9.4343674 444 -0 0.98960169 - 64000 9.5911541 444 -0 1.0053096 - 65000 9.7477772 444 -0 1.0210176 - 66000 9.9050307 444 -0 1.0367256 - 67000 10.063978 444 -0 1.0524335 - 68000 10.221835 444 -0 1.0681415 - 69000 10.37944 444 -0 1.0838495 - 70000 10.537409 444 -0 1.0995574 - 71000 10.695649 444 -0 1.1152654 - 72000 10.85453 444 -0 1.1309734 - 73000 11.013438 444 -0 1.1466813 - 74000 11.172689 444 -0 1.1623893 - 75000 11.332172 444 -0 1.1780972 - 76000 11.492824 444 -0 1.1938052 - 77000 11.653915 444 -0 1.2095132 - 78000 11.815798 444 -0 1.2252211 - 79000 11.97868 444 -0 1.2409291 - 80000 12.141392 444 -0 1.2566371 - 81000 12.30536 444 -0 1.272345 - 82000 12.468797 444 -0 1.288053 - 83000 12.633028 444 -0 1.303761 - 84000 12.797936 444 -0 1.3194689 - 85000 13.019726 888 -0 1.3351769 - 86000 13.333436 888 -0 1.3508848 - 87000 13.648179 888 -0 1.3665928 - 88000 13.962435 888 -0 1.3823008 - 89000 14.276158 888 -0 1.3980087 - 90000 14.590669 888 -0 1.4137167 - 91000 14.904268 888 -0 1.4294247 - 92000 15.216788 888 -0 1.4451326 - 93000 15.529868 888 -0 1.4608406 - 94000 15.843157 888 -0 1.4765485 - 95000 16.156564 888 -0 1.4922565 - 96000 16.469569 888 -0 1.5079645 - 97000 16.784048 888 -0 1.5236724 - 98000 17.100451 888 -0 1.5393804 - 99000 17.416338 888 -0 1.5550884 - 100000 17.733482 888 -0 1.5707963 - 101000 18.052522 888 -0 1.5865043 - 102000 18.371428 888 -0 1.6022123 - 103000 18.690222 888 -0 1.6179202 - 104000 19.009665 888 -0 1.6336282 - 105000 19.328189 888 -0 1.6493361 - 106000 19.647804 888 -0 1.6650441 - 107000 19.96805 888 -0 1.6807521 - 108000 20.286857 888 -0 1.69646 - 109000 20.607965 888 -0 1.712168 - 110000 20.931749 888 -0 1.727876 - 111000 21.251903 888 -0 1.7435839 - 112000 21.572158 888 -0 1.7592919 - 113000 21.892612 888 -0 1.7749998 - 114000 22.214408 888 -0 1.7907078 - 115000 22.535498 888 -0 1.8064158 - 116000 22.856752 888 -0 1.8221237 - 117000 23.178885 888 -0 1.8378317 - 118000 23.501127 888 -0 1.8535397 - 119000 23.8241 888 -0 1.8692476 - 120000 24.147258 888 -0 1.8849556 - 121000 24.472969 888 -0 1.9006636 - 122000 24.799108 888 -0 1.9163715 - 123000 25.125275 888 -0 1.9320795 - 124000 25.453866 888 -0 1.9477874 - 125000 25.784766 888 -0 1.9634954 - 126000 26.117013 888 -0 1.9792034 - 127000 26.448734 888 -0 1.9949113 - 128000 26.780032 888 -0 2.0106193 - 129000 27.113678 888 -0 2.0263273 - 130000 27.450001 888 -0 2.0420352 - 131000 27.782047 888 -0 2.0577432 - 132000 28.114287 888 -0 2.0734512 - 133000 28.446648 888 -0 2.0891591 - 134000 28.780438 888 -0 2.1048671 - 135000 29.116443 888 -0 2.120575 - 136000 29.451848 888 -0 2.136283 - 137000 29.787778 888 -0 2.151991 - 138000 30.12804 888 -0 2.1676989 - 139000 30.46814 888 -0 2.1834069 - 140000 30.808946 888 -0 2.1991149 - 141000 31.147584 888 -0 2.2148228 - 142000 31.486475 888 -0 2.2305308 - 143000 31.826754 888 -0 2.2462387 - 144000 32.165796 888 -0 2.2619467 - 145000 32.506074 888 -0 2.2776547 - 146000 32.847604 888 -0 2.2933626 - 147000 33.188988 888 -0 2.3090706 - 148000 33.532869 888 -0 2.3247786 - 149000 33.876629 888 -0 2.3404865 - 150000 34.221172 888 -0 2.3561945 - 151000 34.562559 888 -0 2.3719025 - 152000 34.904679 888 -0 2.3876104 - 153000 35.247727 888 -0 2.4033184 - 154000 35.591228 888 -0 2.4190263 - 155000 35.949192 888 -0 2.4347343 - 156000 36.320157 888 -0 2.4504423 - 157000 36.693571 888 -0 2.4661502 - 158000 37.069463 888 -0 2.4818582 - 159000 37.44221 888 -0 2.4975662 - 160000 37.81863 888 -0 2.5132741 - 161000 38.195121 888 -0 2.5289821 - 162000 38.573424 888 -0 2.54469 - 163000 38.950044 888 -0 2.560398 - 164000 39.331977 888 -0 2.576106 - 165000 39.714367 888 -0 2.5918139 - 166000 40.097099 888 -0 2.6075219 - 167000 40.477443 888 -0 2.6232299 - 168000 40.860404 888 -0 2.6389378 - 169000 41.244357 888 -0 2.6546458 - 170000 41.658126 1000 -0 2.6703538 - 171000 42.082517 1000 -0 2.6860617 - 172000 42.507502 1000 -0 2.7017697 - 173000 42.93363 1000 -0 2.7174776 - 174000 43.361133 1000 -0 2.7331856 - 175000 43.792381 1000 -0 2.7488936 - 176000 44.223827 1000 -0 2.7646015 - 177000 44.656581 1000 -0 2.7803095 - 178000 45.087615 1000 -0 2.7960175 - 179000 45.521129 1000 -0 2.8117254 - 180000 45.957808 1000 -0 2.8274334 - 181000 46.391451 1000 -0 2.8431414 - 182000 46.825486 1000 -0 2.8588493 - 183000 47.26091 1000 -0 2.8745573 - 184000 47.694263 1000 -0 2.8902652 - 185000 48.123312 1000 -0 2.9059732 - 186000 48.554081 1000 -0 2.9216812 - 187000 48.982617 1000 -0 2.9373891 - 188000 49.414355 1000 -0 2.9530971 - 189000 49.84753 1000 -0 2.9688051 - 190000 50.284462 1000 -0 2.984513 - 191000 50.71899 1000 -0 3.000221 - 192000 51.157278 1000 -0 3.0159289 - 193000 51.586171 1000 -0 3.0316369 - 194000 52.011691 1000 -0 3.0473449 - 195000 52.437732 1000 -0 3.0630528 - 196000 52.863703 1000 -0 3.0787608 - 197000 53.290403 1000 -0 3.0944688 - 198000 53.7191 1000 -0 3.1101767 - 199000 54.147195 1000 -0 3.1258847 - 200000 54.575967 1000 -0 3.1415927 -Loop time of 54.576 on 1 procs for 200000 steps with 1000 atoms - -Performance: 14960.907 tau/day, 3664.615 timesteps/s -98.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 3.7989 | 3.7989 | 3.7989 | 0.0 | 6.96 -Neigh | 0.067629 | 0.067629 | 0.067629 | 0.0 | 0.12 -Comm | 0.63734 | 0.63734 | 0.63734 | 0.0 | 1.17 -Output | 0.0049303 | 0.0049303 | 0.0049303 | 0.0 | 0.01 -Modify | 49.1 | 49.1 | 49.1 | 0.0 | 89.97 -Other | | 0.9668 | | | 1.77 - -Nlocal: 1000 ave 1000 max 1000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 196 ave 196 max 196 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 3910 ave 3910 max 3910 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 3910 -Ave neighs/atom = 3.91 -Neighbor list builds = 219 -Dangerous builds = 0 -unfix ins -run 200000 -Per MPI rank memory allocation (min/avg/max) = 12.65 | 12.65 | 12.65 Mbytes -Step CPU Atoms KinEng v_theta - 200000 0 1000 0.93873133 3.1415927 - 201000 0.4261198 1000 0.93239566 3.1573006 - 202000 0.84928846 1000 0.90333835 3.1730086 - 203000 1.2720087 1000 0.89351493 3.1887165 - 204000 1.6929317 1000 0.87648478 3.2044245 - 205000 2.114043 1000 0.86818482 3.2201325 - 206000 2.5357664 1000 0.86033251 3.2358404 - 207000 2.9579847 1000 0.85442625 3.2515484 - 208000 3.3812878 1000 0.8517451 3.2672564 - 209000 3.8124611 1000 0.84406987 3.2829643 - 210000 4.2440236 1000 0.83964642 3.2986723 - 211000 4.6781921 1000 0.82994066 3.3143802 - 212000 5.1116509 1000 0.82908369 3.3300882 - 213000 5.5468135 1000 0.83115482 3.3457962 - 214000 5.9802556 1000 0.82680518 3.3615041 - 215000 6.4107294 1000 0.8223909 3.3772121 - 216000 6.8419023 1000 0.81872537 3.3929201 - 217000 7.2763367 1000 0.82446065 3.408628 - 218000 7.7160695 1000 0.82278874 3.424336 - 219000 8.1540956 1000 0.83017397 3.440044 - 220000 8.5917952 1000 0.82232305 3.4557519 - 221000 9.0296218 1000 0.82584132 3.4714599 - 222000 9.4719794 1000 0.82143909 3.4871678 - 223000 9.9180939 1000 0.82925587 3.5028758 - 224000 10.361852 1000 0.84546265 3.5185838 - 225000 10.803539 1000 0.84436452 3.5342917 - 226000 11.248456 1000 0.84849375 3.5499997 - 227000 11.695092 1000 0.8409057 3.5657077 - 228000 12.136044 1000 0.83139305 3.5814156 - 229000 12.579807 1000 0.83098473 3.5971236 - 230000 13.02219 1000 0.81335147 3.6128316 - 231000 13.463863 1000 0.78946649 3.6285395 - 232000 13.906293 1000 0.78807613 3.6442475 - 233000 14.348807 1000 0.79086655 3.6599554 - 234000 14.793175 1000 0.79358862 3.6756634 - 235000 15.238316 1000 0.79444252 3.6913714 - 236000 15.683342 1000 0.79392156 3.7070793 - 237000 16.12611 1000 0.80416034 3.7227873 - 238000 16.5711 1000 0.80365093 3.7384953 - 239000 17.014355 1000 0.80860323 3.7542032 - 240000 17.454467 1000 0.80245788 3.7699112 - 241000 17.89162 1000 0.79602568 3.7856191 - 242000 18.330859 1000 0.79023692 3.8013271 - 243000 18.769301 1000 0.79066782 3.8170351 - 244000 19.211293 1000 0.77671368 3.832743 - 245000 19.651443 1000 0.77121874 3.848451 - 246000 20.092102 1000 0.74658977 3.864159 - 247000 20.532732 1000 0.73825017 3.8798669 - 248000 20.975646 1000 0.7187986 3.8955749 - 249000 21.418807 1000 0.71707058 3.9112829 - 250000 21.862497 1000 0.72983635 3.9269908 - 251000 22.311832 1000 0.7355358 3.9426988 - 252000 22.75883 1000 0.74427811 3.9584067 - 253000 23.203455 1000 0.74968093 3.9741147 - 254000 23.651472 1000 0.75350303 3.9898227 - 255000 24.102152 1000 0.75617916 4.0055306 - 256000 24.554236 1000 0.74949839 4.0212386 - 257000 25.008718 1000 0.73534118 4.0369466 - 258000 25.461913 1000 0.73761942 4.0526545 - 259000 25.916674 1000 0.75485851 4.0683625 - 260000 26.373941 1000 0.77147511 4.0840704 - 261000 26.832072 1000 0.76658917 4.0997784 - 262000 27.28741 1000 0.76441563 4.1154864 - 263000 27.742157 1000 0.74449444 4.1311943 - 264000 28.192718 1000 0.7403314 4.1469023 - 265000 28.642541 1000 0.74262656 4.1626103 - 266000 29.09406 1000 0.74117022 4.1783182 - 267000 29.547747 1000 0.73877643 4.1940262 - 268000 29.998243 1000 0.75062626 4.2097342 - 269000 30.449751 1000 0.74649396 4.2254421 - 270000 30.901232 1000 0.75371324 4.2411501 - 271000 31.354755 1000 0.75254842 4.256858 - 272000 31.810717 1000 0.74245946 4.272566 - 273000 32.265754 1000 0.73056023 4.288274 - 274000 32.719719 1000 0.72004393 4.3039819 - 275000 33.173929 1000 0.70665742 4.3196899 - 276000 33.628581 1000 0.69417262 4.3353979 - 277000 34.080936 1000 0.67343474 4.3511058 - 278000 34.532053 1000 0.66922758 4.3668138 - 279000 34.985569 1000 0.66239909 4.3825218 - 280000 35.443496 1000 0.66406486 4.3982297 - 281000 35.901536 1000 0.67123654 4.4139377 - 282000 36.357765 1000 0.67660885 4.4296456 - 283000 36.811956 1000 0.6809288 4.4453536 - 284000 37.266937 1000 0.69561154 4.4610616 - 285000 37.720866 1000 0.70874512 4.4767695 - 286000 38.177032 1000 0.72957833 4.4924775 - 287000 38.633109 1000 0.72891066 4.5081855 - 288000 39.086933 1000 0.72673285 4.5238934 - 289000 39.538699 1000 0.72583062 4.5396014 - 290000 39.991294 1000 0.7209406 4.5553093 - 291000 40.437987 1000 0.70642559 4.5710173 - 292000 40.885753 1000 0.69074151 4.5867253 - 293000 41.326601 1000 0.68041469 4.6024332 - 294000 41.763719 1000 0.6712034 4.6181412 - 295000 42.198532 1000 0.66140336 4.6338492 - 296000 42.635139 1000 0.65458145 4.6495571 - 297000 43.071132 1000 0.63884999 4.6652651 - 298000 43.507309 1000 0.63182296 4.6809731 - 299000 43.943936 1000 0.6324286 4.696681 - 300000 44.383148 1000 0.62640427 4.712389 - 301000 44.819379 1000 0.62138494 4.7280969 - 302000 45.260834 1000 0.62902694 4.7438049 - 303000 45.705719 1000 0.63308052 4.7595129 - 304000 46.14622 1000 0.63266845 4.7752208 - 305000 46.586693 1000 0.63464534 4.7909288 - 306000 47.028768 1000 0.62941378 4.8066368 - 307000 47.470183 1000 0.62801025 4.8223447 - 308000 47.914518 1000 0.62291875 4.8380527 - 309000 48.365654 1000 0.62529494 4.8537606 - 310000 48.817185 1000 0.62504442 4.8694686 - 311000 49.269423 1000 0.63074915 4.8851766 - 312000 49.722869 1000 0.64292914 4.9008845 - 313000 50.175859 1000 0.65319818 4.9165925 - 314000 50.630132 1000 0.66755513 4.9323005 - 315000 51.084836 1000 0.67585436 4.9480084 - 316000 51.539391 1000 0.67676226 4.9637164 - 317000 51.995233 1000 0.67394312 4.9794244 - 318000 52.453581 1000 0.67299959 4.9951323 - 319000 52.906322 1000 0.68074615 5.0108403 - 320000 53.362206 1000 0.67696004 5.0265482 - 321000 53.813824 1000 0.67899008 5.0422562 - 322000 54.264433 1000 0.67901671 5.0579642 - 323000 54.715627 1000 0.67620354 5.0736721 - 324000 55.168 1000 0.67165541 5.0893801 - 325000 55.620891 1000 0.67820953 5.1050881 - 326000 56.073685 1000 0.67490808 5.120796 - 327000 56.526012 1000 0.67238149 5.136504 - 328000 56.977525 1000 0.66885914 5.152212 - 329000 57.431088 1000 0.66876389 5.1679199 - 330000 57.886694 1000 0.66879597 5.1836279 - 331000 58.338381 1000 0.66577546 5.1993358 - 332000 58.791084 1000 0.6602875 5.2150438 - 333000 59.242965 1000 0.65879422 5.2307518 - 334000 59.698559 1000 0.6581474 5.2464597 - 335000 60.153261 1000 0.6521249 5.2621677 - 336000 60.605605 1000 0.63371979 5.2778757 - 337000 61.059824 1000 0.62373279 5.2935836 - 338000 61.510606 1000 0.6212013 5.3092916 - 339000 61.962049 1000 0.62303395 5.3249995 - 340000 62.413564 1000 0.63183785 5.3407075 - 341000 62.86366 1000 0.64387158 5.3564155 - 342000 63.317623 1000 0.65045982 5.3721234 - 343000 63.772034 1000 0.65401192 5.3878314 - 344000 64.225206 1000 0.65181077 5.4035394 - 345000 64.681317 1000 0.64098248 5.4192473 - 346000 65.136483 1000 0.63163559 5.4349553 - 347000 65.588996 1000 0.64182161 5.4506633 - 348000 66.042215 1000 0.65528889 5.4663712 - 349000 66.501687 1000 0.66603277 5.4820792 - 350000 66.960896 1000 0.67362185 5.4977871 - 351000 67.417316 1000 0.68867905 5.5134951 - 352000 67.876742 1000 0.6907547 5.5292031 - 353000 68.336836 1000 0.69043981 5.544911 - 354000 68.797396 1000 0.68676964 5.560619 - 355000 69.255062 1000 0.68019369 5.576327 - 356000 69.711663 1000 0.66189875 5.5920349 - 357000 70.172728 1000 0.65275709 5.6077429 - 358000 70.632655 1000 0.64560617 5.6234508 - 359000 71.091165 1000 0.63865266 5.6391588 - 360000 71.548341 1000 0.6366388 5.6548668 - 361000 72.006137 1000 0.63619567 5.6705747 - 362000 72.466621 1000 0.63986167 5.6862827 - 363000 72.928505 1000 0.656198 5.7019907 - 364000 73.391876 1000 0.66522563 5.7176986 - 365000 73.852366 1000 0.67330205 5.7334066 - 366000 74.317924 1000 0.67997811 5.7491146 - 367000 74.781431 1000 0.67734915 5.7648225 - 368000 75.24363 1000 0.66811078 5.7805305 - 369000 75.704319 1000 0.67232161 5.7962384 - 370000 76.165294 1000 0.67262944 5.8119464 - 371000 76.624971 1000 0.68614241 5.8276544 - 372000 77.085918 1000 0.70293842 5.8433623 - 373000 77.544679 1000 0.71889856 5.8590703 - 374000 78.007103 1000 0.7170296 5.8747783 - 375000 78.468913 1000 0.71258031 5.8904862 - 376000 78.93354 1000 0.70758873 5.9061942 - 377000 79.39396 1000 0.69486822 5.9219022 - 378000 79.850685 1000 0.68311194 5.9376101 - 379000 80.307228 1000 0.67317549 5.9533181 - 380000 80.767418 1000 0.67691049 5.969026 - 381000 81.227579 1000 0.69231691 5.984734 - 382000 81.686924 1000 0.69998609 6.000442 - 383000 82.145783 1000 0.69328258 6.0161499 - 384000 82.604827 1000 0.69903908 6.0318579 - 385000 83.056443 1000 0.69455744 6.0475659 - 386000 83.507131 1000 0.68865933 6.0632738 - 387000 83.95695 1000 0.68630439 6.0789818 - 388000 84.404079 1000 0.6800564 6.0946897 - 389000 84.851053 1000 0.66747339 6.1103977 - 390000 85.298614 1000 0.65695883 6.1261057 - 391000 85.744507 1000 0.65659359 6.1418136 - 392000 86.191348 1000 0.65933663 6.1575216 - 393000 86.632782 1000 0.65170236 6.1732296 - 394000 87.074105 1000 0.65631817 6.1889375 - 395000 87.5177 1000 0.66205838 6.2046455 - 396000 87.963111 1000 0.65512694 6.2203535 - 397000 88.408348 1000 0.65266011 6.2360614 - 398000 88.854042 1000 0.64593806 6.2517694 - 399000 89.298754 1000 0.64940473 6.2674773 - 400000 89.745445 1000 0.66033435 6.2831853 -Loop time of 89.7455 on 1 procs for 200000 steps with 1000 atoms - -Performance: 9098.023 tau/day, 2228.525 timesteps/s -98.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 10.924 | 10.924 | 10.924 | 0.0 | 12.17 -Neigh | 0.10266 | 0.10266 | 0.10266 | 0.0 | 0.11 -Comm | 1.9424 | 1.9424 | 1.9424 | 0.0 | 2.16 -Output | 0.0056458 | 0.0056458 | 0.0056458 | 0.0 | 0.01 -Modify | 75.442 | 75.442 | 75.442 | 0.0 | 84.06 -Other | | 1.329 | | | 1.48 - -Nlocal: 1000 ave 1000 max 1000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 272 ave 272 max 272 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 4933 ave 4933 max 4933 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 4933 -Ave neighs/atom = 4.933 -Neighbor list builds = 171 -Dangerous builds = 0 -Total wall time: 0:02:24 diff --git a/examples/granregion/log.27Nov18.granregion.mixer.g++.4 b/examples/granregion/log.27Nov18.granregion.mixer.g++.4 deleted file mode 100644 index be690a7df5..0000000000 --- a/examples/granregion/log.27Nov18.granregion.mixer.g++.4 +++ /dev/null @@ -1,602 +0,0 @@ -LAMMPS (27 Nov 2018) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87) - using 1 OpenMP thread(s) per MPI task -variable name string mixer - -thermo_modify flush yes -variable seed equal 14314 - -############################################### -# Particle parameters -################################################ - -variable rlo equal 0.3 -variable rhi equal 0.6 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.3 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.6 -variable skin equal ${rhi} -variable skin equal 0.6 - -variable coeffRes equal 0.1 -variable coeffFric equal 0.5 - -variable kn equal 10^5 -variable kt equal 0.2*${kn} -variable kt equal 0.2*100000 - -variable gravity equal 1.0 -variable density equal 1.0 - -variable min_mass equal ${density}*4.0/3.0*PI*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*PI*${rlo}*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*PI*0.3*${rlo}*${rlo} -variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*${rlo} -variable min_mass equal 1*4.0/3.0*PI*0.3*0.3*0.3 -variable a equal (-2.0*log(${coeffRes})/PI)^2 -variable a equal (-2.0*log(0.1)/PI)^2 -variable gamma_n equal sqrt($a*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*${kn}/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*100000/${min_mass}/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*$a)) -variable gamma_n equal sqrt(0.405284734569351*2*100000/0.113097335529233/(1+0.25*0.405284734569351)) -variable gamma_t equal ${gamma_n}*0.5 -variable gamma_t equal 806.699778405191*0.5 - -variable tcol equal PI/sqrt(2*${kn}/${min_mass}-${gamma_n}/4.0) -variable tcol equal PI/sqrt(2*100000/${min_mass}-${gamma_n}/4.0) -variable tcol equal PI/sqrt(2*100000/0.113097335529233-${gamma_n}/4.0) -variable tcol equal PI/sqrt(2*100000/0.113097335529233-806.699778405191/4.0) - -variable dt equal ${tcol}*0.02 -variable dt equal 0.00236257621510454*0.02 -timestep ${dt} -timestep 4.72515243020908e-05 - -############################################### - -variable dumpfreq equal 1000 -variable logfreq equal 1000 - -newton on -atom_style sphere - -boundary p p f - -region boxreg block 0 20 0 20 0 20 -create_box 1 boxreg -Created orthogonal box = (0 0 0) to (20 20 20) - 1 by 2 by 2 MPI processor grid - -pair_style gran/hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 -pair_style gran/hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 -pair_coeff * * - -neighbor ${skin} bin -neighbor 0.6 bin -thermo ${logfreq} -thermo 1000 - -comm_style brick -comm_modify mode multi group all vel yes -balance 1.1 shift xyz 20 1.1 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 20, bins = 1 1 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair gran/hertz/history, perpetual - attributes: half, newton on, size, history - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -fix bal all balance 10000 1.1 shift xyz 20 1.01 - -####################### Options specific to pouring ######################### - -region insreg cylinder z 10 10 8 10 18 side in units box -region cylreg cylinder z 10 10 10 0 20 side in units box - -variable theta equal (step/400000)*2*PI - -region b1 block 2 18 9 11 0 4 side out rotate v_theta 10 10 0 0 0 1 units box -region b2 block 9 11 2 18 0 3.99999 side out rotate v_theta 10 10 0 0 0 1 units box - -region mixer intersect 3 cylreg b1 b2 side in - -fix grav all gravity ${gravity} vector 0 0 -1 -fix grav all gravity 1 vector 0 0 -1 -fix 1 all nve/sphere - -fix mixwall all wall/gran/region hertz/history ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 ${gamma_n} ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 ${gamma_t} ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 ${coeffFric} 1 region mixer -fix mixwall all wall/gran/region hertz/history 100000 20000 806.699778405191 403.349889202595 0.5 1 region mixer - -fix ins all pour 1000 1 42424 region insreg diam range ${dlo} ${dhi} dens ${density} ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 ${dhi} dens ${density} ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens ${density} ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 ${density} -fix ins all pour 1000 1 42424 region insreg diam range 0.6 1.2 dens 1 1 -Particle insertion: 444 every 84653 steps, 1000 by step 169307 - -#dump 1 all custom ${dumpfreq} ${name}_pour.dump # id type mass diameter x y z - -#dump 2 all image 4000 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 zoom 1.5 # box no 0.0 axes no 0.0 0.0 -#dump_modify 2 pad 6 - -thermo_style custom step cpu atoms ke v_theta -WARNING: New thermo_style command, previous thermo_modify settings will be lost (src/output.cpp:705) -thermo_modify flush yes lost warn - -run 200000 -Per MPI rank memory allocation (min/avg/max) = 5.817 | 5.817 | 5.817 Mbytes -Step CPU Atoms KinEng v_theta - 0 0 0 -0 0 - 1000 0.096722603 444 -0 0.015707963 - 2000 0.18796778 444 -0 0.031415927 - 3000 0.27916241 444 -0 0.04712389 - 4000 0.37111688 444 -0 0.062831853 - 5000 0.46224833 444 -0 0.078539816 - 6000 0.55190682 444 -0 0.09424778 - 7000 0.64120579 444 -0 0.10995574 - 8000 0.73025131 444 -0 0.12566371 - 9000 0.82121348 444 -0 0.14137167 - 10000 0.91006637 444 -0 0.15707963 - 11000 0.97034311 444 -0 0.1727876 - 12000 1.030247 444 -0 0.18849556 - 13000 1.0894752 444 -0 0.20420352 - 14000 1.1483686 444 -0 0.21991149 - 15000 1.2138393 444 -0 0.23561945 - 16000 1.2744856 444 -0 0.25132741 - 17000 1.3361425 444 -0 0.26703538 - 18000 1.3998857 444 -0 0.28274334 - 19000 1.4625463 444 -0 0.2984513 - 20000 1.5255082 444 -0 0.31415927 - 21000 1.5845048 444 -0 0.32986723 - 22000 1.6437175 444 -0 0.34557519 - 23000 1.7022173 444 -0 0.36128316 - 24000 1.7614172 444 -0 0.37699112 - 25000 1.8209105 444 -0 0.39269908 - 26000 1.8818901 444 -0 0.40840704 - 27000 1.9439991 444 -0 0.42411501 - 28000 2.0067189 444 -0 0.43982297 - 29000 2.0697014 444 -0 0.45553093 - 30000 2.1327429 444 -0 0.4712389 - 31000 2.1904151 444 -0 0.48694686 - 32000 2.2478669 444 -0 0.50265482 - 33000 2.3062997 444 -0 0.51836279 - 34000 2.3723967 444 -0 0.53407075 - 35000 2.4331915 444 -0 0.54977871 - 36000 2.4937904 444 -0 0.56548668 - 37000 2.5550685 444 -0 0.58119464 - 38000 2.6170652 444 -0 0.5969026 - 39000 2.6789875 444 -0 0.61261057 - 40000 2.7414019 444 -0 0.62831853 - 41000 2.799027 444 -0 0.64402649 - 42000 2.8570235 444 -0 0.65973446 - 43000 2.9140713 444 -0 0.67544242 - 44000 2.9702985 444 -0 0.69115038 - 45000 3.0274565 444 -0 0.70685835 - 46000 3.0860338 444 -0 0.72256631 - 47000 3.1450455 444 -0 0.73827427 - 48000 3.2057948 444 -0 0.75398224 - 49000 3.267339 444 -0 0.7696902 - 50000 3.3300545 444 -0 0.78539816 - 51000 3.3942592 444 -0 0.80110613 - 52000 3.4522727 444 -0 0.81681409 - 53000 3.5117693 444 -0 0.83252205 - 54000 3.5717957 444 -0 0.84823002 - 55000 3.6338761 444 -0 0.86393798 - 56000 3.7006576 444 -0 0.87964594 - 57000 3.7648654 444 -0 0.89535391 - 58000 3.829128 444 -0 0.91106187 - 59000 3.8930187 444 -0 0.92676983 - 60000 3.9581499 444 -0 0.9424778 - 61000 4.0213017 444 -0 0.95818576 - 62000 4.0822632 444 -0 0.97389372 - 63000 4.1443422 444 -0 0.98960169 - 64000 4.2072315 444 -0 1.0053096 - 65000 4.2711387 444 -0 1.0210176 - 66000 4.3361402 444 -0 1.0367256 - 67000 4.4031398 444 -0 1.0524335 - 68000 4.4698064 444 -0 1.0681415 - 69000 4.5374978 444 -0 1.0838495 - 70000 4.6051283 444 -0 1.0995574 - 71000 4.6694169 444 -0 1.1152654 - 72000 4.7335079 444 -0 1.1309734 - 73000 4.7967482 444 -0 1.1466813 - 74000 4.8603547 444 -0 1.1623893 - 75000 4.9250085 444 -0 1.1780972 - 76000 4.9909372 444 -0 1.1938052 - 77000 5.0578024 444 -0 1.2095132 - 78000 5.1250138 444 -0 1.2252211 - 79000 5.1929755 444 -0 1.2409291 - 80000 5.2627637 444 -0 1.2566371 - 81000 5.3280981 444 -0 1.272345 - 82000 5.3957336 444 -0 1.288053 - 83000 5.4648135 444 -0 1.303761 - 84000 5.5368683 444 -0 1.3194689 - 85000 5.6352935 888 -0 1.3351769 - 86000 5.7708502 888 -0 1.3508848 - 87000 5.9051492 888 -0 1.3665928 - 88000 6.0384896 888 -0 1.3823008 - 89000 6.1714747 888 -0 1.3980087 - 90000 6.3042989 888 -0 1.4137167 - 91000 6.4114611 888 -0 1.4294247 - 92000 6.5164247 888 -0 1.4451326 - 93000 6.6219602 888 -0 1.4608406 - 94000 6.728405 888 -0 1.4765485 - 95000 6.8411646 888 -0 1.4922565 - 96000 6.9479821 888 -0 1.5079645 - 97000 7.0569239 888 -0 1.5236724 - 98000 7.1673372 888 -0 1.5393804 - 99000 7.2778809 888 -0 1.5550884 - 100000 7.398834 888 -0 1.5707963 - 101000 7.5066864 888 -0 1.5865043 - 102000 7.6158357 888 -0 1.6022123 - 103000 7.725111 888 -0 1.6179202 - 104000 7.8344197 888 -0 1.6336282 - 105000 7.9532022 888 -0 1.6493361 - 106000 8.0643187 888 -0 1.6650441 - 107000 8.1765473 888 -0 1.6807521 - 108000 8.2890661 888 -0 1.69646 - 109000 8.4048562 888 -0 1.712168 - 110000 8.5208168 888 -0 1.727876 - 111000 8.6303153 888 -0 1.7435839 - 112000 8.7401052 888 -0 1.7592919 - 113000 8.8518219 888 -0 1.7749998 - 114000 8.9638157 888 -0 1.7907078 - 115000 9.0766122 888 -0 1.8064158 - 116000 9.1908746 888 -0 1.8221237 - 117000 9.306145 888 -0 1.8378317 - 118000 9.4229569 888 -0 1.8535397 - 119000 9.5407412 888 -0 1.8692476 - 120000 9.6574531 888 -0 1.8849556 - 121000 9.7683234 888 -0 1.9006636 - 122000 9.8812008 888 -0 1.9163715 - 123000 9.9952521 888 -0 1.9320795 - 124000 10.111879 888 -0 1.9477874 - 125000 10.228812 888 -0 1.9634954 - 126000 10.347842 888 -0 1.9792034 - 127000 10.47052 888 -0 1.9949113 - 128000 10.593136 888 -0 2.0106193 - 129000 10.718124 888 -0 2.0263273 - 130000 10.844211 888 -0 2.0420352 - 131000 10.959177 888 -0 2.0577432 - 132000 11.075781 888 -0 2.0734512 - 133000 11.191418 888 -0 2.0891591 - 134000 11.313376 888 -0 2.1048671 - 135000 11.432321 888 -0 2.120575 - 136000 11.551893 888 -0 2.136283 - 137000 11.672695 888 -0 2.151991 - 138000 11.793487 888 -0 2.1676989 - 139000 11.914089 888 -0 2.1834069 - 140000 12.037441 888 -0 2.1991149 - 141000 12.161974 888 -0 2.2148228 - 142000 12.286641 888 -0 2.2305308 - 143000 12.414012 888 -0 2.2462387 - 144000 12.540939 888 -0 2.2619467 - 145000 12.66985 888 -0 2.2776547 - 146000 12.79975 888 -0 2.2933626 - 147000 12.932702 888 -0 2.3090706 - 148000 13.066088 888 -0 2.3247786 - 149000 13.200814 888 -0 2.3404865 - 150000 13.33565 888 -0 2.3561945 - 151000 13.465995 888 -0 2.3719025 - 152000 13.586622 888 -0 2.3876104 - 153000 13.711423 888 -0 2.4033184 - 154000 13.835058 888 -0 2.4190263 - 155000 13.967661 888 -0 2.4347343 - 156000 14.100609 888 -0 2.4504423 - 157000 14.234485 888 -0 2.4661502 - 158000 14.373325 888 -0 2.4818582 - 159000 14.510608 888 -0 2.4975662 - 160000 14.651416 888 -0 2.5132741 - 161000 14.785767 888 -0 2.5289821 - 162000 14.921569 888 -0 2.54469 - 163000 15.058895 888 -0 2.560398 - 164000 15.198786 888 -0 2.576106 - 165000 15.341662 888 -0 2.5918139 - 166000 15.487128 888 -0 2.6075219 - 167000 15.649383 888 -0 2.6232299 - 168000 15.795388 888 -0 2.6389378 - 169000 15.942671 888 -0 2.6546458 - 170000 16.091824 1000 -0 2.6703538 - 171000 16.239863 1000 -0 2.6860617 - 172000 16.391118 1000 -0 2.7017697 - 173000 16.5417 1000 -0 2.7174776 - 174000 16.69479 1000 -0 2.7331856 - 175000 16.847412 1000 -0 2.7488936 - 176000 17.000374 1000 -0 2.7646015 - 177000 17.15471 1000 -0 2.7803095 - 178000 17.31284 1000 -0 2.7960175 - 179000 17.46991 1000 -0 2.8117254 - 180000 17.629018 1000 -0 2.8274334 - 181000 17.787736 1000 -0 2.8431414 - 182000 17.946197 1000 -0 2.8588493 - 183000 18.105271 1000 -0 2.8745573 - 184000 18.263731 1000 -0 2.8902652 - 185000 18.433277 1000 -0 2.9059732 - 186000 18.594456 1000 -0 2.9216812 - 187000 18.755532 1000 -0 2.9373891 - 188000 18.918447 1000 -0 2.9530971 - 189000 19.080359 1000 -0 2.9688051 - 190000 19.243927 1000 -0 2.984513 - 191000 19.395044 1000 -0 3.000221 - 192000 19.546837 1000 -0 3.0159289 - 193000 19.695827 1000 -0 3.0316369 - 194000 19.843856 1000 -0 3.0473449 - 195000 19.993821 1000 -0 3.0630528 - 196000 20.145787 1000 -0 3.0787608 - 197000 20.298114 1000 -0 3.0944688 - 198000 20.45074 1000 -0 3.1101767 - 199000 20.607595 1000 -0 3.1258847 - 200000 20.760979 1000 -0 3.1415927 -Loop time of 20.7611 on 4 procs for 200000 steps with 1000 atoms - -Performance: 39328.699 tau/day, 9633.409 timesteps/s -98.0% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.57172 | 0.93292 | 1.2995 | 37.1 | 4.49 -Neigh | 0.015648 | 0.018747 | 0.02175 | 2.1 | 0.09 -Comm | 3.17 | 3.6151 | 4.0856 | 23.0 | 17.41 -Output | 0.0051017 | 0.012686 | 0.033359 | 10.6 | 0.06 -Modify | 12.36 | 13.269 | 14.095 | 21.8 | 63.91 -Other | | 2.912 | | | 14.03 - -Nlocal: 250 ave 270 max 230 min -Histogram: 1 0 0 0 1 0 1 0 0 1 -Nghost: 297 ave 337 max 234 min -Histogram: 1 0 0 0 0 1 0 0 0 2 -Neighs: 982.5 ave 1580 max 496 min -Histogram: 2 0 0 0 0 0 0 1 0 1 - -Total # of neighbors = 3930 -Ave neighs/atom = 3.93 -Neighbor list builds = 218 -Dangerous builds = 0 -unfix ins -run 200000 -Per MPI rank memory allocation (min/avg/max) = 12 | 12.19 | 12.35 Mbytes -Step CPU Atoms KinEng v_theta - 200000 0 1000 0.89289812 3.1415927 - 201000 0.15554476 1000 0.90162438 3.1573006 - 202000 0.31118774 1000 0.89175077 3.1730086 - 203000 0.47266722 1000 0.88068523 3.1887165 - 204000 0.64758801 1000 0.88775074 3.2044245 - 205000 0.85137105 1000 0.89009449 3.2201325 - 206000 1.0712745 1000 0.89031724 3.2358404 - 207000 1.3620427 1000 0.90901476 3.2515484 - 208000 1.6051998 1000 0.91977358 3.2672564 - 209000 1.7975032 1000 0.92044257 3.2829643 - 210000 1.9654117 1000 0.90550844 3.2986723 - 211000 2.1186137 1000 0.90179135 3.3143802 - 212000 2.2714169 1000 0.90474936 3.3300882 - 213000 2.4236252 1000 0.9011002 3.3457962 - 214000 2.5737655 1000 0.89619815 3.3615041 - 215000 2.7326233 1000 0.89129064 3.3772121 - 216000 2.8794787 1000 0.88785486 3.3929201 - 217000 3.0264313 1000 0.89448821 3.408628 - 218000 3.1743443 1000 0.89323746 3.424336 - 219000 3.3225086 1000 0.88176869 3.440044 - 220000 3.4717121 1000 0.86989815 3.4557519 - 221000 3.6229391 1000 0.85900389 3.4714599 - 222000 3.7768724 1000 0.85440461 3.4871678 - 223000 3.9287963 1000 0.8604449 3.5028758 - 224000 4.082505 1000 0.84537374 3.5185838 - 225000 4.234731 1000 0.84526488 3.5342917 - 226000 4.3872988 1000 0.85877362 3.5499997 - 227000 4.5396216 1000 0.86762074 3.5657077 - 228000 4.7092509 1000 0.86460359 3.5814156 - 229000 4.8631954 1000 0.85409682 3.5971236 - 230000 5.0194352 1000 0.83902718 3.6128316 - 231000 5.1765387 1000 0.83908755 3.6285395 - 232000 5.3335299 1000 0.83178808 3.6442475 - 233000 5.4917257 1000 0.83369584 3.6599554 - 234000 5.654233 1000 0.8530074 3.6756634 - 235000 5.8163757 1000 0.86385009 3.6913714 - 236000 5.9791231 1000 0.86453337 3.7070793 - 237000 6.1401029 1000 0.86137572 3.7227873 - 238000 6.300632 1000 0.8656285 3.7384953 - 239000 6.4597898 1000 0.85993724 3.7542032 - 240000 6.6216707 1000 0.8484153 3.7699112 - 241000 6.7793672 1000 0.84624799 3.7856191 - 242000 6.939244 1000 0.83739227 3.8013271 - 243000 7.1013088 1000 0.83026469 3.8170351 - 244000 7.267416 1000 0.81060567 3.832743 - 245000 7.4318523 1000 0.81081038 3.848451 - 246000 7.6077905 1000 0.80857771 3.864159 - 247000 7.7763391 1000 0.80353315 3.8798669 - 248000 7.9485247 1000 0.80191903 3.8955749 - 249000 8.1208956 1000 0.79865102 3.9112829 - 250000 8.2921841 1000 0.79407385 3.9269908 - 251000 8.4614651 1000 0.7880275 3.9426988 - 252000 8.6266186 1000 0.79212521 3.9584067 - 253000 8.7913449 1000 0.78976714 3.9741147 - 254000 8.9596558 1000 0.79720779 3.9898227 - 255000 9.1278918 1000 0.79329363 4.0055306 - 256000 9.3016815 1000 0.80851295 4.0212386 - 257000 9.4701304 1000 0.82322071 4.0369466 - 258000 9.6399531 1000 0.83042211 4.0526545 - 259000 9.8090186 1000 0.82773068 4.0683625 - 260000 9.9798045 1000 0.8246773 4.0840704 - 261000 10.148952 1000 0.81374287 4.0997784 - 262000 10.318855 1000 0.79936963 4.1154864 - 263000 10.496092 1000 0.78124408 4.1311943 - 264000 10.671031 1000 0.77790646 4.1469023 - 265000 10.843052 1000 0.77212005 4.1626103 - 266000 11.01867 1000 0.77977752 4.1783182 - 267000 11.192151 1000 0.79237542 4.1940262 - 268000 11.362491 1000 0.80631398 4.2097342 - 269000 11.53223 1000 0.82380407 4.2254421 - 270000 11.7123 1000 0.82477127 4.2411501 - 271000 11.883593 1000 0.81655074 4.256858 - 272000 12.052348 1000 0.80678676 4.272566 - 273000 12.220196 1000 0.79162789 4.288274 - 274000 12.395164 1000 0.78896081 4.3039819 - 275000 12.569757 1000 0.77904648 4.3196899 - 276000 12.748754 1000 0.78252999 4.3353979 - 277000 12.91648 1000 0.78293295 4.3511058 - 278000 13.086087 1000 0.78311337 4.3668138 - 279000 13.260159 1000 0.77657634 4.3825218 - 280000 13.428503 1000 0.76835711 4.3982297 - 281000 13.596094 1000 0.75586438 4.4139377 - 282000 13.763325 1000 0.74600306 4.4296456 - 283000 13.932867 1000 0.73228762 4.4453536 - 284000 14.098865 1000 0.72344939 4.4610616 - 285000 14.269317 1000 0.72160289 4.4767695 - 286000 14.441196 1000 0.71321619 4.4924775 - 287000 14.614458 1000 0.72631772 4.5081855 - 288000 14.783358 1000 0.74390396 4.5238934 - 289000 14.953564 1000 0.77320352 4.5396014 - 290000 15.12428 1000 0.77249469 4.5553093 - 291000 15.283974 1000 0.7583723 4.5710173 - 292000 15.449553 1000 0.74568347 4.5867253 - 293000 15.611965 1000 0.74108034 4.6024332 - 294000 15.770807 1000 0.72706174 4.6181412 - 295000 15.927151 1000 0.71122597 4.6338492 - 296000 16.086734 1000 0.70272297 4.6495571 - 297000 16.245418 1000 0.6945394 4.6652651 - 298000 16.406617 1000 0.69541258 4.6809731 - 299000 16.568989 1000 0.71696092 4.696681 - 300000 16.754911 1000 0.72939561 4.712389 - 301000 16.919453 1000 0.73621801 4.7280969 - 302000 17.07794 1000 0.72052605 4.7438049 - 303000 17.234397 1000 0.71057318 4.7595129 - 304000 17.39014 1000 0.70014814 4.7752208 - 305000 17.550789 1000 0.68855925 4.7909288 - 306000 17.718802 1000 0.68665019 4.8066368 - 307000 17.874036 1000 0.6831349 4.8223447 - 308000 18.029367 1000 0.67929468 4.8380527 - 309000 18.188065 1000 0.67833006 4.8537606 - 310000 18.348243 1000 0.67764037 4.8694686 - 311000 18.512475 1000 0.68271978 4.8851766 - 312000 18.676519 1000 0.69021026 4.9008845 - 313000 18.836426 1000 0.68795473 4.9165925 - 314000 18.997681 1000 0.68308892 4.9323005 - 315000 19.158794 1000 0.68086977 4.9480084 - 316000 19.318186 1000 0.67879169 4.9637164 - 317000 19.479364 1000 0.68128526 4.9794244 - 318000 19.645085 1000 0.68718719 4.9951323 - 319000 19.806831 1000 0.68419901 5.0108403 - 320000 19.97005 1000 0.68045269 5.0265482 - 321000 20.130643 1000 0.68430036 5.0422562 - 322000 20.291637 1000 0.68195368 5.0579642 - 323000 20.457605 1000 0.67964011 5.0736721 - 324000 20.621699 1000 0.67681293 5.0893801 - 325000 20.78525 1000 0.67601868 5.1050881 - 326000 20.950321 1000 0.67600265 5.120796 - 327000 21.11346 1000 0.68484094 5.136504 - 328000 21.276964 1000 0.68526189 5.152212 - 329000 21.440971 1000 0.67602072 5.1679199 - 330000 21.609791 1000 0.68222852 5.1836279 - 331000 21.773574 1000 0.68825647 5.1993358 - 332000 21.93854 1000 0.68168415 5.2150438 - 333000 22.102281 1000 0.67460357 5.2307518 - 334000 22.265741 1000 0.67747925 5.2464597 - 335000 22.436954 1000 0.681763 5.2621677 - 336000 22.614367 1000 0.67611867 5.2778757 - 337000 22.779064 1000 0.66903217 5.2935836 - 338000 22.945739 1000 0.6684293 5.3092916 - 339000 23.111375 1000 0.66465194 5.3249995 - 340000 23.278674 1000 0.66226848 5.3407075 - 341000 23.444642 1000 0.66407188 5.3564155 - 342000 23.614615 1000 0.65762812 5.3721234 - 343000 23.785007 1000 0.66936507 5.3878314 - 344000 23.956265 1000 0.67424224 5.4035394 - 345000 24.129057 1000 0.684271 5.4192473 - 346000 24.303073 1000 0.68294352 5.4349553 - 347000 24.475812 1000 0.69795697 5.4506633 - 348000 24.652771 1000 0.69818863 5.4663712 - 349000 24.830973 1000 0.69578798 5.4820792 - 350000 25.00923 1000 0.69377251 5.4977871 - 351000 25.185421 1000 0.69638202 5.5134951 - 352000 25.363647 1000 0.70115823 5.5292031 - 353000 25.540517 1000 0.70891635 5.544911 - 354000 25.718709 1000 0.70876639 5.560619 - 355000 25.893633 1000 0.71130235 5.576327 - 356000 26.068423 1000 0.69380913 5.5920349 - 357000 26.243801 1000 0.67934899 5.6077429 - 358000 26.418883 1000 0.67024516 5.6234508 - 359000 26.594722 1000 0.66145645 5.6391588 - 360000 26.770322 1000 0.65335546 5.6548668 - 361000 26.946396 1000 0.65495192 5.6705747 - 362000 27.12296 1000 0.64973833 5.6862827 - 363000 27.298461 1000 0.64532381 5.7019907 - 364000 27.473586 1000 0.64282855 5.7176986 - 365000 27.653872 1000 0.64451862 5.7334066 - 366000 27.830317 1000 0.64366439 5.7491146 - 367000 28.007037 1000 0.64395479 5.7648225 - 368000 28.184079 1000 0.65827587 5.7805305 - 369000 28.376009 1000 0.66311341 5.7962384 - 370000 28.557287 1000 0.66165026 5.8119464 - 371000 28.736569 1000 0.66878374 5.8276544 - 372000 28.91063 1000 0.66944548 5.8433623 - 373000 29.084648 1000 0.66061945 5.8590703 - 374000 29.258649 1000 0.65320954 5.8747783 - 375000 29.433156 1000 0.64641195 5.8904862 - 376000 29.611781 1000 0.64631388 5.9061942 - 377000 29.78531 1000 0.64232398 5.9219022 - 378000 29.955917 1000 0.63805257 5.9376101 - 379000 30.126378 1000 0.63666047 5.9533181 - 380000 30.297285 1000 0.63651856 5.969026 - 381000 30.471635 1000 0.6377374 5.984734 - 382000 30.644813 1000 0.64750107 6.000442 - 383000 30.816208 1000 0.65655138 6.0161499 - 384000 30.986444 1000 0.65408935 6.0318579 - 385000 31.156501 1000 0.64437236 6.0475659 - 386000 31.327665 1000 0.63862174 6.0632738 - 387000 31.49731 1000 0.64133807 6.0789818 - 388000 31.682031 1000 0.64174374 6.0946897 - 389000 31.85148 1000 0.64480071 6.1103977 - 390000 32.020336 1000 0.64982943 6.1261057 - 391000 32.187634 1000 0.6461109 6.1418136 - 392000 32.357282 1000 0.64044412 6.1575216 - 393000 32.527796 1000 0.64662995 6.1732296 - 394000 32.704323 1000 0.65330527 6.1889375 - 395000 32.880643 1000 0.66026265 6.2046455 - 396000 33.048614 1000 0.6718969 6.2203535 - 397000 33.222059 1000 0.66481385 6.2360614 - 398000 33.391738 1000 0.66685494 6.2517694 - 399000 33.560431 1000 0.6612594 6.2674773 - 400000 33.729715 1000 0.65289572 6.2831853 -Loop time of 33.7298 on 4 procs for 200000 steps with 1000 atoms - -Performance: 24207.249 tau/day, 5929.470 timesteps/s -97.9% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.6748 | 2.6848 | 3.6646 | 58.4 | 7.96 -Neigh | 0.021206 | 0.026438 | 0.03191 | 3.1 | 0.08 -Comm | 6.133 | 7.3745 | 8.6652 | 45.0 | 21.86 -Output | 0.0053763 | 0.016101 | 0.044719 | 13.0 | 0.05 -Modify | 18.26 | 20.115 | 22.413 | 39.2 | 59.64 -Other | | 3.513 | | | 10.42 - -Nlocal: 250 ave 266 max 230 min -Histogram: 1 0 0 0 0 1 1 0 0 1 -Nghost: 401.5 ave 476 max 325 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Neighs: 1264 ave 1634 max 895 min -Histogram: 1 0 1 0 0 0 0 1 0 1 - -Total # of neighbors = 5056 -Ave neighs/atom = 5.056 -Neighbor list builds = 160 -Dangerous builds = 0 -Total wall time: 0:00:54 diff --git a/examples/granular/in.pour.heat b/examples/granular/in.pour.heat index 495a80454a..69590389b5 100644 --- a/examples/granular/in.pour.heat +++ b/examples/granular/in.pour.heat @@ -51,7 +51,7 @@ region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${ fix 0 all balance 100 1.0 shift xy 5 1.1 fix 1 all nve/sphere -fix 2 all temp/integrate constant 1.0 +fix 2 all heat/flow/sphere/temp constant 1.0 fix grav all gravity 10 vector 0 0 -1 fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} fix ins2 all pour 1000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} diff --git a/examples/granular/log.15Sep22.pour.drum.g++.1 b/examples/granular/log.15Sep22.pour.drum.g++.1 new file mode 100644 index 0000000000..75cc115dd1 --- /dev/null +++ b/examples/granular/log.15Sep22.pour.drum.g++.1 @@ -0,0 +1,272 @@ +LAMMPS (15 Sep 2022) +# pour two types of particles (cohesive and non-cohesive) into cylinder +# 'turn' cylinder by changing direction of gravity, then rotate it. +# This simulates a rotating drum powder characterization experiment. + +variable name string rotating_drum_two_types + +atom_style sphere +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 30 +variable boxy equal 30 +variable boxz equal 50 + +variable drum_rad equal ${boxx}*0.5 +variable drum_rad equal 30*0.5 +variable drum_height equal 20 + +variable xc equal 0.5*${boxx} +variable xc equal 0.5*30 +variable yc equal 0.5*${boxx} +variable yc equal 0.5*30 +variable zc equal 0.5*${boxz} +variable zc equal 0.5*50 + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} +variable cyl_rad_inner equal 15-1.1*${rhi} +variable cyl_rad_inner equal 15-1.1*0.5 + +variable dens equal 1.0 + +variable skin equal 0.4*${rhi} +variable skin equal 0.4*0.5 + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +region boxreg block 0 30 0 ${boxy} 0 ${boxz} +region boxreg block 0 30 0 30 0 ${boxz} +region boxreg block 0 30 0 30 0 50 +create_box 2 boxreg +Created orthogonal box = (0 0 0) to (30 30 50) + 1 by 1 by 1 MPI processor grid +change_box all boundary p p f +Changing box ... + +pair_style granular +pair_coeff 1 * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji +pair_coeff 2 2 jkr 1e5 0.1 0.3 50 tangential mindlin NULL 1.0 0.5 rolling sds 1e3 1e3 0.1 twisting marshall + +variable theta equal 0 + +region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 15 0 0 0 1 +region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region bottom_wall plane 15 ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 ${yc} 0 0 0 1 +region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 15 0 0 0 1 + +region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 15 ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 15 15 ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 15 15 14.45 ${drum_height} ${boxz} +region insreg cylinder z 15 15 14.45 20 ${boxz} +region insreg cylinder z 15 15 14.45 20 50 + +fix 0 all balance 100 1.0 shift xy 5 1.1 +fix 1 all nve/sphere +fix grav all gravity 10 vector 0 0 -1 +fix ins1 all pour 2000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 9396 every 490 steps, 2000 by step 1 +fix ins2 all pour 2000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 9396 every 490 steps, 2000 by step 1 + +comm_modify vel yes + +neighbor ${skin} bin +neighbor 0.2 bin +neigh_modify delay 0 every 1 check yes + +fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region bottom_wall + +thermo_style custom step atoms ke v_theta +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 100 ${name}.dump id type radius mass x y z + +#For removal later +compute 1 all property/atom radius +variable zmax atom z+c_1>0.5*${drum_height} +variable zmax atom z+c_1>0.5*20 +group delgroup dynamic all var zmax every 10000 +dynamic group delgroup defined + +run 2000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.2 + ghost atom cutoff = 1.2 + binsize = 0.6, bins = 50 50 84 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair granular, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 16.08 | 16.08 | 16.08 Mbytes + Step Atoms KinEng v_theta + 0 0 -0 0 + 100 4000 -0 0 + 200 4000 -0 0 + 300 4000 -0 0 + 400 4000 -0 0 + 500 4000 -0 0 + 600 4000 -0 0 + 700 4000 -0 0 + 800 4000 -0 0 + 900 4000 -0 0 + 1000 4000 -0 0 + 1100 4000 -0 0 + 1200 4000 -0 0 + 1300 4000 -0 0 + 1400 4000 -0 0 + 1500 4000 -0 0 + 1600 4000 -0 0 + 1700 4000 -0 0 + 1800 4000 -0 0 + 1900 4000 -0 0 + 2000 4000 -0 0 +Loop time of 2.81549 on 1 procs for 2000 steps with 4000 atoms + +Performance: 61374.657 tau/day, 710.355 timesteps/s, 2.841 Matom-step/s +98.4% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.35362 | 0.35362 | 0.35362 | 0.0 | 12.56 +Neigh | 1.0852 | 1.0852 | 1.0852 | 0.0 | 38.54 +Comm | 0.041891 | 0.041891 | 0.041891 | 0.0 | 1.49 +Output | 0.00059151 | 0.00059151 | 0.00059151 | 0.0 | 0.02 +Modify | 1.2814 | 1.2814 | 1.2814 | 0.0 | 45.51 +Other | | 0.0528 | | | 1.88 + +Nlocal: 4000 ave 4000 max 4000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 179 ave 179 max 179 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7019 ave 7019 max 7019 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7019 +Ave neighs/atom = 1.75475 +Neighbor list builds = 1000 +Dangerous builds = 0 + +#Remove any particles that are above z > 0.5*drum_height +delete_atoms group delgroup +Deleted 0 atoms, new total = 4000 + +#Add top lid +region top_wall plane ${xc} ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 15 ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 ${yc} 0 0 0 1 +region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 15 0 0 0 1 +fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region top_wall + +# 'Turn' drum by switching the direction of gravity +unfix grav +unfix ins1 +unfix ins2 +fix grav all gravity 10 vector 0 -1 0 + +variable theta equal 2*PI*elapsed/20000.0 +run 3000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 22.42 | 22.42 | 22.42 Mbytes + Step Atoms KinEng v_theta + 2000 4000 59.969827 0 + 2100 4000 47.251389 0.031415927 + 2200 4000 33.726755 0.062831853 + 2300 4000 24.212479 0.09424778 + 2400 4000 17.366268 0.12566371 + 2500 4000 18.502318 0.15707963 + 2600 4000 17.44981 0.18849556 + 2700 4000 16.068315 0.21991149 + 2800 4000 14.252644 0.25132741 + 2900 4000 11.544019 0.28274334 + 3000 4000 9.0353662 0.31415927 + 3100 4000 6.9955912 0.34557519 + 3200 4000 5.955137 0.37699112 + 3300 4000 5.8947849 0.40840704 + 3400 4000 6.0544729 0.43982297 + 3500 4000 6.5326359 0.4712389 + 3600 4000 6.6047764 0.50265482 + 3700 4000 6.7073614 0.53407075 + 3800 4000 6.7367804 0.56548668 + 3900 4000 6.6178006 0.5969026 + 4000 4000 6.3834858 0.62831853 + 4100 4000 5.8660652 0.65973446 + 4200 4000 5.308513 0.69115038 + 4300 4000 4.7270842 0.72256631 + 4400 4000 4.1920733 0.75398224 + 4500 4000 3.7068814 0.78539816 + 4600 4000 3.3259615 0.81681409 + 4700 4000 2.9339231 0.84823002 + 4800 4000 2.670752 0.87964594 + 4900 4000 2.4509115 0.91106187 + 5000 4000 2.2609335 0.9424778 +Loop time of 9.82178 on 1 procs for 3000 steps with 4000 atoms + +Performance: 26390.330 tau/day, 305.444 timesteps/s, 1.222 Matom-step/s +99.4% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 3.2932 | 3.2932 | 3.2932 | 0.0 | 33.53 +Neigh | 2.2872 | 2.2872 | 2.2872 | 0.0 | 23.29 +Comm | 0.067117 | 0.067117 | 0.067117 | 0.0 | 0.68 +Output | 0.00093425 | 0.00093425 | 0.00093425 | 0.0 | 0.01 +Modify | 4.0986 | 4.0986 | 4.0986 | 0.0 | 41.73 +Other | | 0.07476 | | | 0.76 + +Nlocal: 4000 ave 4000 max 4000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 363 ave 363 max 363 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 13089 ave 13089 max 13089 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 13089 +Ave neighs/atom = 3.27225 +Neighbor list builds = 1247 +Dangerous builds = 130 +Total wall time: 0:00:12 diff --git a/examples/granular/log.15Sep22.pour.drum.g++.4 b/examples/granular/log.15Sep22.pour.drum.g++.4 new file mode 100644 index 0000000000..4ab6f92b8b --- /dev/null +++ b/examples/granular/log.15Sep22.pour.drum.g++.4 @@ -0,0 +1,272 @@ +LAMMPS (15 Sep 2022) +# pour two types of particles (cohesive and non-cohesive) into cylinder +# 'turn' cylinder by changing direction of gravity, then rotate it. +# This simulates a rotating drum powder characterization experiment. + +variable name string rotating_drum_two_types + +atom_style sphere +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 30 +variable boxy equal 30 +variable boxz equal 50 + +variable drum_rad equal ${boxx}*0.5 +variable drum_rad equal 30*0.5 +variable drum_height equal 20 + +variable xc equal 0.5*${boxx} +variable xc equal 0.5*30 +variable yc equal 0.5*${boxx} +variable yc equal 0.5*30 +variable zc equal 0.5*${boxz} +variable zc equal 0.5*50 + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} +variable cyl_rad_inner equal 15-1.1*${rhi} +variable cyl_rad_inner equal 15-1.1*0.5 + +variable dens equal 1.0 + +variable skin equal 0.4*${rhi} +variable skin equal 0.4*0.5 + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +region boxreg block 0 30 0 ${boxy} 0 ${boxz} +region boxreg block 0 30 0 30 0 ${boxz} +region boxreg block 0 30 0 30 0 50 +create_box 2 boxreg +Created orthogonal box = (0 0 0) to (30 30 50) + 2 by 2 by 1 MPI processor grid +change_box all boundary p p f +Changing box ... + +pair_style granular +pair_coeff 1 * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji +pair_coeff 2 2 jkr 1e5 0.1 0.3 50 tangential mindlin NULL 1.0 0.5 rolling sds 1e3 1e3 0.1 twisting marshall + +variable theta equal 0 + +region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 ${yc} 0 0 0 1 +region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 15 0 0 0 1 +region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region bottom_wall plane 15 ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 ${yc} 0 0 0 1 +region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 15 0 0 0 1 + +region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 15 ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 15 15 ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 15 15 14.45 ${drum_height} ${boxz} +region insreg cylinder z 15 15 14.45 20 ${boxz} +region insreg cylinder z 15 15 14.45 20 50 + +fix 0 all balance 100 1.0 shift xy 5 1.1 +fix 1 all nve/sphere +fix grav all gravity 10 vector 0 0 -1 +fix ins1 all pour 2000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 9396 every 490 steps, 2000 by step 1 +fix ins2 all pour 2000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 9396 every 490 steps, 2000 by step 1 + +comm_modify vel yes + +neighbor ${skin} bin +neighbor 0.2 bin +neigh_modify delay 0 every 1 check yes + +fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region bottom_wall + +thermo_style custom step atoms ke v_theta +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 100 ${name}.dump id type radius mass x y z + +#For removal later +compute 1 all property/atom radius +variable zmax atom z+c_1>0.5*${drum_height} +variable zmax atom z+c_1>0.5*20 +group delgroup dynamic all var zmax every 10000 +dynamic group delgroup defined + +run 2000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.2 + ghost atom cutoff = 1.2 + binsize = 0.6, bins = 50 50 84 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair granular, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 15.3 | 15.3 | 15.3 Mbytes + Step Atoms KinEng v_theta + 0 0 -0 0 + 100 4000 -0 0 + 200 4000 -0 0 + 300 4000 -0 0 + 400 4000 -0 0 + 500 4000 -0 0 + 600 4000 -0 0 + 700 4000 -0 0 + 800 4000 -0 0 + 900 4000 -0 0 + 1000 4000 -0 0 + 1100 4000 -0 0 + 1200 4000 -0 0 + 1300 4000 -0 0 + 1400 4000 -0 0 + 1500 4000 -0 0 + 1600 4000 -0 0 + 1700 4000 -0 0 + 1800 4000 -0 0 + 1900 4000 -0 0 + 2000 4000 -0 0 +Loop time of 0.744926 on 4 procs for 2000 steps with 4000 atoms + +Performance: 231969.322 tau/day, 2684.830 timesteps/s, 10.739 Matom-step/s +98.1% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.064917 | 0.069813 | 0.074844 | 1.7 | 9.37 +Neigh | 0.15075 | 0.15915 | 0.1692 | 1.9 | 21.36 +Comm | 0.11223 | 0.11821 | 0.12247 | 1.1 | 15.87 +Output | 0.00030739 | 0.00036898 | 0.00046777 | 0.0 | 0.05 +Modify | 0.36068 | 0.36657 | 0.37031 | 0.7 | 49.21 +Other | | 0.03082 | | | 4.14 + +Nlocal: 1000 ave 1010 max 990 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 285 ave 287 max 283 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 1714.25 ave 1764 max 1651 min +Histogram: 1 0 1 0 0 0 0 0 0 2 + +Total # of neighbors = 6857 +Ave neighs/atom = 1.71425 +Neighbor list builds = 1000 +Dangerous builds = 0 + +#Remove any particles that are above z > 0.5*drum_height +delete_atoms group delgroup +Deleted 0 atoms, new total = 4000 + +#Add top lid +region top_wall plane ${xc} ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 15 ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 +region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 ${yc} 0 0 0 1 +region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 15 0 0 0 1 +fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region top_wall + +# 'Turn' drum by switching the direction of gravity +unfix grav +unfix ins1 +unfix ins2 +fix grav all gravity 10 vector 0 -1 0 + +variable theta equal 2*PI*elapsed/20000.0 +run 3000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 21.6 | 21.6 | 21.6 Mbytes + Step Atoms KinEng v_theta + 2000 4000 60.10546 0 + 2100 4000 47.274123 0.031415927 + 2200 4000 33.475582 0.062831853 + 2300 4000 24.083669 0.09424778 + 2400 4000 17.36351 0.12566371 + 2500 4000 18.576501 0.15707963 + 2600 4000 17.39 0.18849556 + 2700 4000 15.789254 0.21991149 + 2800 4000 14.08156 0.25132741 + 2900 4000 11.636681 0.28274334 + 3000 4000 8.9897685 0.31415927 + 3100 4000 7.0703519 0.34557519 + 3200 4000 6.0741809 0.37699112 + 3300 4000 5.8286097 0.40840704 + 3400 4000 6.059001 0.43982297 + 3500 4000 6.4310861 0.4712389 + 3600 4000 6.3957528 0.50265482 + 3700 4000 6.4858292 0.53407075 + 3800 4000 6.4685962 0.56548668 + 3900 4000 6.3469676 0.5969026 + 4000 4000 6.2808022 0.62831853 + 4100 4000 5.957048 0.65973446 + 4200 4000 5.5378951 0.69115038 + 4300 4000 4.8523264 0.72256631 + 4400 4000 4.2485239 0.75398224 + 4500 4000 3.7587486 0.78539816 + 4600 4000 3.327008 0.81681409 + 4700 4000 2.9421013 0.84823002 + 4800 4000 2.75247 0.87964594 + 4900 4000 2.5306332 0.91106187 + 5000 4000 2.352504 0.9424778 +Loop time of 2.48704 on 4 procs for 3000 steps with 4000 atoms + +Performance: 104220.238 tau/day, 1206.253 timesteps/s, 4.825 Matom-step/s +98.6% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.51605 | 0.70407 | 0.86299 | 14.7 | 28.31 +Neigh | 0.3522 | 0.42808 | 0.50041 | 8.0 | 17.21 +Comm | 0.17318 | 0.42324 | 0.7046 | 29.0 | 17.02 +Output | 0.00079725 | 0.0013956 | 0.002092 | 1.3 | 0.06 +Modify | 0.68507 | 0.79676 | 0.90954 | 8.9 | 32.04 +Other | | 0.1335 | | | 5.37 + +Nlocal: 1000 ave 1330 max 670 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 525.5 ave 781 max 417 min +Histogram: 2 1 0 0 0 0 0 0 0 1 +Neighs: 3243.75 ave 4460 max 2012 min +Histogram: 1 1 0 0 0 0 0 0 1 1 + +Total # of neighbors = 12975 +Ave neighs/atom = 3.24375 +Neighbor list builds = 1299 +Dangerous builds = 129 +Total wall time: 0:00:03 diff --git a/examples/granular/log.15Sep22.pour.flatwall.g++.1 b/examples/granular/log.15Sep22.pour.flatwall.g++.1 new file mode 100644 index 0000000000..f863993b46 --- /dev/null +++ b/examples/granular/log.15Sep22.pour.flatwall.g++.1 @@ -0,0 +1,195 @@ +LAMMPS (15 Sep 2022) +# pour two types of particles (cohesive and non-cohesive) on flat wall + +variable name string pour_two_types + +atom_style sphere +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 20 +variable boxy equal 20 +variable boxz equal 30 + +variable xc1 equal 0.3*${boxx} +variable xc1 equal 0.3*20 +variable xc2 equal 0.7*${boxx} +variable xc2 equal 0.7*20 +variable yc equal 0.5*${boxy} +variable yc equal 0.5*20 + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable dens equal 1.0 + +variable skin equal 0.3*${rhi} +variable skin equal 0.3*0.5 + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +region boxreg block 0 20 0 ${boxy} 0 ${boxz} +region boxreg block 0 20 0 20 0 ${boxz} +region boxreg block 0 20 0 20 0 30 +create_box 2 boxreg +Created orthogonal box = (0 0 0) to (20 20 30) + 1 by 1 by 1 MPI processor grid +change_box all boundary p p f +Changing box ... + +pair_style granular +pair_coeff 1 * jkr 1000.0 50.0 0.3 10 tangential mindlin 800.0 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall +pair_coeff 2 2 hertz 200.0 20.0 tangential linear_history 300.0 1.0 0.1 rolling sds 200.0 100.0 0.1 twisting marshall + +comm_modify vel yes + +region insreg1 cylinder z ${xc1} ${yc} 5 15 ${boxz} +region insreg1 cylinder z 6 ${yc} 5 15 ${boxz} +region insreg1 cylinder z 6 10 5 15 ${boxz} +region insreg1 cylinder z 6 10 5 15 30 +region insreg2 cylinder z ${xc2} ${yc} 5 15 ${boxz} +region insreg2 cylinder z 14 ${yc} 5 15 ${boxz} +region insreg2 cylinder z 14 10 5 15 ${boxz} +region insreg2 cylinder z 14 10 5 15 30 + +fix 1 all nve/sphere +fix grav all gravity 10.0 vector 0 0 -1 +fix ins1 all pour 1500 1 3123 region insreg1 diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens ${dens} ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 1 +Particle insertion: 562 every 346 steps, 1500 by step 693 +fix ins2 all pour 1500 2 3123 region insreg2 diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens ${dens} ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 1 +Particle insertion: 562 every 346 steps, 1500 by step 693 + +neighbor ${skin} bin +neighbor 0.15 bin +neigh_modify delay 0 every 1 check yes + +fix 3 all wall/gran granular hertz/material 1e5 1e3 0.3 tangential mindlin NULL 1.0 0.5 zplane 0 NULL + +thermo_style custom step atoms ke +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 100 ${name}.dump id type radius mass x y z + +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.15 + ghost atom cutoff = 1.15 + binsize = 0.575, bins = 35 35 53 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair granular, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 15.27 | 15.27 | 15.27 Mbytes + Step Atoms KinEng + 0 0 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 100 926 -0 + 200 926 -0 + 300 926 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 400 1498 -0 + 500 1498 -0 + 600 1498 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 700 2275 -0 + 800 2275 -0 + 900 2275 -0 + 1000 2275 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 1100 2954 -0 + 1200 2954 -0 + 1300 2954 -0 + 1400 3000 -0 + 1500 3000 -0 + 1600 3000 -0 + 1700 3000 -0 + 1800 3000 -0 + 1900 3000 -0 + 2000 3000 -0 + 2100 3000 -0 + 2200 3000 -0 + 2300 3000 -0 + 2400 3000 -0 + 2500 3000 -0 + 2600 3000 -0 + 2700 3000 -0 + 2800 3000 -0 + 2900 3000 -0 + 3000 3000 -0 + 3100 3000 -0 + 3200 3000 -0 + 3300 3000 -0 + 3400 3000 -0 + 3500 3000 -0 + 3600 3000 -0 + 3700 3000 -0 + 3800 3000 -0 + 3900 3000 -0 + 4000 3000 -0 + 4100 3000 -0 + 4200 3000 -0 + 4300 3000 -0 + 4400 3000 -0 + 4500 3000 -0 + 4600 3000 -0 + 4700 3000 -0 + 4800 3000 -0 + 4900 3000 -0 + 5000 3000 -0 +Loop time of 10.7721 on 1 procs for 5000 steps with 3000 atoms + +Performance: 40103.467 tau/day, 464.160 timesteps/s, 1.392 Matom-step/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 8.1117 | 8.1117 | 8.1117 | 0.0 | 75.30 +Neigh | 1.2885 | 1.2885 | 1.2885 | 0.0 | 11.96 +Comm | 0.059888 | 0.059888 | 0.059888 | 0.0 | 0.56 +Output | 0.0011158 | 0.0011158 | 0.0011158 | 0.0 | 0.01 +Modify | 1.2436 | 1.2436 | 1.2436 | 0.0 | 11.54 +Other | | 0.06727 | | | 0.62 + +Nlocal: 3000 ave 3000 max 3000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 471 ave 471 max 471 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 16713 ave 16713 max 16713 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 16713 +Ave neighs/atom = 5.571 +Neighbor list builds = 1102 +Dangerous builds = 0 +Total wall time: 0:00:10 diff --git a/examples/granular/log.15Sep22.pour.flatwall.g++.4 b/examples/granular/log.15Sep22.pour.flatwall.g++.4 new file mode 100644 index 0000000000..5fb99ea042 --- /dev/null +++ b/examples/granular/log.15Sep22.pour.flatwall.g++.4 @@ -0,0 +1,195 @@ +LAMMPS (15 Sep 2022) +# pour two types of particles (cohesive and non-cohesive) on flat wall + +variable name string pour_two_types + +atom_style sphere +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 20 +variable boxy equal 20 +variable boxz equal 30 + +variable xc1 equal 0.3*${boxx} +variable xc1 equal 0.3*20 +variable xc2 equal 0.7*${boxx} +variable xc2 equal 0.7*20 +variable yc equal 0.5*${boxy} +variable yc equal 0.5*20 + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable dens equal 1.0 + +variable skin equal 0.3*${rhi} +variable skin equal 0.3*0.5 + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +region boxreg block 0 20 0 ${boxy} 0 ${boxz} +region boxreg block 0 20 0 20 0 ${boxz} +region boxreg block 0 20 0 20 0 30 +create_box 2 boxreg +Created orthogonal box = (0 0 0) to (20 20 30) + 2 by 2 by 1 MPI processor grid +change_box all boundary p p f +Changing box ... + +pair_style granular +pair_coeff 1 * jkr 1000.0 50.0 0.3 10 tangential mindlin 800.0 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall +pair_coeff 2 2 hertz 200.0 20.0 tangential linear_history 300.0 1.0 0.1 rolling sds 200.0 100.0 0.1 twisting marshall + +comm_modify vel yes + +region insreg1 cylinder z ${xc1} ${yc} 5 15 ${boxz} +region insreg1 cylinder z 6 ${yc} 5 15 ${boxz} +region insreg1 cylinder z 6 10 5 15 ${boxz} +region insreg1 cylinder z 6 10 5 15 30 +region insreg2 cylinder z ${xc2} ${yc} 5 15 ${boxz} +region insreg2 cylinder z 14 ${yc} 5 15 ${boxz} +region insreg2 cylinder z 14 10 5 15 ${boxz} +region insreg2 cylinder z 14 10 5 15 30 + +fix 1 all nve/sphere +fix grav all gravity 10.0 vector 0 0 -1 +fix ins1 all pour 1500 1 3123 region insreg1 diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens ${dens} ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 ${dens} +fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 1 +Particle insertion: 562 every 346 steps, 1500 by step 693 +fix ins2 all pour 1500 2 3123 region insreg2 diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens ${dens} ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 ${dens} +fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 1 +Particle insertion: 562 every 346 steps, 1500 by step 693 + +neighbor ${skin} bin +neighbor 0.15 bin +neigh_modify delay 0 every 1 check yes + +fix 3 all wall/gran granular hertz/material 1e5 1e3 0.3 tangential mindlin NULL 1.0 0.5 zplane 0 NULL + +thermo_style custom step atoms ke +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 100 ${name}.dump id type radius mass x y z + +run 5000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.15 + ghost atom cutoff = 1.15 + binsize = 0.575, bins = 35 35 53 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair granular, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 15.04 | 15.04 | 15.04 Mbytes + Step Atoms KinEng + 0 0 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 100 926 -0 + 200 926 -0 + 300 926 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 400 1498 -0 + 500 1498 -0 + 600 1498 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 700 2275 -0 + 800 2275 -0 + 900 2275 -0 + 1000 2275 -0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 1100 2954 -0 + 1200 2954 -0 + 1300 2954 -0 + 1400 3000 -0 + 1500 3000 -0 + 1600 3000 -0 + 1700 3000 -0 + 1800 3000 -0 + 1900 3000 -0 + 2000 3000 -0 + 2100 3000 -0 + 2200 3000 -0 + 2300 3000 -0 + 2400 3000 -0 + 2500 3000 -0 + 2600 3000 -0 + 2700 3000 -0 + 2800 3000 -0 + 2900 3000 -0 + 3000 3000 -0 + 3100 3000 -0 + 3200 3000 -0 + 3300 3000 -0 + 3400 3000 -0 + 3500 3000 -0 + 3600 3000 -0 + 3700 3000 -0 + 3800 3000 -0 + 3900 3000 -0 + 4000 3000 -0 + 4100 3000 -0 + 4200 3000 -0 + 4300 3000 -0 + 4400 3000 -0 + 4500 3000 -0 + 4600 3000 -0 + 4700 3000 -0 + 4800 3000 -0 + 4900 3000 -0 + 5000 3000 -0 +Loop time of 4.06277 on 4 procs for 5000 steps with 3000 atoms + +Performance: 106331.276 tau/day, 1230.686 timesteps/s, 3.692 Matom-step/s +98.7% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.85426 | 1.7801 | 2.7631 | 64.4 | 43.82 +Neigh | 0.18775 | 0.25657 | 0.3279 | 11.5 | 6.32 +Comm | 0.23605 | 1.3334 | 2.3703 | 81.6 | 32.82 +Output | 0.00059456 | 0.0008165 | 0.0012002 | 0.0 | 0.02 +Modify | 0.59336 | 0.64066 | 0.6864 | 4.3 | 15.77 +Other | | 0.05122 | | | 1.26 + +Nlocal: 750 ave 1032 max 463 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 426.5 ave 482 max 375 min +Histogram: 1 1 0 0 0 0 0 1 0 1 +Neighs: 4164.25 ave 6310 max 1941 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 16657 +Ave neighs/atom = 5.5523333 +Neighbor list builds = 1114 +Dangerous builds = 0 +Total wall time: 0:00:04 diff --git a/examples/granular/log.15Sep22.pour.heat.g++.1 b/examples/granular/log.15Sep22.pour.heat.g++.1 new file mode 100644 index 0000000000..d232752c74 --- /dev/null +++ b/examples/granular/log.15Sep22.pour.heat.g++.1 @@ -0,0 +1,1172 @@ +LAMMPS (15 Sep 2022) +# pour one types of particles into cylinder and oscillate +# temperature of the bottom plate + +variable name string heat_plate + +atom_style sphere/temp +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 10 +variable boxy equal 10 +variable boxz equal 50 + +variable drum_rad equal ${boxx}*0.5 +variable drum_rad equal 10*0.5 +variable drum_height equal 30 + +variable xc equal 0.5*${boxx} +variable xc equal 0.5*10 +variable yc equal 0.5*${boxx} +variable yc equal 0.5*10 +variable zc equal 0.5*${boxz} +variable zc equal 0.5*50 + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} +variable cyl_rad_inner equal 5-1.1*${rhi} +variable cyl_rad_inner equal 5-1.1*0.5 + +variable dens equal 1.0 + +variable skin equal 0.4*${rhi} +variable skin equal 0.4*0.5 + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +region boxreg block 0 10 0 ${boxy} 0 ${boxz} +region boxreg block 0 10 0 10 0 ${boxz} +region boxreg block 0 10 0 10 0 50 +create_box 2 boxreg +Created orthogonal box = (0 0 0) to (10 10 50) + 1 by 1 by 1 MPI processor grid +change_box all boundary p p f +Changing box ... + +pair_style granular +pair_coeff * * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 + +region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in +region curved_wall cylinder z 5 ${yc} ${drum_rad} 0 ${drum_height} side in +region curved_wall cylinder z 5 5 ${drum_rad} 0 ${drum_height} side in +region curved_wall cylinder z 5 5 5 0 ${drum_height} side in +region curved_wall cylinder z 5 5 5 0 30 side in +region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in +region bottom_wall plane 5 ${yc} 0 0 0 1 side in +region bottom_wall plane 5 5 0 0 0 1 side in + +region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 5 ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 5 5 ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 5 5 4.45 ${drum_height} ${boxz} +region insreg cylinder z 5 5 4.45 30 ${boxz} +region insreg cylinder z 5 5 4.45 30 50 + +fix 0 all balance 100 1.0 shift xy 5 1.1 +fix 1 all nve/sphere +fix 2 all heat/flow/sphere/temp constant 1.0 +fix grav all gravity 10 vector 0 0 -1 +fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 594 every 400 steps, 1000 by step 401 +fix ins2 all pour 1000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 594 every 400 steps, 1000 by step 401 + +comm_modify vel yes + +neighbor ${skin} bin +neighbor 0.2 bin +neigh_modify delay 0 every 1 check yes + +variable oscillate equal 1.0*sin(step*0.0001) + +fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate + +thermo_style custom step atoms ke pxx pyy pzz +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 1000 ${name}.dump id type radius mass x y z temperature heatflow + +#For removal later +compute 1 all property/atom radius +variable zmax atom z+c_1>0.5*${drum_height} +variable zmax atom z+c_1>0.5*30 +group delgroup dynamic all var zmax every 10000 +dynamic group delgroup defined + +run 100000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.2 + ghost atom cutoff = 1.2 + binsize = 0.6, bins = 17 17 84 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair granular, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.944 | 5.944 | 5.944 Mbytes + Step Atoms KinEng Pxx Pyy Pzz + 0 0 -0 0 0 0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 100 536 -0 0 0 7.4220499 + 200 536 -0 0 0 10.753096 + 300 536 -0 0 0 13.500241 + 400 536 -0 0 0 18.036636 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 500 903 -0 0 0 25.955524 + 600 903 -0 0 0 32.116907 + 700 903 -0 0.03620165 0.033499977 32.179357 + 800 903 -0 0.2106713 0.26431108 36.206318 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 900 1265 -0 0.2667335 0.20266671 44.177757 + 1000 1265 -0 0.51829264 0.67739216 49.904079 + 1100 1265 -0 0.87526847 0.66040207 53.13465 + 1200 1265 -0 0.7989492 0.81976513 54.277194 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 1300 1618 -0 1.0736038 1.2317728 60.921948 + 1400 1618 -0 3.6835952 3.1929764 60.725834 + 1500 1618 -0 2.756994 2.611876 61.575807 + 1600 1618 -0 3.3981246 3.253067 61.920098 + 1700 2000 -0 3.8273855 3.6731016 68.643557 + 1800 2000 -0 4.7528855 4.4495018 69.914035 + 1900 2000 -0 5.1197897 5.3612522 76.341875 + 2000 2000 -0 7.4609619 7.3959134 76.619654 + 2100 2000 -0 6.8808532 7.6237902 73.684129 + 2200 2000 -0 10.034925 9.4881564 72.897703 + 2300 2000 -0 10.110575 10.379096 70.330499 + 2400 2000 -0 12.458237 12.285825 68.726515 + 2500 2000 -0 11.081771 11.120864 59.216898 + 2600 2000 -0 11.441977 11.532286 57.698842 + 2700 2000 -0 12.285359 11.905254 56.086117 + 2800 2000 -0 13.392058 13.168532 54.678918 + 2900 2000 -0 12.439277 12.212282 49.214122 + 3000 2000 -0 11.12664 11.09865 43.35763 + 3100 2000 -0 12.899283 12.735645 45.72121 + 3200 2000 -0 13.397802 12.892421 40.82795 + 3300 2000 -0 11.935141 11.858897 33.412627 + 3400 2000 -0 12.005889 11.539848 29.290034 + 3500 2000 -0 13.311405 13.11741 27.54997 + 3600 2000 -0 11.985219 11.954031 21.79518 + 3700 2000 -0 10.728636 9.800667 14.497682 + 3800 2000 -0 10.082744 9.6420894 12.241554 + 3900 2000 -0 9.6227604 9.1331298 10.31104 + 4000 2000 -0 8.9197423 8.5118438 7.6564098 + 4100 2000 -0 8.224539 7.765121 6.4246439 + 4200 2000 -0 7.8352874 7.3855212 5.9657978 + 4300 2000 -0 7.84891 7.3973377 6.2217099 + 4400 2000 -0 7.9743441 7.5242803 6.7082653 + 4500 2000 -0 7.9906412 7.5831386 6.7093176 + 4600 2000 -0 7.9382395 7.4929459 6.4150432 + 4700 2000 -0 7.9318996 7.4971722 6.4746841 + 4800 2000 -0 7.9685751 7.5471868 6.6574514 + 4900 2000 -0 7.9524289 7.516294 6.5660525 + 5000 2000 -0 7.9378811 7.5115542 6.5001617 + 5100 2000 -0 7.9266301 7.5073503 6.5253548 + 5200 2000 -0 7.9434374 7.5177496 6.5845847 + 5300 2000 -0 7.9305032 7.5191693 6.5372085 + 5400 2000 -0 7.9402877 7.5254309 6.5520449 + 5500 2000 -0 7.9427052 7.5280949 6.5557961 + 5600 2000 -0 7.9391493 7.5233972 6.5331874 + 5700 2000 -0 7.9399937 7.5202519 6.543535 + 5800 2000 -0 7.9398529 7.5228566 6.54443 + 5900 2000 -0 7.9410688 7.5260002 6.5435973 + 6000 2000 -0 7.941019 7.5216292 6.5431831 + 6100 2000 -0 7.9390808 7.5219254 6.5415317 + 6200 2000 -0 7.9481596 7.5395611 6.5622388 + 6300 2000 -0 7.9490652 7.5315638 6.5562056 + 6400 2000 -0 7.9427506 7.5243388 6.5431344 + 6500 2000 -0 7.9452629 7.5265503 6.5495796 + 6600 2000 -0 7.9458414 7.5249099 6.5533876 + 6700 2000 -0 7.94418 7.525769 6.5394106 + 6800 2000 -0 7.943729 7.5287032 6.5405826 + 6900 2000 -0 7.947609 7.5300725 6.5559575 + 7000 2000 -0 7.9443102 7.5257838 6.5463817 + 7100 2000 -0 7.9441301 7.5276861 6.5381619 + 7200 2000 -0 7.9454486 7.5282359 6.5456825 + 7300 2000 -0 7.945263 7.5286763 6.5512798 + 7400 2000 -0 7.9420874 7.527752 6.5445142 + 7500 2000 -0 7.9441062 7.5272938 6.5441649 + 7600 2000 -0 7.9457317 7.528108 6.5503985 + 7700 2000 -0 7.9440802 7.5278111 6.5470895 + 7800 2000 -0 7.9431937 7.5265385 6.541355 + 7900 2000 -0 7.9443162 7.5279484 6.5500105 + 8000 2000 -0 7.9494361 7.5285053 6.5534428 + 8100 2000 -0 7.946984 7.5263991 6.5455634 + 8200 2000 -0 7.9484464 7.5274982 6.5494966 + 8300 2000 -0 7.9481535 7.5274655 6.5501241 + 8400 2000 -0 7.9479539 7.5273074 6.5488317 + 8500 2000 -0 7.9485734 7.5277795 6.5512236 + 8600 2000 -0 7.9479221 7.528244 6.5500855 + 8700 2000 -0 7.9478183 7.5276603 6.5489063 + 8800 2000 -0 7.948203 7.5284835 6.5517141 + 8900 2000 -0 7.9485476 7.5282914 6.5523536 + 9000 2000 -0 7.9480852 7.527842 6.5485105 + 9100 2000 -0 7.9503303 7.5292996 6.5521516 + 9200 2000 -0 7.9484069 7.5284723 6.5532887 + 9300 2000 -0 7.9477781 7.5273643 6.5479285 + 9400 2000 -0 7.9480058 7.5281007 6.5494258 + 9500 2000 -0 7.9502363 7.5292831 6.5551525 + 9600 2000 -0 7.9491036 7.5284568 6.5495709 + 9700 2000 -0 7.9486046 7.5277883 6.5479749 + 9800 2000 -0 7.949523 7.5288246 6.5522055 + 9900 2000 -0 7.9494267 7.5284447 6.5514459 + 10000 2000 -0 7.9488016 7.5280346 6.5482727 + 10100 2000 -0 7.9490863 7.5283793 6.5508377 + 10200 2000 -0 7.9494738 7.5286559 6.5521934 + 10300 2000 -0 7.94897 7.5280769 6.5494088 + 10400 2000 -0 7.9491066 7.52825 6.5501939 + 10500 2000 -0 7.9493209 7.5285384 6.5519118 + 10600 2000 -0 7.9491644 7.5282301 6.5502712 + 10700 2000 -0 7.9491801 7.5281441 6.5499963 + 10800 2000 -0 7.9493282 7.5284381 6.5515091 + 10900 2000 -0 7.9492367 7.5283402 6.5507061 + 11000 2000 -0 7.9491668 7.5282029 6.5500415 + 11100 2000 -0 7.9493582 7.5283461 6.5510357 + 11200 2000 -0 7.949305 7.5283898 6.55098 + 11300 2000 -0 7.9491619 7.5282773 6.5501609 + 11400 2000 -0 7.9492854 7.5283288 6.5506804 + 11500 2000 -0 7.9493516 7.5283815 6.5509932 + 11600 2000 -0 7.9492185 7.5283196 6.5504137 + 11700 2000 -0 7.9492341 7.5283288 6.5505111 + 11800 2000 -0 7.9493062 7.5283673 6.5508542 + 11900 2000 -0 7.9492738 7.5283272 6.5506104 + 12000 2000 -0 7.9492546 7.5283062 6.5505492 + 12100 2000 -0 7.9492631 7.5283416 6.5507445 + 12200 2000 -0 7.9492627 7.5283173 6.5506804 + 12300 2000 -0 7.9492692 7.5282802 6.5506371 + 12400 2000 -0 7.9492646 7.5282953 6.550753 + 12500 2000 -0 7.9492316 7.5282905 6.5507057 + 12600 2000 -0 7.9492342 7.5282624 6.5506826 + 12700 2000 -0 7.9492517 7.5282775 6.5507828 + 12800 2000 -0 7.9492092 7.5282666 6.5507381 + 12900 2000 -0 7.9491704 7.528266 6.550672 + 13000 2000 -0 7.9491743 7.5282771 6.550743 + 13100 2000 -0 7.9491605 7.5282824 6.5507079 + 13200 2000 -0 7.9491217 7.5282926 6.5506177 + 13300 2000 -0 7.9491063 7.5283202 6.5506443 + 13400 2000 -0 7.949103 7.5283325 6.5506231 + 13500 2000 -0 7.9490907 7.5283364 6.5505438 + 13600 2000 -0 7.9490835 7.5283584 6.5505599 + 13700 2000 -0 7.9490777 7.5283759 6.5505599 + 13800 2000 -0 7.9490712 7.5283756 6.5504932 + 13900 2000 -0 7.9490785 7.5283817 6.5505065 + 14000 2000 -0 7.9490815 7.5283933 6.5505387 + 14100 2000 -0 7.9490684 7.528393 6.5504862 + 14200 2000 -0 7.9490688 7.5283905 6.5504794 + 14300 2000 -0 7.9490814 7.5283907 6.5505315 + 14400 2000 -0 7.9490755 7.5283879 6.5505125 + 14500 2000 -0 7.949065 7.5283808 6.5504867 + 14600 2000 -0 7.9490721 7.5283768 6.5505326 + 14700 2000 -0 7.9490774 7.5283658 6.5505527 + 14800 2000 -0 7.9490719 7.5283503 6.5505371 + 14900 2000 -0 7.9490734 7.5283397 6.5505695 + 15000 2000 -0 7.9490832 7.5283255 6.5506123 + 15100 2000 -0 7.9490922 7.5283034 6.5506235 + 15200 2000 -0 7.9491032 7.5282854 6.550654 + 15300 2000 -0 7.9491184 7.5282713 6.5507005 + 15400 2000 -0 7.9491364 7.5282536 6.5507233 + 15500 2000 -0 7.9491577 7.5282382 6.5507454 + 15600 2000 -0 7.949183 7.5282317 6.550776 + 15700 2000 -0 7.9491951 7.5282268 6.5507835 + 15800 2000 -0 7.9492105 7.5282249 6.5507815 + 15900 2000 -0 7.9492261 7.5282273 6.5507862 + 16000 2000 -0 7.949236 7.5282329 6.5507802 + 16100 2000 -0 7.9492433 7.5282403 6.5507646 + 16200 2000 -0 7.9492443 7.5282461 6.5507548 + 16300 2000 -0 7.9492487 7.528255 6.5507491 + 16400 2000 -0 7.9492492 7.5282612 6.5507372 + 16500 2000 -0 7.9492486 7.5282664 6.5507287 + 16600 2000 -0 7.9492482 7.5282702 6.5507259 + 16700 2000 -0 7.9492484 7.528271 6.550724 + 16800 2000 -0 7.949248 7.5282702 6.550724 + 16900 2000 -0 7.9492465 7.5282682 6.5507268 + 17000 2000 -0 7.9492458 7.5282638 6.550732 + 17100 2000 -0 7.9492503 7.5282577 6.5507415 + 17200 2000 -0 7.949245 7.528249 6.5507522 + 17300 2000 -0 7.949242 7.5282399 6.5507633 + 17400 2000 -0 7.9492423 7.5282314 6.5507781 + 17500 2000 -0 7.9492337 7.5282196 6.5507929 + 17600 2000 -0 7.9492257 7.5282097 6.5508056 + 17700 2000 -0 7.9492144 7.528202 6.5508153 + 17800 2000 -0 7.9492005 7.5281972 6.5508223 + 17900 2000 -0 7.9491836 7.5281958 6.5508215 + 18000 2000 -0 7.949164 7.5281986 6.550812 + 18100 2000 -0 7.949143 7.5282062 6.5507959 + 18200 2000 -0 7.9491222 7.5282177 6.550773 + 18300 2000 -0 7.9491032 7.5282315 6.5507447 + 18400 2000 -0 7.9490869 7.5282471 6.5507157 + 18500 2000 -0 7.9490738 7.5282631 6.5506876 + 18600 2000 -0 7.9490639 7.5282782 6.5506612 + 18700 2000 -0 7.9490575 7.5282917 6.5506397 + 18800 2000 -0 7.9490536 7.5283031 6.5506231 + 18900 2000 -0 7.9490511 7.5283122 6.5506095 + 19000 2000 -0 7.9490498 7.528319 6.5505999 + 19100 2000 -0 7.9490494 7.5283236 6.5505947 + 19200 2000 -0 7.9490504 7.5283266 6.5505913 + 19300 2000 -0 7.9490487 7.5283271 6.5505908 + 19400 2000 -0 7.9490481 7.5283251 6.5505927 + 19500 2000 -0 7.9490469 7.5283215 6.550597 + 19600 2000 -0 7.949046 7.5283161 6.5506036 + 19700 2000 -0 7.9490455 7.5283086 6.5506131 + 19800 2000 -0 7.9490454 7.5282989 6.5506262 + 19900 2000 -0 7.9490466 7.528287 6.550643 + 20000 2000 -0 7.9490497 7.5282729 6.5506641 + 20100 2000 -0 7.9490553 7.5282568 6.5506893 + 20200 2000 -0 7.949064 7.5282394 6.5507187 + 20300 2000 -0 7.9490762 7.5282213 6.5507507 + 20400 2000 -0 7.949092 7.5282037 6.5507836 + 20500 2000 -0 7.94911 7.5281878 6.5508144 + 20600 2000 -0 7.9491297 7.5281748 6.5508407 + 20700 2000 -0 7.9491494 7.5281658 6.5508604 + 20800 2000 -0 7.9491678 7.528161 6.5508721 + 20900 2000 -0 7.9491837 7.5281604 6.5508761 + 21000 2000 -0 7.9491965 7.5281634 6.5508735 + 21100 2000 -0 7.949206 7.5281691 6.5508664 + 21200 2000 -0 7.9492125 7.5281763 6.5508566 + 21300 2000 -0 7.9492165 7.5281841 6.5508459 + 21400 2000 -0 7.9492186 7.5281916 6.5508355 + 21500 2000 -0 7.9492193 7.5281981 6.5508266 + 21600 2000 -0 7.9492209 7.5282042 6.5508206 + 21700 2000 -0 7.9492183 7.5282068 6.5508151 + 21800 2000 -0 7.9492181 7.5282082 6.550813 + 21900 2000 -0 7.9492172 7.5282078 6.5508133 + 22000 2000 -0 7.9492165 7.5282053 6.5508164 + 22100 2000 -0 7.949216 7.5282009 6.5508221 + 22200 2000 -0 7.9492152 7.5281947 6.5508303 + 22300 2000 -0 7.9492139 7.5281868 6.5508407 + 22400 2000 -0 7.9492119 7.5281776 6.5508533 + 22500 2000 -0 7.9492085 7.5281675 6.5508672 + 22600 2000 -0 7.9492032 7.5281571 6.5508813 + 22700 2000 -0 7.9491954 7.5281475 6.5508947 + 22800 2000 -0 7.9491847 7.5281397 6.5509055 + 22900 2000 -0 7.9491707 7.5281345 6.5509114 + 23000 2000 -0 7.9491537 7.5281331 6.5509109 + 23100 2000 -0 7.9491342 7.528136 6.5509027 + 23200 2000 -0 7.9491134 7.5281433 6.5508866 + 23300 2000 -0 7.9490926 7.5281544 6.5508637 + 23400 2000 -0 7.9490734 7.5281684 6.5508363 + 23500 2000 -0 7.9490569 7.528184 6.550807 + 23600 2000 -0 7.9490436 7.5281999 6.5507785 + 23700 2000 -0 7.9490338 7.5282151 6.5507528 + 23800 2000 -0 7.9490271 7.5282287 6.550731 + 23900 2000 -0 7.9490229 7.5282402 6.5507135 + 24000 2000 -0 7.949022 7.5282475 6.5507052 + 24100 2000 -0 7.9490192 7.5282571 6.5506903 + 24200 2000 -0 7.9490187 7.5282612 6.5506857 + 24300 2000 -0 7.9490182 7.5282637 6.5506814 + 24400 2000 -0 7.9490176 7.5282644 6.5506802 + 24500 2000 -0 7.9490169 7.5282632 6.5506827 + 24600 2000 -0 7.9490162 7.52826 6.5506869 + 24700 2000 -0 7.949015 7.5282547 6.5506925 + 24800 2000 -0 7.9490143 7.5282475 6.5507019 + 24900 2000 -0 7.9490142 7.5282382 6.5507152 + 25000 2000 -0 7.949015 7.5282266 6.5507309 + 25100 2000 -0 7.9490178 7.5282127 6.5507512 + 25200 2000 -0 7.9490231 7.5281971 6.5507767 + 25300 2000 -0 7.9490313 7.5281798 6.5508053 + 25400 2000 -0 7.949043 7.5281617 6.5508367 + 25500 2000 -0 7.9490581 7.5281441 6.5508697 + 25600 2000 -0 7.949076 7.5281281 6.5509009 + 25700 2000 -0 7.9490959 7.528112 6.550928 + 25800 2000 -0 7.9491161 7.5281041 6.5509477 + 25900 2000 -0 7.9491345 7.5280996 6.5509612 + 26000 2000 -0 7.9491506 7.5280986 6.5509657 + 26100 2000 -0 7.9491638 7.5281011 6.5509636 + 26200 2000 -0 7.949174 7.5281064 6.5509573 + 26300 2000 -0 7.949181 7.5281134 6.5509475 + 26400 2000 -0 7.9491854 7.5281211 6.5509367 + 26500 2000 -0 7.9491879 7.5281286 6.5509264 + 26600 2000 -0 7.9491889 7.5281353 6.5509172 + 26700 2000 -0 7.9491886 7.5281409 6.5509104 + 26800 2000 -0 7.9491886 7.5281441 6.5509048 + 26900 2000 -0 7.9491879 7.5281458 6.5509024 + 27000 2000 -0 7.9491875 7.5281457 6.5509025 + 27100 2000 -0 7.949187 7.5281435 6.5509052 + 27200 2000 -0 7.9491866 7.5281393 6.5509102 + 27300 2000 -0 7.9491861 7.5281333 6.5509181 + 27400 2000 -0 7.9491851 7.5281257 6.5509283 + 27500 2000 -0 7.9491834 7.5281166 6.5509402 + 27600 2000 -0 7.9491805 7.5281065 6.550954 + 27700 2000 -0 7.9491758 7.5280961 6.5509683 + 27800 2000 -0 7.9491687 7.5280862 6.5509818 + 27900 2000 -0 7.9491588 7.5280779 6.5509931 + 28000 2000 -0 7.9491457 7.5280721 6.5510002 + 28100 2000 -0 7.9491294 7.5280699 6.551001 + 28200 2000 -0 7.9491105 7.5280718 6.5509942 + 28300 2000 -0 7.9490901 7.5280782 6.5509797 + 28400 2000 -0 7.9490695 7.5280885 6.550958 + 28500 2000 -0 7.9490501 7.5281019 6.5509312 + 28600 2000 -0 7.9490332 7.5281172 6.5509022 + 28700 2000 -0 7.9490195 7.5281331 6.5508735 + 28800 2000 -0 7.9490075 7.528149 6.5508475 + 28900 2000 -0 7.9490015 7.528163 6.5508246 + 29000 2000 -0 7.9489976 7.5281742 6.5508062 + 29100 2000 -0 7.9489952 7.5281837 6.5507921 + 29200 2000 -0 7.948994 7.5281911 6.550782 + 29300 2000 -0 7.9489934 7.5281962 6.5507753 + 29400 2000 -0 7.9489932 7.5281992 6.5507715 + 29500 2000 -0 7.9489929 7.5282002 6.5507702 + 29600 2000 -0 7.9489925 7.5281992 6.5507714 + 29700 2000 -0 7.9489918 7.5281964 6.5507748 + 29800 2000 -0 7.948991 7.5281916 6.5507805 + 29900 2000 -0 7.9489903 7.5281848 6.5507891 + 30000 2000 -0 7.9489901 7.5281759 6.5508007 + 30100 2000 -0 7.9489909 7.5281648 6.5508159 + 30200 2000 -0 7.9489933 7.5281515 6.5508353 + 30300 2000 -0 7.948998 7.5281362 6.550859 + 30400 2000 -0 7.9490056 7.5281192 6.5508868 + 30500 2000 -0 7.9490165 7.5281012 6.5509178 + 30600 2000 -0 7.9490309 7.5280833 6.5509503 + 30700 2000 -0 7.9490483 7.5280667 6.5509821 + 30800 2000 -0 7.9490676 7.5280525 6.5510103 + 30900 2000 -0 7.9490876 7.5280418 6.5510325 + 31000 2000 -0 7.9491067 7.5280353 6.5510472 + 31100 2000 -0 7.9491237 7.5280331 6.551054 + 31200 2000 -0 7.9491378 7.5280348 6.5510539 + 31300 2000 -0 7.9491487 7.5280394 6.5510483 + 31400 2000 -0 7.9491564 7.5280461 6.5510392 + 31500 2000 -0 7.9491615 7.5280537 6.5510287 + 31600 2000 -0 7.9491644 7.5280614 6.551018 + 31700 2000 -0 7.9491657 7.5280683 6.5510084 + 31800 2000 -0 7.949166 7.528074 6.5510005 + 31900 2000 -0 7.9491658 7.5280781 6.5509948 + 32000 2000 -0 7.9491652 7.5280804 6.5509914 + 32100 2000 -0 7.949165 7.5280809 6.5509907 + 32200 2000 -0 7.9491641 7.5280793 6.5509925 + 32300 2000 -0 7.9491637 7.5280757 6.5509969 + 32400 2000 -0 7.9491632 7.5280703 6.5510038 + 32500 2000 -0 7.9491625 7.5280632 6.5510132 + 32600 2000 -0 7.9491611 7.5280545 6.5510247 + 32700 2000 -0 7.9491587 7.5280447 6.5510379 + 32800 2000 -0 7.9491546 7.5280344 6.551052 + 32900 2000 -0 7.9491484 7.5280242 6.5510659 + 33000 2000 -0 7.9491395 7.5280153 6.5510781 + 33100 2000 -0 7.9491275 7.5280085 6.5510867 + 33200 2000 -0 7.9491123 7.528005 6.5510898 + 33300 2000 -0 7.9490942 7.5280055 6.5510857 + 33400 2000 -0 7.9490743 7.5280104 6.5510737 + 33500 2000 -0 7.9490536 7.5280195 6.5510543 + 33600 2000 -0 7.9490337 7.5280319 6.5510291 + 33700 2000 -0 7.9490159 7.5280467 6.5510006 + 33800 2000 -0 7.9490011 7.5280624 6.5509715 + 33900 2000 -0 7.9489897 7.528078 6.5509442 + 34000 2000 -0 7.9489816 7.5280924 6.5509203 + 34100 2000 -0 7.9489763 7.528105 6.5509004 + 34200 2000 -0 7.9489732 7.5281155 6.5508849 + 34300 2000 -0 7.9489717 7.5281236 6.5508735 + 34400 2000 -0 7.948971 7.5281295 6.5508656 + 34500 2000 -0 7.9489707 7.5281332 6.5508608 + 34600 2000 -0 7.9489705 7.5281349 6.5508586 + 34700 2000 -0 7.9489701 7.5281347 6.5508588 + 34800 2000 -0 7.9489695 7.5281326 6.5508613 + 34900 2000 -0 7.9489672 7.5281294 6.5508657 + 35000 2000 -0 7.9489679 7.5281227 6.5508731 + 35100 2000 -0 7.9489674 7.5281145 6.5508833 + 35200 2000 -0 7.9489677 7.5281044 6.5508973 + 35300 2000 -0 7.9489695 7.5280919 6.550915 + 35400 2000 -0 7.948973 7.5280774 6.5509365 + 35500 2000 -0 7.9489794 7.5280611 6.5509628 + 35600 2000 -0 7.9489889 7.5280435 6.5509926 + 35700 2000 -0 7.9490018 7.5280255 6.5510245 + 35800 2000 -0 7.949018 7.5280082 6.5510567 + 35900 2000 -0 7.9490366 7.5279929 6.5510867 + 36000 2000 -0 7.9490564 7.5279807 6.5511115 + 36100 2000 -0 7.949076 7.5279725 6.5511293 + 36200 2000 -0 7.949094 7.5279685 6.5511394 + 36300 2000 -0 7.9491093 7.5279687 6.5511419 + 36400 2000 -0 7.9491215 7.5279722 6.5511382 + 36500 2000 -0 7.9491305 7.5279782 6.5511304 + 36600 2000 -0 7.9491366 7.5279855 6.5511203 + 36700 2000 -0 7.9491403 7.5279933 6.5511095 + 36800 2000 -0 7.9491422 7.5280006 6.5510994 + 36900 2000 -0 7.9491429 7.5280069 6.5510907 + 37000 2000 -0 7.9491428 7.5280118 6.551084 + 37100 2000 -0 7.9491423 7.5280149 6.5510796 + 37200 2000 -0 7.9491417 7.5280162 6.5510777 + 37300 2000 -0 7.9491412 7.5280155 6.5510784 + 37400 2000 -0 7.9491407 7.5280129 6.5510816 + 37500 2000 -0 7.9491403 7.5280083 6.5510874 + 37600 2000 -0 7.9491397 7.528002 6.5510957 + 37700 2000 -0 7.9491387 7.527994 6.5511062 + 37800 2000 -0 7.9491368 7.5279847 6.5511187 + 37900 2000 -0 7.9491337 7.5279745 6.5511324 + 38000 2000 -0 7.9491286 7.5279642 6.5511466 + 38100 2000 -0 7.9491211 7.5279546 6.5511598 + 38200 2000 -0 7.9491106 7.5279467 6.5511704 + 38300 2000 -0 7.9490969 7.5279415 6.5511764 + 38400 2000 -0 7.9490802 7.52794 6.5511759 + 38500 2000 -0 7.9490611 7.5279428 6.5511678 + 38600 2000 -0 7.9490407 7.5279499 6.5511519 + 38700 2000 -0 7.9490203 7.5279608 6.5511293 + 38800 2000 -0 7.9490014 7.5279745 6.5511022 + 38900 2000 -0 7.9489851 7.5279899 6.5510732 + 39000 2000 -0 7.9489721 7.5280057 6.5510448 + 39100 2000 -0 7.9489624 7.5280208 6.5510192 + 39200 2000 -0 7.9489558 7.5280344 6.5509973 + 39300 2000 -0 7.9489516 7.528046 6.5509797 + 39400 2000 -0 7.9489493 7.5280554 6.5509663 + 39500 2000 -0 7.9489481 7.5280625 6.5509567 + 39600 2000 -0 7.9489476 7.5280674 6.5509503 + 39700 2000 -0 7.9489475 7.5280702 6.5509463 + 39800 2000 -0 7.9489472 7.5280711 6.5509448 + 39900 2000 -0 7.9489468 7.5280701 6.5509455 + 40000 2000 -0 7.9489461 7.5280673 6.5509484 + 40100 2000 -0 7.9489453 7.5280625 6.5509538 + 40200 2000 -0 7.9489445 7.5280556 6.5509619 + 40300 2000 -0 7.9489443 7.5280466 6.550973 + 40400 2000 -0 7.948945 7.5280353 6.5509879 + 40500 2000 -0 7.9489474 7.5280219 6.5510068 + 40600 2000 -0 7.9489521 7.5280065 6.5510299 + 40700 2000 -0 7.9489597 7.5279895 6.5510571 + 40800 2000 -0 7.9489706 7.5279716 6.5510876 + 40900 2000 -0 7.9489848 7.5279537 6.5511196 + 41000 2000 -0 7.9490019 7.5279372 6.5511508 + 41100 2000 -0 7.949021 7.5279231 6.5511783 + 41200 2000 -0 7.9490405 7.5279137 6.5512001 + 41300 2000 -0 7.9490593 7.5279062 6.551214 + 41400 2000 -0 7.9490759 7.527904 6.5512202 + 41500 2000 -0 7.9490897 7.5279058 6.5512195 + 41600 2000 -0 7.9491004 7.5279105 6.5512136 + 41700 2000 -0 7.9491078 7.5279171 6.5512042 + 41800 2000 -0 7.9491126 7.5279247 6.5511933 + 41900 2000 -0 7.9491153 7.5279324 6.5511823 + 42000 2000 -0 7.9491164 7.5279393 6.5511724 + 42100 2000 -0 7.9491165 7.527945 6.5511641 + 42200 2000 -0 7.949116 7.5279491 6.5511581 + 42300 2000 -0 7.9491153 7.5279515 6.5511543 + 42400 2000 -0 7.9491145 7.5279519 6.5511532 + 42500 2000 -0 7.9491138 7.5279504 6.5511545 + 42600 2000 -0 7.9491132 7.527947 6.5511584 + 42700 2000 -0 7.9491125 7.5279417 6.5511649 + 42800 2000 -0 7.9491115 7.5279347 6.5511737 + 42900 2000 -0 7.9491099 7.5279262 6.5511847 + 43000 2000 -0 7.9491074 7.5279165 6.5511975 + 43100 2000 -0 7.9491033 7.5279061 6.5512112 + 43200 2000 -0 7.9490971 7.5278959 6.5512249 + 43300 2000 -0 7.9490883 7.5278868 6.5512371 + 43400 2000 -0 7.9490764 7.5278798 6.5512459 + 43500 2000 -0 7.9490614 7.5278759 6.5512494 + 43600 2000 -0 7.9490435 7.5278759 6.5512459 + 43700 2000 -0 7.9490235 7.5278802 6.5512346 + 43800 2000 -0 7.9490027 7.5278887 6.5512158 + 43900 2000 -0 7.9489825 7.5279007 6.551191 + 44000 2000 -0 7.9489642 7.5279152 6.5511627 + 44100 2000 -0 7.9489489 7.5279308 6.5511334 + 44200 2000 -0 7.9489368 7.5279464 6.5511056 + 44300 2000 -0 7.9489281 7.5279609 6.5510809 + 44400 2000 -0 7.9489222 7.5279737 6.5510603 + 44500 2000 -0 7.9489186 7.5279844 6.551044 + 44600 2000 -0 7.9489166 7.5279929 6.5510317 + 44700 2000 -0 7.9489156 7.527999 6.551023 + 44800 2000 -0 7.948915 7.5280031 6.5510175 + 44900 2000 -0 7.9489146 7.5280051 6.5510146 + 45000 2000 -0 7.948914 7.5280052 6.5510141 + 45100 2000 -0 7.9489131 7.5280035 6.5510158 + 45200 2000 -0 7.948912 7.5279999 6.5510197 + 45300 2000 -0 7.9489109 7.5279944 6.5510261 + 45400 2000 -0 7.94891 7.5279869 6.5510353 + 45500 2000 -0 7.9489098 7.5279772 6.5510478 + 45600 2000 -0 7.9489107 7.5279654 6.551064 + 45700 2000 -0 7.9489134 7.5279514 6.5510843 + 45800 2000 -0 7.9489186 7.5279356 6.5511089 + 45900 2000 -0 7.9489269 7.5279183 6.5511373 + 46000 2000 -0 7.9489386 7.5279003 6.5511685 + 46100 2000 -0 7.9489535 7.5278828 6.5512004 + 46200 2000 -0 7.9489712 7.5278669 6.5512307 + 46300 2000 -0 7.9489904 7.5278538 6.5512567 + 46400 2000 -0 7.9490097 7.5278445 6.5512762 + 46500 2000 -0 7.9490278 7.5278394 6.551288 + 46600 2000 -0 7.9490435 7.5278384 6.5512921 + 46700 2000 -0 7.9490563 7.5278411 6.5512897 + 46800 2000 -0 7.9490658 7.5278464 6.5512826 + 46900 2000 -0 7.9490723 7.5278535 6.5512727 + 47000 2000 -0 7.9490763 7.5278612 6.5512617 + 47100 2000 -0 7.9490784 7.5278687 6.5512509 + 47200 2000 -0 7.949079 7.5278753 6.5512414 + 47300 2000 -0 7.9490788 7.5278807 6.5512337 + 47400 2000 -0 7.9490781 7.5278843 6.5512283 + 47500 2000 -0 7.9490772 7.5278862 6.5512252 + 47600 2000 -0 7.9490763 7.5278863 6.5512251 + 47700 2000 -0 7.9490756 7.5278844 6.5512274 + 47800 2000 -0 7.9490749 7.5278805 6.5512317 + 47900 2000 -0 7.9490741 7.5278748 6.5512387 + 48000 2000 -0 7.949073 7.5278674 6.5512483 + 48100 2000 -0 7.9490713 7.5278586 6.5512597 + 48200 2000 -0 7.9490684 7.5278487 6.5512726 + 48300 2000 -0 7.949064 7.5278383 6.5512866 + 48400 2000 -0 7.9490573 7.5278282 6.5513001 + 48500 2000 -0 7.9490478 7.5278194 6.5513115 + 48600 2000 -0 7.9490353 7.5278129 6.5513193 + 48700 2000 -0 7.9490196 7.5278097 6.5513215 + 48800 2000 -0 7.9490012 7.5278105 6.5513163 + 48900 2000 -0 7.948981 7.5278157 6.5513034 + 49000 2000 -0 7.9489603 7.527825 6.5512834 + 49100 2000 -0 7.9489405 7.5278375 6.5512576 + 49200 2000 -0 7.9489228 7.5278522 6.5512289 + 49300 2000 -0 7.9489081 7.5278678 6.5512 + 49400 2000 -0 7.9488969 7.5278831 6.5511728 + 49500 2000 -0 7.9488888 7.5278972 6.551149 + 49600 2000 -0 7.9488835 7.5279095 6.5511293 + 49700 2000 -0 7.9488803 7.5279197 6.5511139 + 49800 2000 -0 7.9488785 7.5279275 6.5511024 + 49900 2000 -0 7.9488776 7.5279332 6.5510945 + 50000 2000 -0 7.9488771 7.5279368 6.5510895 + 50100 2000 -0 7.9488767 7.5279384 6.5510871 + 50200 2000 -0 7.948876 7.5279381 6.551087 + 50300 2000 -0 7.9488752 7.5279359 6.5510891 + 50400 2000 -0 7.9488741 7.527932 6.5510934 + 50500 2000 -0 7.948873 7.5279261 6.5511002 + 50600 2000 -0 7.9488722 7.5279182 6.5511099 + 50700 2000 -0 7.9488721 7.5279081 6.5511229 + 50800 2000 -0 7.9488732 7.5278959 6.5511396 + 50900 2000 -0 7.9488763 7.5278816 6.5511605 + 51000 2000 -0 7.9488819 7.5278655 6.5511857 + 51100 2000 -0 7.9488907 7.527848 6.5512145 + 51200 2000 -0 7.9489028 7.52783 6.5512458 + 51300 2000 -0 7.9489182 7.5278126 6.5512776 + 51400 2000 -0 7.9489361 7.527797 6.5513073 + 51500 2000 -0 7.9489553 7.5277844 6.5513324 + 51600 2000 -0 7.9489746 7.5277755 6.5513508 + 51700 2000 -0 7.9489924 7.527771 6.5513615 + 51800 2000 -0 7.9490076 7.5277705 6.5513647 + 51900 2000 -0 7.9490195 7.5277737 6.5513615 + 52000 2000 -0 7.9490283 7.5277794 6.5513539 + 52100 2000 -0 7.949034 7.5277866 6.5513439 + 52200 2000 -0 7.949037 7.5277943 6.551333 + 52300 2000 -0 7.9490382 7.5278017 6.5513225 + 52400 2000 -0 7.9490381 7.5278081 6.5513134 + 52500 2000 -0 7.9490372 7.5278132 6.5513061 + 52600 2000 -0 7.9490358 7.5278167 6.5513011 + 52700 2000 -0 7.9490343 7.5278183 6.5512985 + 52800 2000 -0 7.9490329 7.5278181 6.5512989 + 52900 2000 -0 7.9490315 7.527816 6.5513015 + 53000 2000 -0 7.9490302 7.5278118 6.5513062 + 53100 2000 -0 7.9490288 7.5278059 6.5513136 + 53200 2000 -0 7.9490279 7.5277975 6.5513237 + 53300 2000 -0 7.9490241 7.5277891 6.5513356 + 53400 2000 -0 7.9490211 7.5277793 6.5513482 + 53500 2000 -0 7.949016 7.527769 6.5513626 + 53600 2000 -0 7.9490084 7.527759 6.5513764 + 53700 2000 -0 7.948998 7.5277502 6.5513874 + 53800 2000 -0 7.9489846 7.5277439 6.5513952 + 53900 2000 -0 7.9489681 7.527741 6.5513973 + 54000 2000 -0 7.9489489 7.5277421 6.5513917 + 54100 2000 -0 7.9489279 7.5277475 6.5513784 + 54200 2000 -0 7.9489066 7.527757 6.5513584 + 54300 2000 -0 7.9488862 7.5277697 6.5513326 + 54400 2000 -0 7.948868 7.5277844 6.5513039 + 54500 2000 -0 7.9488529 7.5278 6.5512754 + 54600 2000 -0 7.9488411 7.5278152 6.5512487 + 54700 2000 -0 7.9488325 7.5278292 6.5512253 + 54800 2000 -0 7.9488266 7.5278414 6.5512062 + 54900 2000 -0 7.9488228 7.5278514 6.5511912 + 55000 2000 -0 7.9488204 7.5278592 6.5511801 + 55100 2000 -0 7.9488188 7.5278647 6.5511725 + 55200 2000 -0 7.9488176 7.5278682 6.5511679 + 55300 2000 -0 7.9488165 7.5278697 6.5511657 + 55400 2000 -0 7.9488151 7.5278693 6.5511659 + 55500 2000 -0 7.9488136 7.5278672 6.5511683 + 55600 2000 -0 7.9488118 7.5278632 6.5511728 + 55700 2000 -0 7.94881 7.5278573 6.5511798 + 55800 2000 -0 7.9488085 7.5278494 6.5511897 + 55900 2000 -0 7.9488076 7.5278393 6.5512028 + 56000 2000 -0 7.9488081 7.5278272 6.5512196 + 56100 2000 -0 7.9488104 7.5278129 6.5512407 + 56200 2000 -0 7.9488153 7.5277968 6.5512659 + 56300 2000 -0 7.9488233 7.5277793 6.5512948 + 56400 2000 -0 7.9488347 7.5277613 6.5513262 + 56500 2000 -0 7.9488493 7.527744 6.5513581 + 56600 2000 -0 7.9488664 7.5277283 6.5513879 + 56700 2000 -0 7.9488849 7.5277157 6.5514132 + 56800 2000 -0 7.9489034 7.5277068 6.5514318 + 56900 2000 -0 7.9489205 7.5277022 6.5514428 + 57000 2000 -0 7.9489351 7.5277016 6.5514462 + 57100 2000 -0 7.9489467 7.5277046 6.5514434 + 57200 2000 -0 7.9489551 7.5277101 6.5514361 + 57300 2000 -0 7.9489606 7.5277172 6.5514261 + 57400 2000 -0 7.9489636 7.5277248 6.5514153 + 57500 2000 -0 7.9489647 7.5277322 6.5514049 + 57600 2000 -0 7.9489645 7.5277387 6.5513957 + 57700 2000 -0 7.9489634 7.5277438 6.5513885 + 57800 2000 -0 7.9489619 7.5277473 6.5513834 + 57900 2000 -0 7.9489603 7.527749 6.5513807 + 58000 2000 -0 7.9489587 7.5277489 6.551381 + 58100 2000 -0 7.9489572 7.5277469 6.5513835 + 58200 2000 -0 7.9489558 7.5277428 6.5513881 + 58300 2000 -0 7.9489543 7.527737 6.5513954 + 58400 2000 -0 7.9489526 7.5277295 6.5514052 + 58500 2000 -0 7.9489538 7.5277215 6.551417 + 58600 2000 -0 7.948947 7.5277103 6.5514298 + 58700 2000 -0 7.9489424 7.5276998 6.551444 + 58800 2000 -0 7.9489357 7.5276895 6.5514576 + 58900 2000 -0 7.9489261 7.5276803 6.5514692 + 59000 2000 -0 7.9489135 7.5276736 6.5514773 + 59100 2000 -0 7.9488978 7.5276701 6.5514798 + 59200 2000 -0 7.9488794 7.5276706 6.551475 + 59300 2000 -0 7.9488592 7.5276754 6.5514625 + 59400 2000 -0 7.9488384 7.5276843 6.5514429 + 59500 2000 -0 7.9488184 7.5276965 6.5514176 + 59600 2000 -0 7.9488006 7.5277108 6.5513894 + 59700 2000 -0 7.9487858 7.5277262 6.5513607 + 59800 2000 -0 7.9487742 7.5277411 6.5513338 + 59900 2000 -0 7.9487658 7.527755 6.5513102 + 60000 2000 -0 7.9487603 7.5277672 6.5512907 + 60100 2000 -0 7.9487569 7.5277771 6.5512753 + 60200 2000 -0 7.9487549 7.5277849 6.5512639 + 60300 2000 -0 7.9487538 7.5277905 6.551256 + 60400 2000 -0 7.9487531 7.5277939 6.551251 + 60500 2000 -0 7.9487525 7.5277954 6.5512486 + 60600 2000 -0 7.9487517 7.5277951 6.5512485 + 60700 2000 -0 7.9487507 7.5277929 6.5512505 + 60800 2000 -0 7.9487495 7.527789 6.5512547 + 60900 2000 -0 7.9487482 7.5277831 6.5512613 + 61000 2000 -0 7.9487471 7.5277753 6.5512707 + 61100 2000 -0 7.9487466 7.5277654 6.5512832 + 61200 2000 -0 7.9487474 7.5277534 6.5512994 + 61300 2000 -0 7.9487499 7.5277392 6.5513196 + 61400 2000 -0 7.9487549 7.5277231 6.551344 + 61500 2000 -0 7.9487629 7.5277057 6.5513722 + 61600 2000 -0 7.9487743 7.5276875 6.5514032 + 61700 2000 -0 7.9487889 7.5276698 6.5514349 + 61800 2000 -0 7.9488062 7.5276536 6.5514651 + 61900 2000 -0 7.9488251 7.5276402 6.5514912 + 62000 2000 -0 7.9488442 7.5276305 6.5515108 + 62100 2000 -0 7.9488621 7.5276249 6.5515229 + 62200 2000 -0 7.9488777 7.5276235 6.5515275 + 62300 2000 -0 7.9488903 7.5276257 6.5515255 + 62400 2000 -0 7.9488998 7.5276306 6.5515188 + 62500 2000 -0 7.9489063 7.5276373 6.5515091 + 62600 2000 -0 7.9489103 7.5276446 6.5514983 + 62700 2000 -0 7.9489123 7.5276519 6.5514876 + 62800 2000 -0 7.9489128 7.5276583 6.5514781 + 62900 2000 -0 7.9489125 7.5276635 6.5514704 + 63000 2000 -0 7.9489117 7.5276671 6.5514648 + 63100 2000 -0 7.9489107 7.5276689 6.5514616 + 63200 2000 -0 7.9489097 7.527669 6.5514611 + 63300 2000 -0 7.9489089 7.5276672 6.5514631 + 63400 2000 -0 7.9489086 7.5276637 6.5514673 + 63500 2000 -0 7.9489073 7.5276575 6.5514739 + 63600 2000 -0 7.9489063 7.5276501 6.551483 + 63700 2000 -0 7.9489046 7.5276413 6.5514942 + 63800 2000 -0 7.948902 7.5276313 6.5515069 + 63900 2000 -0 7.9488979 7.5276207 6.5515208 + 64000 2000 -0 7.9488918 7.5276102 6.5515346 + 64100 2000 -0 7.9488831 7.5276008 6.5515467 + 64200 2000 -0 7.9488713 7.5275934 6.5515557 + 64300 2000 -0 7.9488564 7.5275891 6.5515596 + 64400 2000 -0 7.9488387 7.5275886 6.5515566 + 64500 2000 -0 7.948819 7.5275923 6.551546 + 64600 2000 -0 7.9487983 7.5276002 6.551528 + 64700 2000 -0 7.9487782 7.5276117 6.5515039 + 64800 2000 -0 7.9487598 7.5276255 6.5514762 + 64900 2000 -0 7.9487443 7.5276407 6.5514474 + 65000 2000 -0 7.9487321 7.5276559 6.5514199 + 65100 2000 -0 7.9487231 7.5276701 6.5513954 + 65200 2000 -0 7.948717 7.5276826 6.5513748 + 65300 2000 -0 7.9487132 7.5276931 6.5513585 + 65400 2000 -0 7.948711 7.5277014 6.5513461 + 65500 2000 -0 7.9487098 7.5277075 6.5513372 + 65600 2000 -0 7.9487092 7.5277115 6.5513315 + 65700 2000 -0 7.9487086 7.5277135 6.5513284 + 65800 2000 -0 7.948708 7.5277137 6.5513277 + 65900 2000 -0 7.9487071 7.527712 6.5513291 + 66000 2000 -0 7.948706 7.5277085 6.5513326 + 66100 2000 -0 7.9487047 7.5277032 6.5513384 + 66200 2000 -0 7.9487036 7.527696 6.5513467 + 66300 2000 -0 7.9487029 7.5276867 6.5513582 + 66400 2000 -0 7.9487033 7.5276753 6.5513731 + 66500 2000 -0 7.9487052 7.5276618 6.551392 + 66600 2000 -0 7.9487093 7.5276463 6.5514151 + 66700 2000 -0 7.9487163 7.5276292 6.5514421 + 66800 2000 -0 7.9487266 7.5276112 6.5514722 + 66900 2000 -0 7.9487402 7.5275932 6.5515039 + 67000 2000 -0 7.9487567 7.5275765 6.5515348 + 67100 2000 -0 7.9487752 7.5275621 6.5515623 + 67200 2000 -0 7.9487943 7.5275511 6.5515841 + 67300 2000 -0 7.9488127 7.5275442 6.5515986 + 67400 2000 -0 7.9488291 7.5275415 6.5516055 + 67500 2000 -0 7.9488435 7.5275438 6.5516054 + 67600 2000 -0 7.9488528 7.5275468 6.5515999 + 67700 2000 -0 7.9488606 7.5275528 6.5515912 + 67800 2000 -0 7.9488653 7.52756 6.5515805 + 67900 2000 -0 7.9488678 7.5275674 6.5515696 + 68000 2000 -0 7.9488689 7.5275741 6.5515598 + 68100 2000 -0 7.9488688 7.5275798 6.5515513 + 68200 2000 -0 7.9488681 7.5275839 6.5515449 + 68300 2000 -0 7.9488671 7.5275863 6.5515409 + 68400 2000 -0 7.9488661 7.527587 6.5515394 + 68500 2000 -0 7.9488652 7.5275857 6.5515407 + 68600 2000 -0 7.9488645 7.5275825 6.551544 + 68700 2000 -0 7.9488637 7.5275774 6.5515497 + 68800 2000 -0 7.9488629 7.5275707 6.5515579 + 68900 2000 -0 7.9488616 7.5275623 6.5515684 + 69000 2000 -0 7.9488595 7.5275526 6.5515805 + 69100 2000 -0 7.9488561 7.5275422 6.551594 + 69200 2000 -0 7.9488509 7.5275315 6.5516081 + 69300 2000 -0 7.9488433 7.5275215 6.551621 + 69400 2000 -0 7.9488328 7.5275132 6.5516314 + 69500 2000 -0 7.9488192 7.5275075 6.5516376 + 69600 2000 -0 7.9488027 7.5275054 6.5516375 + 69700 2000 -0 7.9487837 7.5275074 6.5516299 + 69800 2000 -0 7.9487633 7.5275136 6.5516148 + 69900 2000 -0 7.9487429 7.5275237 6.551593 + 70000 2000 -0 7.9487238 7.5275367 6.5515664 + 70100 2000 -0 7.9487071 7.5275514 6.5515379 + 70200 2000 -0 7.9486936 7.5275666 6.5515098 + 70300 2000 -0 7.9486834 7.5275813 6.551484 + 70400 2000 -0 7.9486763 7.5275945 6.5514618 + 70500 2000 -0 7.9486716 7.5276059 6.5514438 + 70600 2000 -0 7.9486689 7.5276151 6.5514298 + 70700 2000 -0 7.9486674 7.527622 6.5514196 + 70800 2000 -0 7.9486667 7.5276269 6.5514127 + 70900 2000 -0 7.9486661 7.5276297 6.5514086 + 71000 2000 -0 7.9486656 7.5276306 6.5514069 + 71100 2000 -0 7.9486648 7.5276297 6.5514073 + 71200 2000 -0 7.9486638 7.527627 6.5514099 + 71300 2000 -0 7.9486626 7.5276226 6.5514146 + 71400 2000 -0 7.9486614 7.5276163 6.5514217 + 71500 2000 -0 7.9486605 7.527608 6.5514317 + 71600 2000 -0 7.9486603 7.5275976 6.5514449 + 71700 2000 -0 7.9486614 7.5275851 6.5514619 + 71800 2000 -0 7.9486644 7.5275705 6.5514829 + 71900 2000 -0 7.94867 7.5275542 6.5515081 + 72000 2000 -0 7.9486787 7.5275366 6.5515368 + 72100 2000 -0 7.9486908 7.5275189 6.551568 + 72200 2000 -0 7.9487059 7.5275011 6.5515994 + 72300 2000 -0 7.9487235 7.5274855 6.5516286 + 72400 2000 -0 7.9487426 7.5274729 6.5516533 + 72500 2000 -0 7.9487614 7.527464 6.5516713 + 72600 2000 -0 7.9487788 7.5274593 6.5516817 + 72700 2000 -0 7.9487938 7.5274587 6.5516848 + 72800 2000 -0 7.9488058 7.5274616 6.5516817 + 72900 2000 -0 7.9488146 7.5274669 6.5516742 + 73000 2000 -0 7.9488205 7.5274738 6.5516642 + 73100 2000 -0 7.9488269 7.5274812 6.5516534 + 73200 2000 -0 7.9488257 7.5274883 6.5516429 + 73300 2000 -0 7.9488261 7.5274945 6.5516336 + 73400 2000 -0 7.9488256 7.5274994 6.5516262 + 73500 2000 -0 7.9488248 7.5275027 6.551621 + 73600 2000 -0 7.9488238 7.5275043 6.5516181 + 73700 2000 -0 7.9488228 7.5275041 6.551618 + 73800 2000 -0 7.948822 7.527502 6.5516204 + 73900 2000 -0 7.9488212 7.5274979 6.5516247 + 74000 2000 -0 7.9488205 7.527492 6.5516315 + 74100 2000 -0 7.9488195 7.5274845 6.551641 + 74200 2000 -0 7.9488179 7.5274755 6.5516522 + 74300 2000 -0 7.9488153 7.5274655 6.551665 + 74400 2000 -0 7.9488112 7.5274549 6.5516789 + 74500 2000 -0 7.9488049 7.5274445 6.5516926 + 74600 2000 -0 7.9487961 7.5274352 6.5517045 + 74700 2000 -0 7.9487842 7.527428 6.5517132 + 74800 2000 -0 7.9487693 7.5274239 6.5517167 + 74900 2000 -0 7.9487516 7.5274236 6.5517132 + 75000 2000 -0 7.9487319 7.5274276 6.5517022 + 75100 2000 -0 7.9487114 7.5274356 6.551684 + 75200 2000 -0 7.9486914 7.5274472 6.5516598 + 75300 2000 -0 7.9486734 7.5274611 6.5516321 + 75400 2000 -0 7.9486581 7.5274761 6.5516036 + 75500 2000 -0 7.9486462 7.5274912 6.5515764 + 75600 2000 -0 7.9486374 7.5275053 6.5515521 + 75700 2000 -0 7.9486315 7.5275177 6.5515319 + 75800 2000 -0 7.9486278 7.5275281 6.5515157 + 75900 2000 -0 7.9486258 7.5275363 6.5515035 + 76000 2000 -0 7.9486247 7.5275423 6.5514948 + 76100 2000 -0 7.9486241 7.5275463 6.5514892 + 76200 2000 -0 7.9486236 7.5275483 6.5514861 + 76300 2000 -0 7.948623 7.5275484 6.5514853 + 76400 2000 -0 7.9486222 7.5275468 6.5514867 + 76500 2000 -0 7.9486211 7.5275435 6.5514901 + 76600 2000 -0 7.9486198 7.5275383 6.5514957 + 76700 2000 -0 7.9486187 7.5275312 6.5515039 + 76800 2000 -0 7.948618 7.5275222 6.551515 + 76900 2000 -0 7.9486182 7.527511 6.5515295 + 77000 2000 -0 7.9486199 7.5274977 6.551548 + 77100 2000 -0 7.9486238 7.5274825 6.5515706 + 77200 2000 -0 7.9486305 7.5274656 6.5515971 + 77300 2000 -0 7.9486405 7.5274478 6.5516268 + 77400 2000 -0 7.9486537 7.5274299 6.5516582 + 77500 2000 -0 7.9486699 7.527413 6.551689 + 77600 2000 -0 7.9486881 7.5273985 6.5517168 + 77700 2000 -0 7.9487072 7.5273872 6.5517391 + 77800 2000 -0 7.9487256 7.5273799 6.5517543 + 77900 2000 -0 7.9487421 7.5273768 6.5517619 + 78000 2000 -0 7.948756 7.5273776 6.5517625 + 78100 2000 -0 7.9487668 7.5273814 6.5517576 + 78200 2000 -0 7.9487745 7.5273874 6.551749 + 78300 2000 -0 7.9487795 7.5273946 6.5517385 + 78400 2000 -0 7.9487822 7.527402 6.5517276 + 78500 2000 -0 7.9487834 7.5274089 6.5517175 + 78600 2000 -0 7.9487834 7.5274147 6.5517089 + 78700 2000 -0 7.9487828 7.5274191 6.5517022 + 78800 2000 -0 7.9487818 7.5274218 6.5516978 + 78900 2000 -0 7.9487808 7.5274228 6.5516958 + 79000 2000 -0 7.9487799 7.5274219 6.5516967 + 79100 2000 -0 7.9487792 7.5274192 6.5516996 + 79200 2000 -0 7.9487784 7.5274145 6.5517047 + 79300 2000 -0 7.9487776 7.5274081 6.5517124 + 79400 2000 -0 7.9487765 7.5274002 6.5517225 + 79500 2000 -0 7.9487747 7.5273908 6.5517341 + 79600 2000 -0 7.9487717 7.5273805 6.5517474 + 79700 2000 -0 7.948767 7.52737 6.5517614 + 79800 2000 -0 7.9487601 7.5273598 6.5517746 + 79900 2000 -0 7.9487504 7.527351 6.5517858 + 80000 2000 -0 7.9487377 7.5273446 6.5517931 + 80100 2000 -0 7.9487219 7.5273416 6.5517947 + 80200 2000 -0 7.9487036 7.5273426 6.551789 + 80300 2000 -0 7.9486836 7.5273478 6.5517759 + 80400 2000 -0 7.9486632 7.5273569 6.5517558 + 80500 2000 -0 7.9486437 7.5273692 6.5517304 + 80600 2000 -0 7.9486265 7.5273836 6.5517023 + 80700 2000 -0 7.9486122 7.5273987 6.5516741 + 80800 2000 -0 7.9486012 7.5274136 6.5516477 + 80900 2000 -0 7.9485934 7.5274272 6.5516246 + 81000 2000 -0 7.9485882 7.5274391 6.5516056 + 81100 2000 -0 7.9485859 7.5274494 6.5515908 + 81200 2000 -0 7.9485834 7.5274563 6.5515794 + 81300 2000 -0 7.9485825 7.5274618 6.5515718 + 81400 2000 -0 7.948582 7.5274652 6.5515669 + 81500 2000 -0 7.9485815 7.5274667 6.5515644 + 81600 2000 -0 7.9485809 7.5274664 6.5515643 + 81700 2000 -0 7.94858 7.5274644 6.5515662 + 81800 2000 -0 7.9485788 7.5274606 6.55157 + 81900 2000 -0 7.9485776 7.527455 6.5515762 + 82000 2000 -0 7.9485765 7.5274475 6.5515851 + 82100 2000 -0 7.9485759 7.527438 6.5515969 + 82200 2000 -0 7.9485764 7.5274264 6.5516123 + 82300 2000 -0 7.9485786 7.5274127 6.5516316 + 82400 2000 -0 7.9485831 7.5273971 6.551655 + 82500 2000 -0 7.9485904 7.52738 6.5516822 + 82600 2000 -0 7.948601 7.5273621 6.5517124 + 82700 2000 -0 7.9486149 7.5273443 6.5517438 + 82800 2000 -0 7.9486316 7.5273279 6.5517741 + 82900 2000 -0 7.9486501 7.527314 6.5518008 + 83000 2000 -0 7.948669 7.5273036 6.5518216 + 83100 2000 -0 7.9486871 7.5272973 6.5518351 + 83200 2000 -0 7.9487031 7.527295 6.5518411 + 83300 2000 -0 7.9487163 7.5272965 6.5518404 + 83400 2000 -0 7.9487263 7.5273009 6.5518346 + 83500 2000 -0 7.9487334 7.5273073 6.5518255 + 83600 2000 -0 7.9487379 7.5273145 6.5518149 + 83700 2000 -0 7.9487402 7.5273219 6.5518041 + 83800 2000 -0 7.9487411 7.5273286 6.5517942 + 83900 2000 -0 7.948741 7.5273342 6.551786 + 84000 2000 -0 7.9487402 7.5273383 6.5517797 + 84100 2000 -0 7.9487392 7.5273407 6.5517757 + 84200 2000 -0 7.9487383 7.5273413 6.5517743 + 84300 2000 -0 7.9487374 7.5273402 6.5517756 + 84400 2000 -0 7.9487366 7.5273371 6.5517789 + 84500 2000 -0 7.9487359 7.5273321 6.5517843 + 84600 2000 -0 7.9487351 7.5273255 6.5517925 + 84700 2000 -0 7.948734 7.5273173 6.5518029 + 84800 2000 -0 7.948732 7.5273078 6.5518148 + 84900 2000 -0 7.9487288 7.5272974 6.5518282 + 85000 2000 -0 7.9487239 7.5272869 6.5518422 + 85100 2000 -0 7.9487166 7.5272769 6.5518552 + 85200 2000 -0 7.9487066 7.5272684 6.5518659 + 85300 2000 -0 7.9486935 7.5272625 6.5518726 + 85400 2000 -0 7.9486774 7.52726 6.5518732 + 85500 2000 -0 7.9486588 7.5272615 6.5518665 + 85600 2000 -0 7.9486387 7.5272673 6.5518525 + 85700 2000 -0 7.9486184 7.5272769 6.5518316 + 85800 2000 -0 7.9485993 7.5272895 6.5518058 + 85900 2000 -0 7.9485825 7.527304 6.5517777 + 86000 2000 -0 7.9485687 7.5273192 6.5517496 + 86100 2000 -0 7.9485582 7.5273338 6.5517237 + 86200 2000 -0 7.9485508 7.5273473 6.5517012 + 86300 2000 -0 7.9485459 7.5273589 6.5516828 + 86400 2000 -0 7.948543 7.5273683 6.5516683 + 86500 2000 -0 7.9485415 7.5273756 6.5516577 + 86600 2000 -0 7.9485407 7.5273808 6.5516504 + 86700 2000 -0 7.9485402 7.527384 6.5516458 + 86800 2000 -0 7.9485398 7.5273853 6.5516437 + 86900 2000 -0 7.9485391 7.5273848 6.5516437 + 87000 2000 -0 7.9485382 7.5273826 6.5516457 + 87100 2000 -0 7.948537 7.5273787 6.5516498 + 87200 2000 -0 7.9485358 7.527373 6.5516562 + 87300 2000 -0 7.9485347 7.5273654 6.5516652 + 87400 2000 -0 7.9485342 7.5273557 6.5516772 + 87500 2000 -0 7.9485348 7.527344 6.5516928 + 87600 2000 -0 7.9485371 7.5273302 6.5517124 + 87700 2000 -0 7.9485417 7.5273145 6.551736 + 87800 2000 -0 7.9485492 7.5272974 6.5517634 + 87900 2000 -0 7.9485605 7.5272797 6.5517928 + 88000 2000 -0 7.9485752 7.5272622 6.5518233 + 88100 2000 -0 7.9485926 7.5272462 6.5518526 + 88200 2000 -0 7.9486117 7.5272327 6.5518779 + 88300 2000 -0 7.9486313 7.5272227 6.5518973 + 88400 2000 -0 7.9486498 7.5272169 6.5519096 + 88500 2000 -0 7.9486663 7.5272151 6.5519142 + 88600 2000 -0 7.9486799 7.5272169 6.5519123 + 88700 2000 -0 7.9486904 7.5272216 6.5519055 + 88800 2000 -0 7.9486979 7.5272282 6.5518954 + 88900 2000 -0 7.9487028 7.5272357 6.5518839 + 89000 2000 -0 7.9487057 7.5272433 6.5518724 + 89100 2000 -0 7.9487072 7.5272501 6.5518617 + 89200 2000 -0 7.9487076 7.5272558 6.5518526 + 89300 2000 -0 7.9487074 7.5272601 6.5518456 + 89400 2000 -0 7.9487071 7.5272626 6.5518409 + 89500 2000 -0 7.9487067 7.5272635 6.5518386 + 89600 2000 -0 7.9487065 7.5272625 6.5518391 + 89700 2000 -0 7.9487063 7.5272596 6.5518416 + 89800 2000 -0 7.9487063 7.5272548 6.5518462 + 89900 2000 -0 7.9487061 7.5272484 6.5518535 + 90000 2000 -0 7.9487056 7.5272404 6.551863 + 90100 2000 -0 7.9487043 7.5272311 6.551874 + 90200 2000 -0 7.9487018 7.527221 6.5518866 + 90300 2000 -0 7.9486975 7.5272106 6.5518997 + 90400 2000 -0 7.948691 7.5272008 6.5519118 + 90500 2000 -0 7.9486816 7.5271925 6.5519217 + 90600 2000 -0 7.9486692 7.5271867 6.5519276 + 90700 2000 -0 7.9486538 7.5271843 6.5519275 + 90800 2000 -0 7.948636 7.527186 6.5519202 + 90900 2000 -0 7.9486166 7.5271918 6.5519055 + 91000 2000 -0 7.948597 7.5272016 6.551884 + 91100 2000 -0 7.9485784 7.5272143 6.5518575 + 91200 2000 -0 7.9485622 7.5272289 6.5518287 + 91300 2000 -0 7.948549 7.5272442 6.5517999 + 91400 2000 -0 7.9485391 7.5272591 6.5517731 + 91500 2000 -0 7.9485322 7.5272727 6.5517498 + 91600 2000 -0 7.9485279 7.5272845 6.5517305 + 91700 2000 -0 7.9485256 7.5272942 6.5517151 + 91800 2000 -0 7.9485247 7.5273018 6.5517036 + 91900 2000 -0 7.9485245 7.5273072 6.5516953 + 92000 2000 -0 7.9485247 7.5273107 6.5516898 + 92100 2000 -0 7.9485248 7.5273122 6.5516867 + 92200 2000 -0 7.9485251 7.5273121 6.5516858 + 92300 2000 -0 7.9485248 7.5273103 6.5516869 + 92400 2000 -0 7.948524 7.5273066 6.5516899 + 92500 2000 -0 7.9485234 7.5273012 6.5516952 + 92600 2000 -0 7.9485229 7.527294 6.5517031 + 92700 2000 -0 7.9485229 7.5272848 6.5517139 + 92800 2000 -0 7.948524 7.5272735 6.5517283 + 92900 2000 -0 7.9485267 7.5272601 6.5517465 + 93000 2000 -0 7.9485317 7.5272448 6.5517688 + 93100 2000 -0 7.9485395 7.527228 6.5517949 + 93200 2000 -0 7.9485506 7.5272104 6.5518239 + 93300 2000 -0 7.9485649 7.527193 6.5518542 + 93400 2000 -0 7.9485821 7.5271768 6.5518835 + 93500 2000 -0 7.948601 7.527163 6.5519093 + 93600 2000 -0 7.9486206 7.5271527 6.5519294 + 93700 2000 -0 7.9486392 7.5271464 6.5519423 + 93800 2000 -0 7.9486559 7.5271442 6.5519477 + 93900 2000 -0 7.9486698 7.5271457 6.5519465 + 94000 2000 -0 7.9486807 7.5271502 6.55194 + 94100 2000 -0 7.9486885 7.5271566 6.5519303 + 94200 2000 -0 7.9486937 7.527164 6.5519188 + 94300 2000 -0 7.9486968 7.5271716 6.5519072 + 94400 2000 -0 7.9486984 7.5271785 6.5518964 + 94500 2000 -0 7.948699 7.5271843 6.5518871 + 94600 2000 -0 7.948699 7.5271887 6.5518798 + 94700 2000 -0 7.9486987 7.5271915 6.5518747 + 94800 2000 -0 7.9486984 7.5271925 6.5518721 + 94900 2000 -0 7.9486982 7.5271918 6.5518722 + 95000 2000 -0 7.9486982 7.5271891 6.5518743 + 95100 2000 -0 7.9486982 7.5271846 6.5518785 + 95200 2000 -0 7.948698 7.5271783 6.5518855 + 95300 2000 -0 7.9486978 7.5271706 6.5518946 + 95400 2000 -0 7.9486968 7.5271614 6.5519053 + 95500 2000 -0 7.9486946 7.5271514 6.5519176 + 95600 2000 -0 7.9486908 7.527141 6.5519306 + 95700 2000 -0 7.9486848 7.527131 6.551943 + 95800 2000 -0 7.948676 7.5271224 6.5519533 + 95900 2000 -0 7.9486643 7.5271161 6.55196 + 96000 2000 -0 7.9486496 7.527113 6.5519611 + 96100 2000 -0 7.9486322 7.5271138 6.5519551 + 96200 2000 -0 7.9486132 7.5271189 6.5519417 + 96300 2000 -0 7.9485937 7.5271279 6.5519214 + 96400 2000 -0 7.948575 7.5271401 6.5518957 + 96500 2000 -0 7.9485584 7.5271543 6.5518672 + 96600 2000 -0 7.9485447 7.5271695 6.5518384 + 96700 2000 -0 7.9485343 7.5271845 6.5518111 + 96800 2000 -0 7.948527 7.5271983 6.5517871 + 96900 2000 -0 7.9485224 7.5272105 6.5517671 + 97000 2000 -0 7.9485199 7.5272206 6.551751 + 97100 2000 -0 7.9485188 7.5272285 6.5517387 + 97200 2000 -0 7.9485186 7.5272343 6.5517298 + 97300 2000 -0 7.9485188 7.5272381 6.5517238 + 97400 2000 -0 7.9485191 7.52724 6.5517202 + 97500 2000 -0 7.9485192 7.5272402 6.5517188 + 97600 2000 -0 7.9485191 7.5272387 6.5517194 + 97700 2000 -0 7.9485187 7.5272354 6.551722 + 97800 2000 -0 7.9485181 7.5272305 6.5517267 + 97900 2000 -0 7.9485176 7.5272237 6.5517339 + 98000 2000 -0 7.9485176 7.5272149 6.5517439 + 98100 2000 -0 7.9485184 7.5272041 6.5517572 + 98200 2000 -0 7.9485207 7.5271913 6.5517744 + 98300 2000 -0 7.9485251 7.5271764 6.5517956 + 98400 2000 -0 7.9485322 7.52716 6.5518207 + 98500 2000 -0 7.9485424 7.5271426 6.5518489 + 98600 2000 -0 7.948556 7.527125 6.5518789 + 98700 2000 -0 7.9485724 7.5271084 6.5519086 + 98800 2000 -0 7.948591 7.5270939 6.5519354 + 98900 2000 -0 7.9486105 7.5270826 6.551957 + 99000 2000 -0 7.9486296 7.5270752 6.5519718 + 99100 2000 -0 7.9486469 7.5270719 6.5519792 + 99200 2000 -0 7.9486615 7.5270725 6.5519795 + 99300 2000 -0 7.9486732 7.5270763 6.5519743 + 99400 2000 -0 7.9486818 7.5270822 6.5519652 + 99500 2000 -0 7.9486877 7.5270895 6.551954 + 99600 2000 -0 7.9486913 7.527097 6.5519424 + 99700 2000 -0 7.9486933 7.5271042 6.5519313 + 99800 2000 -0 7.9486941 7.5271104 6.5519215 + 99900 2000 -0 7.9486942 7.5271152 6.5519136 + 100000 2000 -0 7.9486939 7.5271185 6.5519079 +Loop time of 87.7116 on 1 procs for 100000 steps with 2000 atoms + +Performance: 98504.589 tau/day, 1140.099 timesteps/s, 2.280 Matom-step/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 66.081 | 66.081 | 66.081 | 0.0 | 75.34 +Neigh | 2.7411 | 2.7411 | 2.7411 | 0.0 | 3.13 +Comm | 1.3393 | 1.3393 | 1.3393 | 0.0 | 1.53 +Output | 0.029473 | 0.029473 | 0.029473 | 0.0 | 0.03 +Modify | 16.598 | 16.598 | 16.598 | 0.0 | 18.92 +Other | | 0.9233 | | | 1.05 + +Nlocal: 2000 ave 2000 max 2000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 494 ave 494 max 494 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 9635 ave 9635 max 9635 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 9635 +Ave neighs/atom = 4.8175 +Neighbor list builds = 3285 +Dangerous builds = 0 + +Total wall time: 0:01:27 diff --git a/examples/granular/log.15Sep22.pour.heat.g++.4 b/examples/granular/log.15Sep22.pour.heat.g++.4 new file mode 100644 index 0000000000..f159302d65 --- /dev/null +++ b/examples/granular/log.15Sep22.pour.heat.g++.4 @@ -0,0 +1,1172 @@ +LAMMPS (15 Sep 2022) +# pour one types of particles into cylinder and oscillate +# temperature of the bottom plate + +variable name string heat_plate + +atom_style sphere/temp +units lj + +############################################### +# Geometry-related parameters +############################################### + +variable boxx equal 10 +variable boxy equal 10 +variable boxz equal 50 + +variable drum_rad equal ${boxx}*0.5 +variable drum_rad equal 10*0.5 +variable drum_height equal 30 + +variable xc equal 0.5*${boxx} +variable xc equal 0.5*10 +variable yc equal 0.5*${boxx} +variable yc equal 0.5*10 +variable zc equal 0.5*${boxz} +variable zc equal 0.5*50 + +############################################### +# Particle-related parameters +############################################### +variable rlo equal 0.25 +variable rhi equal 0.5 +variable dlo equal 2.0*${rlo} +variable dlo equal 2.0*0.25 +variable dhi equal 2.0*${rhi} +variable dhi equal 2.0*0.5 + +variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} +variable cyl_rad_inner equal 5-1.1*${rhi} +variable cyl_rad_inner equal 5-1.1*0.5 + +variable dens equal 1.0 + +variable skin equal 0.4*${rhi} +variable skin equal 0.4*0.5 + +############# +processors * * 1 +region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} +region boxreg block 0 10 0 ${boxy} 0 ${boxz} +region boxreg block 0 10 0 10 0 ${boxz} +region boxreg block 0 10 0 10 0 50 +create_box 2 boxreg +Created orthogonal box = (0 0 0) to (10 10 50) + 2 by 2 by 1 MPI processor grid +change_box all boundary p p f +Changing box ... + +pair_style granular +pair_coeff * * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 + +region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in +region curved_wall cylinder z 5 ${yc} ${drum_rad} 0 ${drum_height} side in +region curved_wall cylinder z 5 5 ${drum_rad} 0 ${drum_height} side in +region curved_wall cylinder z 5 5 5 0 ${drum_height} side in +region curved_wall cylinder z 5 5 5 0 30 side in +region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in +region bottom_wall plane 5 ${yc} 0 0 0 1 side in +region bottom_wall plane 5 5 0 0 0 1 side in + +region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 5 ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 5 5 ${cyl_rad_inner} ${drum_height} ${boxz} +region insreg cylinder z 5 5 4.45 ${drum_height} ${boxz} +region insreg cylinder z 5 5 4.45 30 ${boxz} +region insreg cylinder z 5 5 4.45 30 50 + +fix 0 all balance 100 1.0 shift xy 5 1.1 +fix 1 all nve/sphere +fix 2 all heat/flow/sphere/temp constant 1.0 +fix grav all gravity 10 vector 0 0 -1 +fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 594 every 400 steps, 1000 by step 401 +fix ins2 all pour 1000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 1 dens 1 ${dens} +fix ins2 all pour 1000 2 1234 region insreg diam range 0.5 1 dens 1 1 +Particle insertion: 594 every 400 steps, 1000 by step 401 + +comm_modify vel yes + +neighbor ${skin} bin +neighbor 0.2 bin +neigh_modify delay 0 every 1 check yes + +variable oscillate equal 1.0*sin(step*0.0001) + +fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate + +thermo_style custom step atoms ke pxx pyy pzz +thermo_modify lost warn +thermo 100 + +timestep 0.001 + +#dump 1 all custom 1000 ${name}.dump id type radius mass x y z temperature heatflow + +#For removal later +compute 1 all property/atom radius +variable zmax atom z+c_1>0.5*${drum_height} +variable zmax atom z+c_1>0.5*30 +group delgroup dynamic all var zmax every 10000 +dynamic group delgroup defined + +run 100000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.2 + ghost atom cutoff = 1.2 + binsize = 0.6, bins = 17 17 84 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair granular, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.847 | 5.847 | 5.847 Mbytes + Step Atoms KinEng Pxx Pyy Pzz + 0 0 -0 0 0 0 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 100 536 -0 0 0 7.4220499 + 200 536 -0 0 0 10.753096 + 300 536 -0 0 0 13.500241 + 400 536 -0 0 0 18.036636 +WARNING: Less insertions than requested (../fix_pour.cpp:681) +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 500 903 -0 0 0 25.955524 + 600 903 -0 0 0 32.116907 + 700 903 -0 0.03620165 0.033499977 32.179357 + 800 903 -0 0.2106713 0.26431108 36.206318 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 900 1265 -0 0.2667335 0.20266671 44.177757 + 1000 1265 -0 0.51829265 0.67739212 49.904079 + 1100 1265 -0 0.87525564 0.6604066 53.13465 + 1200 1265 -0 0.8016023 0.82120199 54.27487 +WARNING: Less insertions than requested (../fix_pour.cpp:681) + 1300 1618 -0 1.0922969 1.2299526 61.033455 + 1400 1618 -0 3.4739827 3.2058732 60.989867 + 1500 1618 -0 2.952107 2.7920855 61.208615 + 1600 1618 -0 3.4540208 3.5863396 62.262722 + 1700 2000 -0 3.8875418 4.0835421 69.087737 + 1800 2000 -0 4.1780246 5.0584026 70.734293 + 1900 2000 -0 4.5873576 4.7767119 76.481264 + 2000 2000 -0 7.1355414 6.9027373 76.136305 + 2100 2000 -0 7.3292721 6.9457021 74.022659 + 2200 2000 -0 9.1771132 9.0399042 72.911506 + 2300 2000 -0 9.5743887 10.359952 70.996904 + 2400 2000 -0 12.1002 12.023765 68.246157 + 2500 2000 -0 10.68678 11.126488 59.337387 + 2600 2000 -0 10.444117 10.845713 57.115639 + 2700 2000 -0 12.012219 11.766618 56.397063 + 2800 2000 -0 12.987283 13.30882 55.411279 + 2900 2000 -0 11.55722 12.213726 48.690822 + 3000 2000 -0 11.124576 11.369397 43.425073 + 3100 2000 -0 12.54896 12.507632 45.15522 + 3200 2000 -0 13.119307 13.345554 41.469993 + 3300 2000 -0 12.07449 11.769699 32.849662 + 3400 2000 -0 11.409224 11.606583 28.228622 + 3500 2000 -0 13.30178 13.057278 28.120788 + 3600 2000 -0 12.362318 12.451842 22.030785 + 3700 2000 -0 10.065639 10.350313 14.404919 + 3800 2000 -0 9.2215449 9.4216178 10.78298 + 3900 2000 -0 9.1484555 9.2548793 9.4609704 + 4000 2000 -0 8.7679202 8.7720055 7.9592505 + 4100 2000 -0 7.9639161 8.0843783 6.2748484 + 4200 2000 -0 7.4475613 7.662972 5.7240274 + 4300 2000 -0 7.3834943 7.5643205 5.8884721 + 4400 2000 -0 7.5767328 7.7567295 6.4335134 + 4500 2000 -0 7.6350768 7.7802709 6.5220595 + 4600 2000 -0 7.5680597 7.7360764 6.2252142 + 4700 2000 -0 7.5455586 7.7200666 6.1870466 + 4800 2000 -0 7.5889323 7.7502568 6.3364001 + 4900 2000 -0 7.5976185 7.7506557 6.3511631 + 5000 2000 -0 7.5729575 7.7396108 6.226979 + 5100 2000 -0 7.5828423 7.7333361 6.2543182 + 5200 2000 -0 7.5997211 7.7682298 6.3300795 + 5300 2000 -0 7.5951405 7.7598744 6.3224087 + 5400 2000 -0 7.5703525 7.7452048 6.2321318 + 5500 2000 -0 7.5893936 7.7516359 6.2777047 + 5600 2000 -0 7.596363 7.7645306 6.3388976 + 5700 2000 -0 7.5889409 7.7570078 6.2848334 + 5800 2000 -0 7.5820271 7.7456337 6.2569579 + 5900 2000 -0 7.5946475 7.7646155 6.3117599 + 6000 2000 -0 7.5979789 7.7656429 6.3160667 + 6100 2000 -0 7.586255 7.7584393 6.2682341 + 6200 2000 -0 7.5860817 7.7574904 6.2792591 + 6300 2000 -0 7.5952765 7.7646058 6.3189922 + 6400 2000 -0 7.5996199 7.7770424 6.2986723 + 6500 2000 -0 7.5902888 7.7688566 6.2761571 + 6600 2000 -0 7.5950388 7.76863 6.2895943 + 6700 2000 -0 7.5966236 7.7691368 6.302048 + 6800 2000 -0 7.5939532 7.7641262 6.2726096 + 6900 2000 -0 7.5951993 7.7682327 6.2895245 + 7000 2000 -0 7.6023185 7.7697092 6.3080702 + 7100 2000 -0 7.5960578 7.7674031 6.2848334 + 7200 2000 -0 7.5982345 7.7654466 6.2788045 + 7300 2000 -0 7.6023187 7.7710769 6.3041624 + 7400 2000 -0 7.5974296 7.7673886 6.283173 + 7500 2000 -0 7.5973168 7.7670675 6.2788593 + 7600 2000 -0 7.5996473 7.7703847 6.2996016 + 7700 2000 -0 7.5973523 7.7680426 6.2917276 + 7800 2000 -0 7.5955633 7.7663282 6.2774422 + 7900 2000 -0 7.596774 7.7680408 6.2913039 + 8000 2000 -0 7.5990211 7.7682504 6.2971218 + 8100 2000 -0 7.5969667 7.7674553 6.2827596 + 8200 2000 -0 7.5968217 7.768405 6.2864438 + 8300 2000 -0 7.6003301 7.7675972 6.2968783 + 8400 2000 -0 7.5968968 7.7675447 6.2851363 + 8500 2000 -0 7.5964945 7.7664669 6.2821348 + 8600 2000 -0 7.59847 7.7686981 6.2935599 + 8700 2000 -0 7.5973531 7.7680237 6.2892401 + 8800 2000 -0 7.5962388 7.7660642 6.2824211 + 8900 2000 -0 7.5974758 7.7679467 6.2894374 + 9000 2000 -0 7.5980837 7.7680794 6.2922818 + 9100 2000 -0 7.5964734 7.766756 6.2837584 + 9200 2000 -0 7.5970307 7.7673294 6.2867417 + 9300 2000 -0 7.5979654 7.7680887 6.2924025 + 9400 2000 -0 7.5968814 7.7671306 6.2861078 + 9500 2000 -0 7.5967607 7.7670542 6.2853516 + 9600 2000 -0 7.5978051 7.7679583 6.2911802 + 9700 2000 -0 7.597238 7.767496 6.2880951 + 9800 2000 -0 7.596697 7.7670074 6.2853135 + 9900 2000 -0 7.5974854 7.7676519 6.2894109 + 10000 2000 -0 7.5974415 7.7676866 6.2894089 + 10100 2000 -0 7.5968332 7.7671611 6.2858705 + 10200 2000 -0 7.5971895 7.7673771 6.2881001 + 10300 2000 -0 7.5974344 7.7675998 6.2897713 + 10400 2000 -0 7.5969756 7.767279 6.2867879 + 10500 2000 -0 7.5970506 7.7672894 6.2872789 + 10600 2000 -0 7.5973817 7.7675529 6.2895398 + 10700 2000 -0 7.597085 7.7673281 6.2876393 + 10800 2000 -0 7.5969757 7.7672429 6.2869852 + 10900 2000 -0 7.5973016 7.7675261 6.2890364 + 11000 2000 -0 7.5971776 7.7674059 6.2882417 + 11100 2000 -0 7.596955 7.7672303 6.2870489 + 11200 2000 -0 7.5971842 7.7674346 6.288507 + 11300 2000 -0 7.5972149 7.7674441 6.2885796 + 11400 2000 -0 7.5969922 7.7672746 6.2872884 + 11500 2000 -0 7.5970948 7.7673717 6.2880589 + 11600 2000 -0 7.5971991 7.7674426 6.2886788 + 11700 2000 -0 7.5970217 7.7673051 6.2876396 + 11800 2000 -0 7.5970385 7.767356 6.2877736 + 11900 2000 -0 7.5971592 7.7674896 6.2885954 + 12000 2000 -0 7.5970437 7.7673831 6.2879896 + 12100 2000 -0 7.5969799 7.7673414 6.2876892 + 12200 2000 -0 7.597104 7.7674691 6.2883867 + 12300 2000 -0 7.5970688 7.7674421 6.2882073 + 12400 2000 -0 7.5969667 7.7673544 6.2877266 + 12500 2000 -0 7.5970342 7.7674299 6.2881961 + 12600 2000 -0 7.5970575 7.7674563 6.2883162 + 12700 2000 -0 7.5969702 7.7673919 6.2878499 + 12800 2000 -0 7.5969875 7.7674105 6.2880279 + 12900 2000 -0 7.5970261 7.7674542 6.2883236 + 13000 2000 -0 7.5969638 7.7674093 6.2880003 + 13100 2000 -0 7.5969523 7.7674055 6.2879583 + 13200 2000 -0 7.5969948 7.7674543 6.2882605 + 13300 2000 -0 7.5969671 7.7674324 6.2881167 + 13400 2000 -0 7.5969481 7.7674096 6.2879707 + 13500 2000 -0 7.5969704 7.7674472 6.2881927 + 13600 2000 -0 7.5969604 7.7674502 6.2881801 + 13700 2000 -0 7.5969111 7.7674226 6.2880031 + 13800 2000 -0 7.5969206 7.7674314 6.288133 + 13900 2000 -0 7.5969259 7.7674429 6.2882037 + 14000 2000 -0 7.5968972 7.7674314 6.2880579 + 14100 2000 -0 7.5968963 7.7674369 6.2880968 + 14200 2000 -0 7.5969042 7.7674469 6.2882024 + 14300 2000 -0 7.5968803 7.7674344 6.2881112 + 14400 2000 -0 7.59687 7.7674353 6.2880896 + 14500 2000 -0 7.5968808 7.7674514 6.2881879 + 14600 2000 -0 7.5968666 7.7674452 6.28815 + 14700 2000 -0 7.5968485 7.7674368 6.2880988 + 14800 2000 -0 7.5968535 7.767448 6.2881738 + 14900 2000 -0 7.5968474 7.7674514 6.2881775 + 15000 2000 -0 7.5968308 7.7674448 6.2881173 + 15100 2000 -0 7.5968288 7.7674504 6.2881599 + 15200 2000 -0 7.5968259 7.7674545 6.2881943 + 15300 2000 -0 7.5968096 7.7674493 6.2881446 + 15400 2000 -0 7.5968036 7.7674548 6.2881534 + 15500 2000 -0 7.5968025 7.7674625 6.2881974 + 15600 2000 -0 7.5967877 7.7674575 6.2881698 + 15700 2000 -0 7.5967763 7.7674574 6.2881574 + 15800 2000 -0 7.5967748 7.7674674 6.2881956 + 15900 2000 -0 7.5967648 7.7674695 6.2881883 + 16000 2000 -0 7.5967506 7.7674666 6.2881665 + 16100 2000 -0 7.5967447 7.7674721 6.2881929 + 16200 2000 -0 7.596737 7.7674775 6.2882018 + 16300 2000 -0 7.596724 7.7674779 6.2881798 + 16400 2000 -0 7.5967156 7.7674817 6.2881911 + 16500 2000 -0 7.5967078 7.7674863 6.2882086 + 16600 2000 -0 7.5966952 7.7674871 6.288195 + 16700 2000 -0 7.5966855 7.7674905 6.288195 + 16800 2000 -0 7.5966849 7.7675018 6.2882111 + 16900 2000 -0 7.5966659 7.767499 6.2882084 + 17000 2000 -0 7.5966553 7.7674989 6.288203 + 17100 2000 -0 7.5966481 7.7675039 6.288216 + 17200 2000 -0 7.5966391 7.7675079 6.2882174 + 17300 2000 -0 7.5966284 7.7675095 6.2882114 + 17400 2000 -0 7.5966197 7.7675124 6.2882207 + 17500 2000 -0 7.5966116 7.7675184 6.2882274 + 17600 2000 -0 7.5966015 7.7675179 6.2882213 + 17700 2000 -0 7.596598 7.7675217 6.2882271 + 17800 2000 -0 7.5965839 7.7675249 6.2882319 + 17900 2000 -0 7.5965764 7.7675277 6.2882321 + 18000 2000 -0 7.5965694 7.7675324 6.2882345 + 18100 2000 -0 7.5965606 7.7675381 6.288242 + 18200 2000 -0 7.5965529 7.7675402 6.2882446 + 18300 2000 -0 7.5965448 7.7675416 6.2882447 + 18400 2000 -0 7.5965376 7.7675437 6.2882479 + 18500 2000 -0 7.5965312 7.7675449 6.2882502 + 18600 2000 -0 7.5965234 7.7675465 6.2882488 + 18700 2000 -0 7.5965164 7.7675489 6.2882532 + 18800 2000 -0 7.5965092 7.7675524 6.2882585 + 18900 2000 -0 7.5965015 7.7675553 6.2882605 + 19000 2000 -0 7.5964943 7.7675579 6.288263 + 19100 2000 -0 7.5964874 7.7675604 6.2882669 + 19200 2000 -0 7.59648 7.7675614 6.2882681 + 19300 2000 -0 7.5964723 7.7675626 6.2882686 + 19400 2000 -0 7.596465 7.7675656 6.2882725 + 19500 2000 -0 7.5964572 7.7675691 6.2882763 + 19600 2000 -0 7.5964488 7.767572 6.2882784 + 19700 2000 -0 7.5964406 7.7675747 6.2882815 + 19800 2000 -0 7.5964328 7.7675771 6.2882844 + 19900 2000 -0 7.5964247 7.7675792 6.288285 + 20000 2000 -0 7.5964164 7.7675815 6.2882866 + 20100 2000 -0 7.5964079 7.7675846 6.28829 + 20200 2000 -0 7.596399 7.7675881 6.2882925 + 20300 2000 -0 7.5963909 7.7675919 6.2882955 + 20400 2000 -0 7.5963809 7.7675953 6.2882972 + 20500 2000 -0 7.5963752 7.7676011 6.2883018 + 20600 2000 -0 7.5963619 7.7676092 6.2883037 + 20700 2000 -0 7.5963522 7.767611 6.2883069 + 20800 2000 -0 7.5963411 7.7676172 6.28831 + 20900 2000 -0 7.5963304 7.7676213 6.2883118 + 21000 2000 -0 7.5963203 7.767625 6.2883148 + 21100 2000 -0 7.5963105 7.7676285 6.2883181 + 21200 2000 -0 7.5963007 7.7676317 6.2883195 + 21300 2000 -0 7.5962911 7.7676349 6.2883215 + 21400 2000 -0 7.5962816 7.7676382 6.2883246 + 21500 2000 -0 7.5962731 7.7676543 6.288331 + 21600 2000 -0 7.5962632 7.7676583 6.2883332 + 21700 2000 -0 7.5962548 7.767661 6.2883366 + 21800 2000 -0 7.5962459 7.7676634 6.2883395 + 21900 2000 -0 7.5962373 7.7676655 6.2883415 + 22000 2000 -0 7.5962319 7.7676679 6.2883449 + 22100 2000 -0 7.5962209 7.7676703 6.2883465 + 22200 2000 -0 7.5962128 7.7676725 6.2883506 + 22300 2000 -0 7.5962054 7.7676747 6.2883528 + 22400 2000 -0 7.5961978 7.7676768 6.2883553 + 22500 2000 -0 7.5961903 7.7676789 6.288359 + 22600 2000 -0 7.596183 7.7676807 6.2883613 + 22700 2000 -0 7.5961756 7.7676824 6.288363 + 22800 2000 -0 7.5961685 7.7676843 6.2883669 + 22900 2000 -0 7.5961616 7.7676859 6.2883701 + 23000 2000 -0 7.5961555 7.7676881 6.2883726 + 23100 2000 -0 7.5961478 7.7676894 6.2883761 + 23200 2000 -0 7.5961408 7.7676905 6.2883794 + 23300 2000 -0 7.5961337 7.7676917 6.2883816 + 23400 2000 -0 7.5961266 7.7676931 6.2883848 + 23500 2000 -0 7.5961196 7.7676947 6.2883884 + 23600 2000 -0 7.5961122 7.7676962 6.2883911 + 23700 2000 -0 7.5961047 7.7676979 6.2883942 + 23800 2000 -0 7.5960972 7.7676997 6.2883977 + 23900 2000 -0 7.5960894 7.7677015 6.2884004 + 24000 2000 -0 7.5960814 7.7677033 6.288403 + 24100 2000 -0 7.5960734 7.7677054 6.2884061 + 24200 2000 -0 7.5960651 7.7677076 6.2884089 + 24300 2000 -0 7.5960576 7.76771 6.2884124 + 24400 2000 -0 7.5960487 7.7677127 6.288415 + 24500 2000 -0 7.596039 7.7677152 6.2884169 + 24600 2000 -0 7.59603 7.7677178 6.2884192 + 24700 2000 -0 7.5960208 7.7677205 6.2884216 + 24800 2000 -0 7.5960115 7.7677234 6.2884242 + 24900 2000 -0 7.5960021 7.7677264 6.2884266 + 25000 2000 -0 7.5959926 7.7677293 6.288429 + 25100 2000 -0 7.595983 7.7677323 6.2884316 + 25200 2000 -0 7.5959735 7.7677352 6.2884341 + 25300 2000 -0 7.5959639 7.7677381 6.2884365 + 25400 2000 -0 7.5959544 7.7677409 6.2884391 + 25500 2000 -0 7.5959449 7.7677437 6.2884418 + 25600 2000 -0 7.5959355 7.7677464 6.2884444 + 25700 2000 -0 7.5959262 7.7677491 6.2884471 + 25800 2000 -0 7.5959171 7.7677518 6.2884498 + 25900 2000 -0 7.5959081 7.7677543 6.2884525 + 26000 2000 -0 7.5958993 7.7677567 6.2884551 + 26100 2000 -0 7.5958907 7.7677591 6.2884578 + 26200 2000 -0 7.595883 7.7677616 6.2884607 + 26300 2000 -0 7.5958752 7.7677633 6.2884628 + 26400 2000 -0 7.5958661 7.7677658 6.288466 + 26500 2000 -0 7.5958577 7.7677683 6.2884697 + 26600 2000 -0 7.5958499 7.7677701 6.2884712 + 26700 2000 -0 7.5958424 7.767772 6.2884735 + 26800 2000 -0 7.5958352 7.7677742 6.2884777 + 26900 2000 -0 7.5958278 7.767776 6.2884798 + 27000 2000 -0 7.5958205 7.7677777 6.2884817 + 27100 2000 -0 7.5958171 7.7677861 6.2884867 + 27200 2000 -0 7.5958058 7.767782 6.2884877 + 27300 2000 -0 7.5957995 7.767783 6.2884897 + 27400 2000 -0 7.5957928 7.7677845 6.2884941 + 27500 2000 -0 7.5957858 7.7677862 6.2884971 + 27600 2000 -0 7.5957786 7.7677876 6.2884991 + 27700 2000 -0 7.5957716 7.7677894 6.2885028 + 27800 2000 -0 7.5957644 7.7677911 6.2885058 + 27900 2000 -0 7.595757 7.7677927 6.2885082 + 28000 2000 -0 7.5957496 7.7677945 6.2885114 + 28100 2000 -0 7.5957421 7.7677965 6.2885146 + 28200 2000 -0 7.5957342 7.7677984 6.288517 + 28300 2000 -0 7.5957263 7.7678006 6.2885197 + 28400 2000 -0 7.5957182 7.7678029 6.2885227 + 28500 2000 -0 7.5957098 7.7678053 6.2885251 + 28600 2000 -0 7.595701 7.7678109 6.2885275 + 28700 2000 -0 7.5956927 7.7678104 6.2885301 + 28800 2000 -0 7.5956839 7.7678133 6.2885325 + 28900 2000 -0 7.5956749 7.7678161 6.2885345 + 29000 2000 -0 7.5956658 7.7678191 6.2885369 + 29100 2000 -0 7.5956566 7.7678222 6.2885392 + 29200 2000 -0 7.5956473 7.7678253 6.2885412 + 29300 2000 -0 7.5956379 7.7678284 6.2885434 + 29400 2000 -0 7.5956285 7.7678315 6.2885458 + 29500 2000 -0 7.595619 7.7678346 6.288548 + 29600 2000 -0 7.5956096 7.7678376 6.2885502 + 29700 2000 -0 7.5956004 7.7678407 6.2885528 + 29800 2000 -0 7.5955908 7.7678436 6.2885551 + 29900 2000 -0 7.5955816 7.7678465 6.2885573 + 30000 2000 -0 7.5955725 7.7678494 6.2885598 + 30100 2000 -0 7.5955635 7.7678522 6.2885623 + 30200 2000 -0 7.5955547 7.7678548 6.2885646 + 30300 2000 -0 7.5955461 7.7678575 6.2885671 + 30400 2000 -0 7.5955377 7.7678601 6.2885696 + 30500 2000 -0 7.5955317 7.7678632 6.288572 + 30600 2000 -0 7.5955209 7.7678646 6.2885732 + 30700 2000 -0 7.5955138 7.7678673 6.2885773 + 30800 2000 -0 7.5955057 7.7678698 6.2885802 + 30900 2000 -0 7.5954978 7.7678719 6.2885813 + 31000 2000 -0 7.5954905 7.7678739 6.2885838 + 31100 2000 -0 7.5954836 7.7678764 6.2885876 + 31200 2000 -0 7.5954763 7.7678782 6.2885891 + 31300 2000 -0 7.5954742 7.7678842 6.2885893 + 31400 2000 -0 7.5954635 7.7678813 6.2885963 + 31500 2000 -0 7.5954662 7.7678813 6.2885978 + 31600 2000 -0 7.5954651 7.767881 6.2885992 + 31700 2000 -0 7.5954652 7.7678813 6.2886059 + 31800 2000 -0 7.5954642 7.7678815 6.2886093 + 31900 2000 -0 7.5954627 7.7678812 6.2886098 + 32000 2000 -0 7.5954619 7.7678816 6.2886155 + 32100 2000 -0 7.5954608 7.767882 6.2886199 + 32200 2000 -0 7.595459 7.7678819 6.2886212 + 32300 2000 -0 7.5954574 7.7678824 6.2886253 + 32400 2000 -0 7.5954559 7.7678831 6.2886303 + 32500 2000 -0 7.5954537 7.7678834 6.2886323 + 32600 2000 -0 7.5954513 7.7678841 6.2886353 + 32700 2000 -0 7.5954491 7.767885 6.2886401 + 32800 2000 -0 7.5954463 7.7678859 6.2886428 + 32900 2000 -0 7.5954433 7.7678868 6.2886452 + 33000 2000 -0 7.5954404 7.7678881 6.2886494 + 33100 2000 -0 7.5954372 7.7678894 6.2886525 + 33200 2000 -0 7.5954345 7.76789 6.2886545 + 33300 2000 -0 7.5954319 7.7678907 6.2886578 + 33400 2000 -0 7.5954292 7.7678914 6.2886612 + 33500 2000 -0 7.5954262 7.767892 6.2886633 + 33600 2000 -0 7.5954232 7.7678927 6.2886662 + 33700 2000 -0 7.5954203 7.7678934 6.2886697 + 33800 2000 -0 7.5954172 7.767894 6.2886722 + 33900 2000 -0 7.5954142 7.7678945 6.288675 + 34000 2000 -0 7.5954113 7.7678952 6.2886785 + 34100 2000 -0 7.5954084 7.7678956 6.2886814 + 34200 2000 -0 7.5954056 7.767896 6.2886841 + 34300 2000 -0 7.595403 7.7678964 6.2886876 + 34400 2000 -0 7.5954005 7.7678968 6.2886908 + 34500 2000 -0 7.5953981 7.7678969 6.2886936 + 34600 2000 -0 7.5953959 7.7678971 6.2886968 + 34700 2000 -0 7.595394 7.7678972 6.2887001 + 34800 2000 -0 7.5953953 7.7678972 6.288703 + 34900 2000 -0 7.5953889 7.767897 6.2887047 + 35000 2000 -0 7.5953908 7.7678971 6.2887098 + 35100 2000 -0 7.5953877 7.7678973 6.2887122 + 35200 2000 -0 7.5953867 7.767897 6.2887144 + 35300 2000 -0 7.5953863 7.7678962 6.2887182 + 35400 2000 -0 7.5953856 7.7678962 6.288722 + 35500 2000 -0 7.5953849 7.7678956 6.2887237 + 35600 2000 -0 7.5953846 7.7678951 6.2887271 + 35700 2000 -0 7.5953844 7.7678947 6.2887309 + 35800 2000 -0 7.595384 7.767894 6.2887334 + 35900 2000 -0 7.5953838 7.7678933 6.2887362 + 36000 2000 -0 7.5953837 7.7678927 6.2887403 + 36100 2000 -0 7.5953834 7.767892 6.2887432 + 36200 2000 -0 7.595383 7.7678913 6.2887459 + 36300 2000 -0 7.5953827 7.7678907 6.2887498 + 36400 2000 -0 7.5953821 7.7678901 6.2887531 + 36500 2000 -0 7.5953814 7.7678895 6.2887558 + 36600 2000 -0 7.5953807 7.7678891 6.2887593 + 36700 2000 -0 7.5953797 7.7678887 6.2887627 + 36800 2000 -0 7.5953785 7.7678884 6.2887654 + 36900 2000 -0 7.5953772 7.7678883 6.2887685 + 37000 2000 -0 7.5953757 7.7678884 6.2887717 + 37100 2000 -0 7.595374 7.7678885 6.2887744 + 37200 2000 -0 7.5953721 7.7678888 6.2887771 + 37300 2000 -0 7.59537 7.7678892 6.2887801 + 37400 2000 -0 7.5953678 7.7678897 6.2887827 + 37500 2000 -0 7.5953654 7.7678903 6.2887851 + 37600 2000 -0 7.5953628 7.767891 6.2887879 + 37700 2000 -0 7.5953602 7.7678918 6.2887906 + 37800 2000 -0 7.5953571 7.7678929 6.288793 + 37900 2000 -0 7.5953545 7.7678935 6.2887957 + 38000 2000 -0 7.5953517 7.7678941 6.2887985 + 38100 2000 -0 7.5953488 7.7678949 6.2888011 + 38200 2000 -0 7.5953459 7.7678956 6.2888037 + 38300 2000 -0 7.5953431 7.7678962 6.2888066 + 38400 2000 -0 7.5953404 7.7678969 6.2888094 + 38500 2000 -0 7.5953377 7.7678974 6.2888122 + 38600 2000 -0 7.5953352 7.7678979 6.2888151 + 38700 2000 -0 7.5953328 7.7678983 6.288818 + 38800 2000 -0 7.5953306 7.7678987 6.2888209 + 38900 2000 -0 7.5953285 7.7678991 6.2888238 + 39000 2000 -0 7.5953266 7.7678994 6.2888267 + 39100 2000 -0 7.5953284 7.7678993 6.2888299 + 39200 2000 -0 7.5953221 7.7679002 6.2888311 + 39300 2000 -0 7.5953225 7.7678998 6.2888359 + 39400 2000 -0 7.5953215 7.7678999 6.2888384 + 39500 2000 -0 7.5953234 7.7678996 6.2888401 + 39600 2000 -0 7.5953197 7.7678996 6.2888437 + 39700 2000 -0 7.5953193 7.7678996 6.2888471 + 39800 2000 -0 7.5953187 7.7678992 6.2888486 + 39900 2000 -0 7.5953185 7.7678989 6.2888519 + 40000 2000 -0 7.5953185 7.7678987 6.2888555 + 40100 2000 -0 7.5953171 7.7678976 6.2888576 + 40200 2000 -0 7.595318 7.7678977 6.2888603 + 40300 2000 -0 7.5953181 7.7678973 6.2888642 + 40400 2000 -0 7.5953178 7.7678967 6.2888668 + 40500 2000 -0 7.5953175 7.7678962 6.2888695 + 40600 2000 -0 7.5953174 7.7678958 6.2888733 + 40700 2000 -0 7.5953169 7.7678954 6.2888761 + 40800 2000 -0 7.5953162 7.767895 6.2888787 + 40900 2000 -0 7.5953155 7.7678947 6.288882 + 41000 2000 -0 7.5953147 7.7678946 6.2888851 + 41100 2000 -0 7.5953136 7.7678944 6.2888876 + 41200 2000 -0 7.5953123 7.7678945 6.2888905 + 41300 2000 -0 7.5953109 7.7678948 6.2888936 + 41400 2000 -0 7.5953091 7.7678948 6.2888961 + 41500 2000 -0 7.595307 7.7678943 6.2888989 + 41600 2000 -0 7.5953046 7.7678939 6.2889022 + 41700 2000 -0 7.5953019 7.7678935 6.2889051 + 41800 2000 -0 7.595299 7.7678933 6.2889079 + 41900 2000 -0 7.5952973 7.7678931 6.2889112 + 42000 2000 -0 7.595293 7.7678931 6.2889142 + 42100 2000 -0 7.5952897 7.7678929 6.2889165 + 42200 2000 -0 7.5952864 7.7678928 6.2889198 + 42300 2000 -0 7.5952831 7.7678928 6.288923 + 42400 2000 -0 7.5952797 7.7678926 6.2889256 + 42500 2000 -0 7.5952764 7.7678925 6.2889289 + 42600 2000 -0 7.595274 7.7678914 6.2889322 + 42700 2000 -0 7.5952704 7.7678916 6.2889354 + 42800 2000 -0 7.595267 7.7678911 6.2889384 + 42900 2000 -0 7.5952656 7.7678941 6.2889425 + 43000 2000 -0 7.5952627 7.7678921 6.2889451 + 43100 2000 -0 7.5952594 7.7678889 6.2889481 + 43200 2000 -0 7.5952565 7.7678879 6.2889509 + 43300 2000 -0 7.5952547 7.7678871 6.2889548 + 43400 2000 -0 7.5952557 7.767886 6.2889583 + 43500 2000 -0 7.5952503 7.7678854 6.2889594 + 43600 2000 -0 7.5952493 7.7678839 6.288965 + 43700 2000 -0 7.5952482 7.7678827 6.2889677 + 43800 2000 -0 7.5952467 7.7678813 6.2889694 + 43900 2000 -0 7.5952458 7.7678801 6.2889739 + 44000 2000 -0 7.5952454 7.7678787 6.2889774 + 44100 2000 -0 7.5952449 7.7678768 6.2889786 + 44200 2000 -0 7.5952449 7.7678753 6.2889822 + 44300 2000 -0 7.595245 7.7678737 6.288986 + 44400 2000 -0 7.5952448 7.7678718 6.2889879 + 44500 2000 -0 7.5952448 7.7678699 6.2889908 + 44600 2000 -0 7.595245 7.7678683 6.2889949 + 44700 2000 -0 7.5952448 7.7678663 6.2889974 + 44800 2000 -0 7.5952446 7.7678644 6.289 + 44900 2000 -0 7.595245 7.7678622 6.2890034 + 45000 2000 -0 7.5952444 7.767861 6.2890073 + 45100 2000 -0 7.5952437 7.7678593 6.2890094 + 45200 2000 -0 7.595243 7.7678577 6.2890129 + 45300 2000 -0 7.5952422 7.7678563 6.289016 + 45400 2000 -0 7.5952411 7.7678549 6.2890185 + 45500 2000 -0 7.5952399 7.7678537 6.2890214 + 45600 2000 -0 7.5952386 7.7678526 6.2890245 + 45700 2000 -0 7.595237 7.7678516 6.2890269 + 45800 2000 -0 7.5952352 7.7678508 6.2890295 + 45900 2000 -0 7.5952333 7.7678501 6.2890323 + 46000 2000 -0 7.5952312 7.7678495 6.2890348 + 46100 2000 -0 7.5952289 7.767849 6.289037 + 46200 2000 -0 7.5952265 7.7678486 6.2890397 + 46300 2000 -0 7.595224 7.7678482 6.2890422 + 46400 2000 -0 7.5952213 7.7678478 6.2890445 + 46500 2000 -0 7.5952186 7.7678474 6.2890471 + 46600 2000 -0 7.5952159 7.767847 6.2890498 + 46700 2000 -0 7.5952132 7.7678466 6.2890522 + 46800 2000 -0 7.5952105 7.7678462 6.2890548 + 46900 2000 -0 7.5952078 7.7678457 6.2890576 + 47000 2000 -0 7.5952052 7.767848 6.2890603 + 47100 2000 -0 7.5952028 7.7678445 6.2890629 + 47200 2000 -0 7.5952004 7.7678438 6.2890658 + 47300 2000 -0 7.5951983 7.767843 6.2890684 + 47400 2000 -0 7.5951963 7.7678421 6.289071 + 47500 2000 -0 7.5951945 7.7678412 6.2890739 + 47600 2000 -0 7.5951928 7.7678403 6.2890766 + 47700 2000 -0 7.5951936 7.7678391 6.2890792 + 47800 2000 -0 7.5951902 7.7678383 6.2890813 + 47900 2000 -0 7.5951889 7.7678373 6.2890856 + 48000 2000 -0 7.5951881 7.7678358 6.2890872 + 48100 2000 -0 7.5951873 7.7678344 6.2890892 + 48200 2000 -0 7.595187 7.7678333 6.2890933 + 48300 2000 -0 7.5951866 7.7678318 6.2890956 + 48400 2000 -0 7.5951861 7.7678302 6.2890972 + 48500 2000 -0 7.5951861 7.7678288 6.289101 + 48600 2000 -0 7.5951861 7.7678272 6.289104 + 48700 2000 -0 7.5951858 7.7678254 6.2891058 + 48800 2000 -0 7.5951858 7.7678255 6.2891126 + 48900 2000 -0 7.5951857 7.767822 6.2891123 + 49000 2000 -0 7.5951856 7.7678203 6.2891153 + 49100 2000 -0 7.5951853 7.7678184 6.2891183 + 49200 2000 -0 7.595185 7.7678166 6.289121 + 49300 2000 -0 7.5951845 7.7678149 6.2891242 + 49400 2000 -0 7.595184 7.7678133 6.2891272 + 49500 2000 -0 7.5951831 7.7678116 6.2891298 + 49600 2000 -0 7.5951822 7.7678102 6.2891328 + 49700 2000 -0 7.5951811 7.7678089 6.2891358 + 49800 2000 -0 7.5951797 7.7678076 6.2891384 + 49900 2000 -0 7.5951782 7.7678065 6.2891412 + 50000 2000 -0 7.5951765 7.7678056 6.289144 + 50100 2000 -0 7.5951746 7.7678048 6.2891464 + 50200 2000 -0 7.5951725 7.7678041 6.2891489 + 50300 2000 -0 7.5951703 7.7678035 6.2891515 + 50400 2000 -0 7.5951679 7.767803 6.2891539 + 50500 2000 -0 7.5951653 7.7678025 6.2891563 + 50600 2000 -0 7.5951627 7.7678021 6.2891588 + 50700 2000 -0 7.59516 7.7678018 6.2891612 + 50800 2000 -0 7.5951572 7.7678014 6.2891637 + 50900 2000 -0 7.5951543 7.767801 6.2891662 + 51000 2000 -0 7.5951515 7.7678035 6.2891689 + 51100 2000 -0 7.5951486 7.7678002 6.2891713 + 51200 2000 -0 7.5951459 7.7677995 6.2891739 + 51300 2000 -0 7.5951433 7.7677989 6.2891766 + 51400 2000 -0 7.5951407 7.7677982 6.2891793 + 51500 2000 -0 7.5951383 7.7677975 6.289182 + 51600 2000 -0 7.595136 7.7677966 6.2891847 + 51700 2000 -0 7.5951339 7.7677957 6.2891875 + 51800 2000 -0 7.595132 7.7677948 6.2891902 + 51900 2000 -0 7.5951305 7.7677938 6.289193 + 52000 2000 -0 7.5951299 7.7677923 6.289195 + 52100 2000 -0 7.5951278 7.7677914 6.2891981 + 52200 2000 -0 7.5951262 7.7677905 6.2892017 + 52300 2000 -0 7.5951252 7.767789 6.2892033 + 52400 2000 -0 7.5951244 7.7677876 6.2892055 + 52500 2000 -0 7.595124 7.7677865 6.2892095 + 52600 2000 -0 7.5951234 7.7677849 6.2892116 + 52700 2000 -0 7.5951229 7.7677832 6.2892135 + 52800 2000 -0 7.5951229 7.7677818 6.2892173 + 52900 2000 -0 7.5951227 7.7677801 6.28922 + 53000 2000 -0 7.5951223 7.7677783 6.289222 + 53100 2000 -0 7.5951223 7.7677766 6.2892254 + 53200 2000 -0 7.5951221 7.7677749 6.2892286 + 53300 2000 -0 7.5951218 7.7677731 6.2892308 + 53400 2000 -0 7.5951215 7.7677713 6.289234 + 53500 2000 -0 7.5951213 7.7677724 6.2892375 + 53600 2000 -0 7.5951205 7.7677678 6.2892398 + 53700 2000 -0 7.5951197 7.7677663 6.2892426 + 53800 2000 -0 7.5951189 7.7677649 6.2892459 + 53900 2000 -0 7.5951178 7.7677635 6.2892486 + 54000 2000 -0 7.5951165 7.7677622 6.289251 + 54100 2000 -0 7.5951151 7.7677611 6.289254 + 54200 2000 -0 7.5951135 7.7677602 6.2892567 + 54300 2000 -0 7.5951116 7.7677592 6.2892589 + 54400 2000 -0 7.5951095 7.7677585 6.2892615 + 54500 2000 -0 7.5951073 7.7677579 6.2892641 + 54600 2000 -0 7.5951059 7.7677573 6.2892662 + 54700 2000 -0 7.5951022 7.7677569 6.2892686 + 54800 2000 -0 7.5950995 7.7677565 6.2892711 + 54900 2000 -0 7.5950966 7.7677562 6.2892734 + 55000 2000 -0 7.5950936 7.7677558 6.2892757 + 55100 2000 -0 7.5950906 7.7677555 6.2892782 + 55200 2000 -0 7.5950876 7.7677552 6.2892806 + 55300 2000 -0 7.5950846 7.7677547 6.289283 + 55400 2000 -0 7.5950816 7.7677543 6.2892856 + 55500 2000 -0 7.5950787 7.7677538 6.2892882 + 55600 2000 -0 7.5950758 7.7677532 6.2892907 + 55700 2000 -0 7.5950731 7.7677526 6.2892934 + 55800 2000 -0 7.5950705 7.7677519 6.2892961 + 55900 2000 -0 7.5950681 7.7677511 6.2892987 + 56000 2000 -0 7.5950658 7.7677503 6.2893013 + 56100 2000 -0 7.5950637 7.7677494 6.289304 + 56200 2000 -0 7.5950636 7.7677489 6.2893069 + 56300 2000 -0 7.5950599 7.7677469 6.2893081 + 56400 2000 -0 7.5950591 7.7677461 6.2893121 + 56500 2000 -0 7.5950575 7.7677452 6.2893152 + 56600 2000 -0 7.595056 7.7677438 6.2893165 + 56700 2000 -0 7.5950551 7.7677425 6.2893191 + 56800 2000 -0 7.5950546 7.7677414 6.289323 + 56900 2000 -0 7.5950537 7.7677398 6.2893246 + 57000 2000 -0 7.5950531 7.7677383 6.2893268 + 57100 2000 -0 7.5950528 7.7677369 6.2893306 + 57200 2000 -0 7.5950524 7.7677352 6.289333 + 57300 2000 -0 7.5950519 7.7677334 6.289335 + 57400 2000 -0 7.5950517 7.7677318 6.2893386 + 57500 2000 -0 7.5950513 7.7677302 6.2893415 + 57600 2000 -0 7.5950507 7.7677283 6.2893436 + 57700 2000 -0 7.5950502 7.7677267 6.2893469 + 57800 2000 -0 7.5950496 7.7677251 6.2893501 + 57900 2000 -0 7.5950486 7.7677235 6.2893525 + 58000 2000 -0 7.5950476 7.767722 6.2893554 + 58100 2000 -0 7.5950465 7.7677207 6.2893585 + 58200 2000 -0 7.5950451 7.7677194 6.289361 + 58300 2000 -0 7.5950436 7.7677183 6.2893635 + 58400 2000 -0 7.5950421 7.7677174 6.2893664 + 58500 2000 -0 7.5950402 7.7677166 6.2893688 + 58600 2000 -0 7.5950381 7.7677158 6.289371 + 58700 2000 -0 7.595036 7.7677153 6.2893736 + 58800 2000 -0 7.5950336 7.7677148 6.289376 + 58900 2000 -0 7.595031 7.7677144 6.2893781 + 59000 2000 -0 7.5950283 7.7677141 6.2893804 + 59100 2000 -0 7.5950254 7.7677139 6.2893828 + 59200 2000 -0 7.5950225 7.7677137 6.2893849 + 59300 2000 -0 7.5950194 7.7677135 6.2893872 + 59400 2000 -0 7.5950163 7.7677134 6.2893896 + 59500 2000 -0 7.5950132 7.7677131 6.2893919 + 59600 2000 -0 7.5950101 7.7677129 6.2893942 + 59700 2000 -0 7.595007 7.7677126 6.2893968 + 59800 2000 -0 7.5950047 7.7677123 6.2893992 + 59900 2000 -0 7.5950011 7.7677118 6.2894016 + 60000 2000 -0 7.5949983 7.7677113 6.2894042 + 60100 2000 -0 7.5949956 7.7677107 6.2894068 + 60200 2000 -0 7.5949931 7.7677101 6.2894093 + 60300 2000 -0 7.5949908 7.7677094 6.2894119 + 60400 2000 -0 7.5949886 7.7677087 6.2894145 + 60500 2000 -0 7.5949893 7.7677082 6.2894169 + 60600 2000 -0 7.5949834 7.7677067 6.2894183 + 60700 2000 -0 7.5949837 7.7677058 6.2894226 + 60800 2000 -0 7.5949821 7.767705 6.2894252 + 60900 2000 -0 7.5949805 7.7677038 6.2894264 + 61000 2000 -0 7.5949795 7.7677026 6.2894293 + 61100 2000 -0 7.5949789 7.7677016 6.2894329 + 61200 2000 -0 7.5949779 7.7677001 6.2894343 + 61300 2000 -0 7.5949772 7.7676987 6.2894368 + 61400 2000 -0 7.5949768 7.7676974 6.2894404 + 61500 2000 -0 7.5949762 7.7676959 6.2894425 + 61600 2000 -0 7.5949757 7.7676942 6.2894446 + 61700 2000 -0 7.5949753 7.7676928 6.2894483 + 61800 2000 -0 7.5949748 7.7676912 6.2894509 + 61900 2000 -0 7.5949741 7.7676895 6.289453 + 62000 2000 -0 7.5949735 7.767688 6.2894564 + 62100 2000 -0 7.5949727 7.7676865 6.2894593 + 62200 2000 -0 7.5949717 7.767685 6.2894616 + 62300 2000 -0 7.5949706 7.7676836 6.2894646 + 62400 2000 -0 7.5949694 7.7676824 6.2894676 + 62500 2000 -0 7.5949679 7.7676812 6.2894699 + 62600 2000 -0 7.5949663 7.7676801 6.2894725 + 62700 2000 -0 7.5949645 7.7676792 6.2894754 + 62800 2000 -0 7.5949624 7.7676785 6.2894777 + 62900 2000 -0 7.5949602 7.7676778 6.2894799 + 63000 2000 -0 7.5949578 7.7676773 6.2894825 + 63100 2000 -0 7.5949553 7.7676769 6.2894848 + 63200 2000 -0 7.5949525 7.7676765 6.2894868 + 63300 2000 -0 7.5949496 7.7676763 6.2894892 + 63400 2000 -0 7.5949466 7.7676761 6.2894915 + 63500 2000 -0 7.5949435 7.7676759 6.2894935 + 63600 2000 -0 7.5949404 7.7676757 6.2894957 + 63700 2000 -0 7.5949373 7.7676755 6.2894981 + 63800 2000 -0 7.5949341 7.7676752 6.2895003 + 63900 2000 -0 7.594931 7.7676749 6.2895025 + 64000 2000 -0 7.5949281 7.7676746 6.289505 + 64100 2000 -0 7.5949249 7.7676742 6.2895073 + 64200 2000 -0 7.5949219 7.7676737 6.2895097 + 64300 2000 -0 7.5949191 7.7676731 6.2895122 + 64400 2000 -0 7.5949165 7.7676725 6.2895147 + 64500 2000 -0 7.594914 7.7676718 6.2895171 + 64600 2000 -0 7.5949116 7.7676711 6.2895196 + 64700 2000 -0 7.5949095 7.7676702 6.2895221 + 64800 2000 -0 7.5949105 7.7676688 6.2895247 + 64900 2000 -0 7.5949039 7.767668 6.2895261 + 65000 2000 -0 7.5949041 7.7676665 6.2895306 + 65100 2000 -0 7.5949026 7.7676653 6.2895328 + 65200 2000 -0 7.5949005 7.7676632 6.2895342 + 65300 2000 -0 7.5948956 7.7676549 6.2895391 + 65400 2000 -0 7.5948925 7.7676486 6.2895389 + 65500 2000 -0 7.5948924 7.7676487 6.2895397 + 65600 2000 -0 7.5948923 7.767647 6.289549 + 65700 2000 -0 7.5948909 7.7676452 6.2895471 + 65800 2000 -0 7.5948899 7.7676429 6.289548 + 65900 2000 -0 7.5948899 7.7676418 6.2895556 + 66000 2000 -0 7.5948891 7.7676399 6.2895571 + 66100 2000 -0 7.5948876 7.7676375 6.2895567 + 66200 2000 -0 7.5948874 7.7676361 6.2895627 + 66300 2000 -0 7.5948866 7.7676344 6.2895663 + 66400 2000 -0 7.5948851 7.7676323 6.2895661 + 66500 2000 -0 7.5948842 7.7676308 6.2895704 + 66600 2000 -0 7.5948833 7.7676295 6.2895749 + 66700 2000 -0 7.5948815 7.7676277 6.2895755 + 66800 2000 -0 7.5948799 7.7676263 6.2895782 + 66900 2000 -0 7.5948784 7.7676253 6.2895826 + 67000 2000 -0 7.5948762 7.7676241 6.2895841 + 67100 2000 -0 7.5948739 7.767623 6.2895858 + 67200 2000 -0 7.5948718 7.7676223 6.2895898 + 67300 2000 -0 7.5948692 7.7676216 6.289592 + 67400 2000 -0 7.5948662 7.7676208 6.2895932 + 67500 2000 -0 7.5948635 7.7676203 6.2895964 + 67600 2000 -0 7.5948605 7.7676199 6.2895991 + 67700 2000 -0 7.5948572 7.7676193 6.2896004 + 67800 2000 -0 7.594854 7.767619 6.289603 + 67900 2000 -0 7.5948508 7.7676187 6.2896061 + 68000 2000 -0 7.5948473 7.7676182 6.2896078 + 68100 2000 -0 7.5948438 7.7676178 6.28961 + 68200 2000 -0 7.5948406 7.7676174 6.2896131 + 68300 2000 -0 7.5948372 7.7676168 6.2896153 + 68400 2000 -0 7.5948339 7.7676161 6.2896175 + 68500 2000 -0 7.5948308 7.7676156 6.2896206 + 68600 2000 -0 7.5948278 7.7676148 6.2896232 + 68700 2000 -0 7.5948248 7.767614 6.2896254 + 68800 2000 -0 7.5948221 7.7676131 6.2896283 + 68900 2000 -0 7.5948196 7.7676122 6.2896311 + 69000 2000 -0 7.5948172 7.7676111 6.2896334 + 69100 2000 -0 7.5948182 7.7676099 6.2896363 + 69200 2000 -0 7.5948122 7.7676096 6.2896377 + 69300 2000 -0 7.594811 7.7676081 6.2896421 + 69400 2000 -0 7.5948092 7.767607 6.2896441 + 69500 2000 -0 7.5948073 7.7676059 6.2896459 + 69600 2000 -0 7.5948058 7.7676043 6.2896498 + 69700 2000 -0 7.5948044 7.7676026 6.2896529 + 69800 2000 -0 7.5948029 7.7676005 6.2896547 + 69900 2000 -0 7.5948018 7.7675987 6.2896584 + 70000 2000 -0 7.5948007 7.7675967 6.2896619 + 70100 2000 -0 7.5947995 7.7675945 6.2896642 + 70200 2000 -0 7.5947984 7.7675924 6.2896674 + 70300 2000 -0 7.5947974 7.7675903 6.2896713 + 70400 2000 -0 7.5947962 7.7675881 6.2896739 + 70500 2000 -0 7.594795 7.7675859 6.289677 + 70600 2000 -0 7.5947937 7.7675838 6.2896808 + 70700 2000 -0 7.5947922 7.7675817 6.2896838 + 70800 2000 -0 7.5947906 7.7675796 6.2896868 + 70900 2000 -0 7.5947889 7.7675777 6.2896903 + 71000 2000 -0 7.594787 7.7675758 6.2896935 + 71100 2000 -0 7.5947848 7.7675741 6.2896963 + 71200 2000 -0 7.5947826 7.7675725 6.2896995 + 71300 2000 -0 7.5947801 7.767571 6.2897026 + 71400 2000 -0 7.5947774 7.7675697 6.2897053 + 71500 2000 -0 7.5947745 7.7675684 6.2897081 + 71600 2000 -0 7.5947715 7.7675673 6.2897111 + 71700 2000 -0 7.5947683 7.7675663 6.2897137 + 71800 2000 -0 7.5947648 7.7675654 6.2897162 + 71900 2000 -0 7.5947613 7.7675645 6.2897191 + 72000 2000 -0 7.5947575 7.7675638 6.2897217 + 72100 2000 -0 7.5947535 7.7675631 6.2897242 + 72200 2000 -0 7.5947494 7.7675625 6.289727 + 72300 2000 -0 7.5947453 7.7675618 6.2897298 + 72400 2000 -0 7.594741 7.7675611 6.2897324 + 72500 2000 -0 7.5947368 7.7675604 6.2897352 + 72600 2000 -0 7.5947325 7.7675597 6.2897381 + 72700 2000 -0 7.5947283 7.7675588 6.2897408 + 72800 2000 -0 7.5947242 7.7675578 6.2897437 + 72900 2000 -0 7.5947201 7.7675568 6.2897466 + 73000 2000 -0 7.5947162 7.7675557 6.2897494 + 73100 2000 -0 7.5947122 7.7675546 6.2897523 + 73200 2000 -0 7.5947083 7.7675536 6.2897553 + 73300 2000 -0 7.5947045 7.7675525 6.2897583 + 73400 2000 -0 7.5947035 7.7675515 6.2897613 + 73500 2000 -0 7.5946973 7.767551 6.2897633 + 73600 2000 -0 7.5946939 7.7675499 6.2897681 + 73700 2000 -0 7.5946909 7.7675487 6.2897703 + 73800 2000 -0 7.5946877 7.7675475 6.2897725 + 73900 2000 -0 7.5946849 7.7675465 6.2897768 + 74000 2000 -0 7.5946821 7.7675453 6.2897798 + 74100 2000 -0 7.5946792 7.7675439 6.2897817 + 74200 2000 -0 7.5946768 7.7675427 6.2897857 + 74300 2000 -0 7.5946742 7.7675414 6.2897892 + 74400 2000 -0 7.5946714 7.7675399 6.2897916 + 74500 2000 -0 7.5946688 7.7675385 6.2897951 + 74600 2000 -0 7.5946662 7.7675371 6.2897992 + 74700 2000 -0 7.5946634 7.7675355 6.2898019 + 74800 2000 -0 7.5946605 7.7675341 6.2898052 + 74900 2000 -0 7.5946577 7.7675328 6.2898092 + 75000 2000 -0 7.5946545 7.7675314 6.2898123 + 75100 2000 -0 7.5946512 7.76753 6.2898154 + 75200 2000 -0 7.5946478 7.7675289 6.2898193 + 75300 2000 -0 7.5946442 7.7675278 6.2898225 + 75400 2000 -0 7.5946403 7.7675268 6.2898255 + 75500 2000 -0 7.5946363 7.767526 6.2898289 + 75600 2000 -0 7.5946321 7.7675253 6.2898322 + 75700 2000 -0 7.5946277 7.7675247 6.2898349 + 75800 2000 -0 7.594623 7.7675243 6.2898379 + 75900 2000 -0 7.5946182 7.767524 6.289841 + 76000 2000 -0 7.5946184 7.7675222 6.2898477 + 76100 2000 -0 7.5946168 7.7675198 6.2898534 + 76200 2000 -0 7.5946059 7.7675208 6.2898537 + 76300 2000 -0 7.5945934 7.7675229 6.2898545 + 76400 2000 -0 7.5945858 7.7675222 6.2898578 + 76500 2000 -0 7.594578 7.7675215 6.2898604 + 76600 2000 -0 7.5945704 7.767521 6.289865 + 76700 2000 -0 7.5945627 7.7675205 6.2898692 + 76800 2000 -0 7.5945548 7.7675198 6.2898721 + 76900 2000 -0 7.5945472 7.7675191 6.2898763 + 77000 2000 -0 7.5945397 7.7675184 6.2898809 + 77100 2000 -0 7.5945321 7.7675175 6.2898842 + 77200 2000 -0 7.5945247 7.7675166 6.289888 + 77300 2000 -0 7.5945177 7.7675156 6.2898926 + 77400 2000 -0 7.5945106 7.7675145 6.2898964 + 77500 2000 -0 7.5945037 7.7675133 6.2899 + 77600 2000 -0 7.5944972 7.7675122 6.2899045 + 77700 2000 -0 7.5944924 7.7675106 6.2899081 + 77800 2000 -0 7.5944847 7.7675094 6.2899116 + 77900 2000 -0 7.5944783 7.7675083 6.2899171 + 78000 2000 -0 7.5944725 7.7675065 6.2899202 + 78100 2000 -0 7.5944668 7.7675048 6.2899232 + 78200 2000 -0 7.5944616 7.7675034 6.2899286 + 78300 2000 -0 7.5944563 7.7675016 6.2899324 + 78400 2000 -0 7.5944509 7.7674996 6.2899353 + 78500 2000 -0 7.594446 7.7674978 6.2899402 + 78600 2000 -0 7.5944411 7.7674959 6.2899446 + 78700 2000 -0 7.594436 7.7674938 6.2899477 + 78800 2000 -0 7.5944312 7.7674918 6.2899523 + 78900 2000 -0 7.5944263 7.7674898 6.2899571 + 79000 2000 -0 7.5944211 7.7674876 6.2899606 + 79100 2000 -0 7.594416 7.7674855 6.2899649 + 79200 2000 -0 7.5944109 7.7674835 6.2899697 + 79300 2000 -0 7.5944055 7.7674815 6.2899736 + 79400 2000 -0 7.5944 7.7674795 6.2899776 + 79500 2000 -0 7.5943944 7.7674777 6.2899823 + 79600 2000 -0 7.5943887 7.767476 6.2899864 + 79700 2000 -0 7.5943826 7.7674743 6.2899902 + 79800 2000 -0 7.5943766 7.7674728 6.2899944 + 79900 2000 -0 7.5943703 7.7674715 6.2899985 + 80000 2000 -0 7.5943639 7.7674702 6.2900021 + 80100 2000 -0 7.5943573 7.7674691 6.290006 + 80200 2000 -0 7.5943506 7.7674681 6.2900099 + 80300 2000 -0 7.5943437 7.7674671 6.2900134 + 80400 2000 -0 7.5943367 7.7674662 6.2900171 + 80500 2000 -0 7.5943296 7.7674655 6.2900209 + 80600 2000 -0 7.5943224 7.7674647 6.2900245 + 80700 2000 -0 7.5943151 7.7674639 6.2900281 + 80800 2000 -0 7.5943077 7.7674632 6.290032 + 80900 2000 -0 7.5943001 7.7674623 6.290036 + 81000 2000 -0 7.5942925 7.7674614 6.2900398 + 81100 2000 -0 7.594285 7.7674604 6.2900439 + 81200 2000 -0 7.5942776 7.7674594 6.290048 + 81300 2000 -0 7.5942702 7.7674582 6.290052 + 81400 2000 -0 7.594263 7.767457 6.2900562 + 81500 2000 -0 7.594256 7.7674558 6.2900604 + 81600 2000 -0 7.5942491 7.7674544 6.2900645 + 81700 2000 -0 7.5942424 7.767453 6.2900686 + 81800 2000 -0 7.5942359 7.7674515 6.2900729 + 81900 2000 -0 7.5942312 7.7674504 6.2900799 + 82000 2000 -0 7.5942237 7.7674478 6.29008 + 82100 2000 -0 7.5942182 7.7674465 6.2900859 + 82200 2000 -0 7.5942121 7.767445 6.2900901 + 82300 2000 -0 7.5942063 7.7674429 6.2900926 + 82400 2000 -0 7.5942013 7.7674409 6.2900972 + 82500 2000 -0 7.5941965 7.7674392 6.2901025 + 82600 2000 -0 7.5941914 7.7674369 6.2901052 + 82700 2000 -0 7.5941866 7.7674347 6.2901091 + 82800 2000 -0 7.5941822 7.7674326 6.2901146 + 82900 2000 -0 7.5941776 7.7674302 6.2901181 + 83000 2000 -0 7.5941729 7.7674277 6.2901216 + 83100 2000 -0 7.5941686 7.7674254 6.2901269 + 83200 2000 -0 7.5941641 7.767423 6.2901311 + 83300 2000 -0 7.5941594 7.7674205 6.2901346 + 83400 2000 -0 7.5941549 7.7674181 6.2901396 + 83500 2000 -0 7.5941502 7.7674158 6.2901442 + 83600 2000 -0 7.5941452 7.7674133 6.2901479 + 83700 2000 -0 7.5941402 7.7674111 6.2901524 + 83800 2000 -0 7.5941351 7.7674089 6.2901572 + 83900 2000 -0 7.5941297 7.7674068 6.290161 + 84000 2000 -0 7.5941242 7.7674048 6.290165 + 84100 2000 -0 7.5941186 7.767403 6.2901696 + 84200 2000 -0 7.5941126 7.7674013 6.2901734 + 84300 2000 -0 7.5941065 7.7673997 6.2901771 + 84400 2000 -0 7.5941003 7.7673983 6.2901814 + 84500 2000 -0 7.5940939 7.767397 6.2901852 + 84600 2000 -0 7.5940872 7.7673957 6.2901888 + 84700 2000 -0 7.5940805 7.7673944 6.2901928 + 84800 2000 -0 7.5940737 7.7673931 6.2901967 + 84900 2000 -0 7.5940667 7.7673918 6.2902004 + 85000 2000 -0 7.5940597 7.7673906 6.2902042 + 85100 2000 -0 7.5940526 7.7673893 6.2902083 + 85200 2000 -0 7.5940454 7.767388 6.2902121 + 85300 2000 -0 7.5940382 7.7673867 6.290216 + 85400 2000 -0 7.5940312 7.7673853 6.2902202 + 85500 2000 -0 7.5940241 7.7673839 6.2902243 + 85600 2000 -0 7.5940172 7.7673823 6.2902282 + 85700 2000 -0 7.5940104 7.7673808 6.2902325 + 85800 2000 -0 7.5940037 7.7673791 6.2902367 + 85900 2000 -0 7.5939971 7.7673773 6.2902409 + 86000 2000 -0 7.5939906 7.7673755 6.2902452 + 86100 2000 -0 7.5939844 7.7673736 6.2902496 + 86200 2000 -0 7.5939805 7.7673722 6.2902539 + 86300 2000 -0 7.5939717 7.7673693 6.2902569 + 86400 2000 -0 7.5939672 7.7673674 6.2902627 + 86500 2000 -0 7.5939615 7.7673655 6.2902672 + 86600 2000 -0 7.5939558 7.7673632 6.2902702 + 86700 2000 -0 7.5939508 7.7673608 6.2902746 + 86800 2000 -0 7.5939461 7.7673587 6.2902801 + 86900 2000 -0 7.5939411 7.7673561 6.2902832 + 87000 2000 -0 7.5939363 7.7673536 6.2902873 + 87100 2000 -0 7.5939319 7.7673513 6.2902927 + 87200 2000 -0 7.5939273 7.7673486 6.2902967 + 87300 2000 -0 7.5939223 7.7673461 6.2903004 + 87400 2000 -0 7.5939183 7.7673434 6.2903057 + 87500 2000 -0 7.5939138 7.7673407 6.2903103 + 87600 2000 -0 7.5939091 7.7673378 6.2903141 + 87700 2000 -0 7.5939045 7.7673352 6.2903191 + 87800 2000 -0 7.5938997 7.7673326 6.290324 + 87900 2000 -0 7.5938947 7.76733 6.2903281 + 88000 2000 -0 7.5938896 7.7673275 6.2903326 + 88100 2000 -0 7.5938843 7.7673252 6.2903375 + 88200 2000 -0 7.5938785 7.767323 6.2903417 + 88300 2000 -0 7.5938726 7.767321 6.2903459 + 88400 2000 -0 7.5938666 7.7673191 6.2903505 + 88500 2000 -0 7.5938603 7.7673174 6.2903546 + 88600 2000 -0 7.5938538 7.7673157 6.2903585 + 88700 2000 -0 7.5938471 7.7673142 6.2903628 + 88800 2000 -0 7.5938403 7.7673128 6.290367 + 88900 2000 -0 7.5938333 7.7673115 6.2903707 + 89000 2000 -0 7.5938261 7.7673103 6.2903748 + 89100 2000 -0 7.5938189 7.7673091 6.2903789 + 89200 2000 -0 7.5938115 7.7673079 6.2903827 + 89300 2000 -0 7.593804 7.7673068 6.2903867 + 89400 2000 -0 7.5937967 7.7673056 6.2903909 + 89500 2000 -0 7.5937891 7.7673045 6.290395 + 89600 2000 -0 7.5937814 7.7673033 6.2903989 + 89700 2000 -0 7.593774 7.7673021 6.2904033 + 89800 2000 -0 7.5937665 7.7673008 6.2904075 + 89900 2000 -0 7.5937592 7.7672994 6.2904116 + 90000 2000 -0 7.593752 7.7672979 6.2904159 + 90100 2000 -0 7.5937449 7.7672964 6.2904203 + 90200 2000 -0 7.593738 7.7672948 6.2904245 + 90300 2000 -0 7.5937313 7.7672931 6.2904288 + 90400 2000 -0 7.5937247 7.7672914 6.2904332 + 90500 2000 -0 7.5937212 7.7672898 6.2904372 + 90600 2000 -0 7.5937109 7.7672874 6.2904407 + 90700 2000 -0 7.5937069 7.7672852 6.2904466 + 90800 2000 -0 7.5937012 7.7672832 6.2904508 + 90900 2000 -0 7.5936954 7.7672808 6.2904539 + 91000 2000 -0 7.5936902 7.7672783 6.2904586 + 91100 2000 -0 7.5936853 7.7672761 6.2904639 + 91200 2000 -0 7.5936801 7.7672734 6.290467 + 91300 2000 -0 7.5936753 7.7672708 6.2904714 + 91400 2000 -0 7.5936707 7.7672683 6.2904767 + 91500 2000 -0 7.5936659 7.7672655 6.2904805 + 91600 2000 -0 7.5936611 7.7672627 6.2904845 + 91700 2000 -0 7.5936566 7.76726 6.2904899 + 91800 2000 -0 7.5936518 7.7672571 6.2904943 + 91900 2000 -0 7.5936469 7.7672543 6.2904983 + 92000 2000 -0 7.5936421 7.7672515 6.2905034 + 92100 2000 -0 7.5936371 7.7672488 6.2905081 + 92200 2000 -0 7.5936318 7.7672461 6.2905122 + 92300 2000 -0 7.5936265 7.7672435 6.290517 + 92400 2000 -0 7.5936211 7.767241 6.2905217 + 92500 2000 -0 7.5936154 7.7672386 6.2905258 + 92600 2000 -0 7.5936095 7.7672363 6.2905302 + 92700 2000 -0 7.5936035 7.7672343 6.2905348 + 92800 2000 -0 7.5935971 7.7672324 6.2905388 + 92900 2000 -0 7.5935906 7.7672307 6.2905428 + 93000 2000 -0 7.5935838 7.7672293 6.2905471 + 93100 2000 -0 7.5935769 7.7672279 6.2905511 + 93200 2000 -0 7.5935698 7.7672265 6.2905549 + 93300 2000 -0 7.5935625 7.7672254 6.290559 + 93400 2000 -0 7.5935551 7.7672242 6.290563 + 93500 2000 -0 7.5935476 7.7672231 6.2905668 + 93600 2000 -0 7.5935401 7.7672219 6.2905708 + 93700 2000 -0 7.5935325 7.7672208 6.290575 + 93800 2000 -0 7.5935248 7.7672196 6.2905789 + 93900 2000 -0 7.5935172 7.7672184 6.290583 + 94000 2000 -0 7.5935097 7.767217 6.2905873 + 94100 2000 -0 7.5935023 7.7672156 6.2905915 + 94200 2000 -0 7.593495 7.767214 6.2905957 + 94300 2000 -0 7.5934878 7.7672123 6.2906 + 94400 2000 -0 7.5934808 7.7672106 6.2906044 + 94500 2000 -0 7.593474 7.7672087 6.2906086 + 94600 2000 -0 7.5934675 7.7672069 6.290613 + 94700 2000 -0 7.5934609 7.7672048 6.2906173 + 94800 2000 -0 7.5934577 7.7672024 6.2906217 + 94900 2000 -0 7.5934471 7.767201 6.2906246 + 95000 2000 -0 7.5934428 7.7671984 6.2906309 + 95100 2000 -0 7.5934372 7.7671962 6.2906347 + 95200 2000 -0 7.5934313 7.7671938 6.2906378 + 95300 2000 -0 7.5934261 7.7671914 6.290643 + 95400 2000 -0 7.5934211 7.7671891 6.2906478 + 95500 2000 -0 7.5934157 7.7671863 6.2906508 + 95600 2000 -0 7.5934109 7.7671838 6.2906556 + 95700 2000 -0 7.5934061 7.7671813 6.2906607 + 95800 2000 -0 7.5934012 7.7671785 6.2906643 + 95900 2000 -0 7.5933963 7.7671757 6.2906686 + 96000 2000 -0 7.5933917 7.767173 6.2906739 + 96100 2000 -0 7.5933867 7.7671702 6.290678 + 96200 2000 -0 7.5933817 7.7671673 6.2906822 + 96300 2000 -0 7.5933768 7.7671646 6.2906873 + 96400 2000 -0 7.5933716 7.7671619 6.2906918 + 96500 2000 -0 7.5933663 7.7671592 6.2906959 + 96600 2000 -0 7.5933609 7.7671567 6.2907008 + 96700 2000 -0 7.5933553 7.7671542 6.2907054 + 96800 2000 -0 7.5933494 7.7671518 6.2907095 + 96900 2000 -0 7.5933434 7.7671496 6.2907139 + 97000 2000 -0 7.5933372 7.7671476 6.2907184 + 97100 2000 -0 7.5933308 7.7671456 6.2907224 + 97200 2000 -0 7.5933242 7.7671437 6.2907265 + 97300 2000 -0 7.5933174 7.7671421 6.2907308 + 97400 2000 -0 7.5933105 7.7671404 6.2907348 + 97500 2000 -0 7.5933033 7.7671389 6.2907386 + 97600 2000 -0 7.5932961 7.7671375 6.2907428 + 97700 2000 -0 7.5932888 7.7671359 6.2907468 + 97800 2000 -0 7.5932813 7.7671343 6.2907507 + 97900 2000 -0 7.5932739 7.7671327 6.2907548 + 98000 2000 -0 7.5932664 7.7671312 6.290759 + 98100 2000 -0 7.5932588 7.7671296 6.290763 + 98200 2000 -0 7.5932513 7.7671279 6.2907672 + 98300 2000 -0 7.5932438 7.7671262 6.2907715 + 98400 2000 -0 7.5932364 7.7671245 6.2907757 + 98500 2000 -0 7.5932291 7.7671226 6.2907799 + 98600 2000 -0 7.5932219 7.7671208 6.2907843 + 98700 2000 -0 7.5932149 7.7671188 6.2907886 + 98800 2000 -0 7.593208 7.7671167 6.2907928 + 98900 2000 -0 7.5932013 7.7671147 6.2907972 + 99000 2000 -0 7.5931948 7.7671125 6.2908015 + 99100 2000 -0 7.5931916 7.7671102 6.2908061 + 99200 2000 -0 7.5931818 7.7671085 6.2908089 + 99300 2000 -0 7.5931764 7.7671057 6.2908152 + 99400 2000 -0 7.5931708 7.7671032 6.2908188 + 99500 2000 -0 7.593165 7.7671007 6.290822 + 99600 2000 -0 7.5931598 7.7670982 6.2908274 + 99700 2000 -0 7.5931546 7.7670957 6.2908319 + 99800 2000 -0 7.5931492 7.7670928 6.2908349 + 99900 2000 -0 7.5931443 7.7670902 6.29084 + 100000 2000 -0 7.5931395 7.7670875 6.2908449 +Loop time of 28.4684 on 4 procs for 100000 steps with 2000 atoms + +Performance: 303494.659 tau/day, 3512.670 timesteps/s, 7.025 Matom-step/s +96.7% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 14.471 | 15.426 | 16.874 | 24.3 | 54.19 +Neigh | 0.50185 | 0.52867 | 0.55379 | 3.1 | 1.86 +Comm | 5.277 | 6.8933 | 7.8956 | 40.4 | 24.21 +Output | 0.019683 | 0.022775 | 0.031664 | 3.4 | 0.08 +Modify | 4.7145 | 4.8537 | 5.0111 | 6.1 | 17.05 +Other | | 0.7439 | | | 2.61 + +Nlocal: 500 ave 504 max 496 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 545.75 ave 553 max 538 min +Histogram: 1 0 0 0 1 0 1 0 0 1 +Neighs: 2409.75 ave 2523 max 2343 min +Histogram: 1 1 0 1 0 0 0 0 0 1 + +Total # of neighbors = 9639 +Ave neighs/atom = 4.8195 +Neighbor list builds = 3151 +Dangerous builds = 0 + +Total wall time: 0:00:28 diff --git a/examples/granular/log.29Oct20.pour.drum.g++.1 b/examples/granular/log.29Oct20.pour.drum.g++.1 deleted file mode 100644 index 8c4b828488..0000000000 --- a/examples/granular/log.29Oct20.pour.drum.g++.1 +++ /dev/null @@ -1,271 +0,0 @@ -LAMMPS (29 Oct 2020) - using 1 OpenMP thread(s) per MPI task -# pour two types of particles (cohesive and non-cohesive) into cylinder -# 'turn' cylinder by changing direction of gravity, then rotate it. -# This simulates a rotating drum powder characterization experiment. - -variable name string rotating_drum_two_types - -atom_style sphere -units lj - -############################################### -# Geometry-related parameters -############################################### - -variable boxx equal 30 -variable boxy equal 30 -variable boxz equal 50 - -variable drum_rad equal ${boxx}*0.5 -variable drum_rad equal 30*0.5 -variable drum_height equal 20 - -variable xc equal 0.5*${boxx} -variable xc equal 0.5*30 -variable yc equal 0.5*${boxx} -variable yc equal 0.5*30 -variable zc equal 0.5*${boxz} -variable zc equal 0.5*50 - -############################################### -# Particle-related parameters -############################################### -variable rlo equal 0.25 -variable rhi equal 0.5 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.25 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.5 - -variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} -variable cyl_rad_inner equal 15-1.1*${rhi} -variable cyl_rad_inner equal 15-1.1*0.5 - -variable dens equal 1.0 - -variable skin equal 0.4*${rhi} -variable skin equal 0.4*0.5 - -############# -processors * * 1 -region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} -region boxreg block 0 30 0 ${boxy} 0 ${boxz} -region boxreg block 0 30 0 30 0 ${boxz} -region boxreg block 0 30 0 30 0 50 -create_box 2 boxreg -Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (30.000000 30.000000 50.000000) - 1 by 1 by 1 MPI processor grid -change_box all boundary p p f -Changing box ... - -pair_style granular -pair_coeff 1 * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji -pair_coeff 2 2 jkr 1e5 0.1 0.3 50 tangential mindlin NULL 1.0 0.5 rolling sds 1e3 1e3 0.1 twisting marshall damping tsuji - -variable theta equal 0 - -region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 15 0 0 0 1 -region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region bottom_wall plane 15 ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 ${yc} 0 0 0 1 -region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 15 0 0 0 1 - -region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} -region insreg cylinder z 15 ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} -region insreg cylinder z 15 15 ${cyl_rad_inner} ${drum_height} ${boxz} -region insreg cylinder z 15 15 14.45 ${drum_height} ${boxz} -region insreg cylinder z 15 15 14.45 20 ${boxz} -region insreg cylinder z 15 15 14.45 20 50 - -fix 0 all balance 100 1.0 shift xy 5 1.1 -fix 1 all nve/sphere -fix grav all gravity 10 vector 0 0 -1 -fix ins1 all pour 2000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 1 -Particle insertion: 9396 every 490 steps, 2000 by step 1 -fix ins2 all pour 2000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 1 -Particle insertion: 9396 every 490 steps, 2000 by step 1 - -comm_modify vel yes - -neighbor ${skin} bin -neighbor 0.2 bin -neigh_modify delay 0 every 1 check yes - -fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall -fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region bottom_wall - -thermo_style custom step atoms ke v_theta -thermo_modify lost warn -thermo 100 - -timestep 0.001 - -#dump 1 all custom 100 ${name}.dump id type radius mass x y z - -#For removal later -compute 1 all property/atom radius -variable zmax atom z+c_1>0.5*${drum_height} -variable zmax atom z+c_1>0.5*20 -group delgroup dynamic all var zmax every 10000 -dynamic group delgroup defined - -run 2000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.2 - ghost atom cutoff = 1.2 - binsize = 0.6, bins = 50 50 84 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair granular, perpetual - attributes: half, newton on, size, history - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 13.03 | 13.03 | 13.03 Mbytes -Step Atoms KinEng v_theta - 0 0 -0 0 - 100 4000 -0 0 - 200 4000 -0 0 - 300 4000 -0 0 - 400 4000 -0 0 - 500 4000 -0 0 - 600 4000 -0 0 - 700 4000 -0 0 - 800 4000 -0 0 - 900 4000 -0 0 - 1000 4000 -0 0 - 1100 4000 -0 0 - 1200 4000 -0 0 - 1300 4000 -0 0 - 1400 4000 -0 0 - 1500 4000 -0 0 - 1600 4000 -0 0 - 1700 4000 -0 0 - 1800 4000 -0 0 - 1900 4000 -0 0 - 2000 4000 -0 0 -Loop time of 10.5178 on 1 procs for 2000 steps with 4000 atoms - -Performance: 16429.309 tau/day, 190.154 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.0701 | 1.0701 | 1.0701 | 0.0 | 10.17 -Neigh | 4.2135 | 4.2135 | 4.2135 | 0.0 | 40.06 -Comm | 0.38276 | 0.38276 | 0.38276 | 0.0 | 3.64 -Output | 0.0013647 | 0.0013647 | 0.0013647 | 0.0 | 0.01 -Modify | 4.7076 | 4.7076 | 4.7076 | 0.0 | 44.76 -Other | | 0.1424 | | | 1.35 - -Nlocal: 4000.00 ave 4000 max 4000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 171.000 ave 171 max 171 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 8093.00 ave 8093 max 8093 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 8093 -Ave neighs/atom = 2.0232500 -Neighbor list builds = 1004 -Dangerous builds = 4 - -#Remove any particles that are above z > 0.5*drum_height -delete_atoms group delgroup -Deleted 0 atoms, new total = 4000 - -#Add top lid -region top_wall plane ${xc} ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 15 ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 ${yc} 0 0 0 1 -region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 15 0 0 0 1 -fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region top_wall - -# 'Turn' drum by switching the direction of gravity -unfix grav -unfix ins1 -unfix ins2 -fix grav all gravity 10 vector 0 -1 0 - -variable theta equal 2*PI*elapsed/20000.0 -run 3000 -Per MPI rank memory allocation (min/avg/max) = 19.37 | 19.37 | 19.37 Mbytes -Step Atoms KinEng v_theta - 2000 4000 65.647582 0 - 2100 4000 105.60001 0.031415927 - 2200 4000 112.27573 0.062831853 - 2300 4000 92.758671 0.09424778 - 2400 4000 88.925835 0.12566371 - 2500 4000 81.369163 0.15707963 - 2600 4000 32.046943 0.18849556 - 2700 4000 4.1926368 0.21991149 - 2800 4000 3.9933453 0.25132741 - 2900 4000 4.5062193 0.28274334 - 3000 4000 5.3409521 0.31415927 - 3100 4000 6.0165991 0.34557519 - 3200 4000 6.606767 0.37699112 - 3300 4000 7.3997751 0.40840704 - 3400 4000 8.1098807 0.43982297 - 3500 4000 8.6552424 0.4712389 - 3600 4000 9.8445204 0.50265482 - 3700 4000 10.098753 0.53407075 - 3800 4000 10.039489 0.56548668 - 3900 4000 9.6376278 0.5969026 - 4000 4000 9.2598836 0.62831853 - 4100 4000 8.7116037 0.65973446 - 4200 4000 8.1274117 0.69115038 - 4300 4000 7.1487627 0.72256631 - 4400 4000 6.2253778 0.75398224 - 4500 4000 5.3061398 0.78539816 - 4600 4000 4.4319316 0.81681409 - 4700 4000 4.205607 0.84823002 - 4800 4000 3.2112987 0.87964594 - 4900 4000 2.6449777 0.91106187 - 5000 4000 2.3475497 0.9424778 -Loop time of 32.4926 on 1 procs for 3000 steps with 4000 atoms - -Performance: 7977.205 tau/day, 92.329 timesteps/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 8.0124 | 8.0124 | 8.0124 | 0.0 | 24.66 -Neigh | 10.993 | 10.993 | 10.993 | 0.0 | 33.83 -Comm | 0.86697 | 0.86697 | 0.86697 | 0.0 | 2.67 -Output | 0.0021827 | 0.0021827 | 0.0021827 | 0.0 | 0.01 -Modify | 12.367 | 12.367 | 12.367 | 0.0 | 38.06 -Other | | 0.2515 | | | 0.77 - -Nlocal: 4000.00 ave 4000 max 4000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 318.000 ave 318 max 318 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 14807.0 ave 14807 max 14807 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 14807 -Ave neighs/atom = 3.7017500 -Neighbor list builds = 2189 -Dangerous builds = 1536 -Total wall time: 0:00:43 diff --git a/examples/granular/log.29Oct20.pour.drum.g++.4 b/examples/granular/log.29Oct20.pour.drum.g++.4 deleted file mode 100644 index e53da50b9b..0000000000 --- a/examples/granular/log.29Oct20.pour.drum.g++.4 +++ /dev/null @@ -1,271 +0,0 @@ -LAMMPS (29 Oct 2020) - using 1 OpenMP thread(s) per MPI task -# pour two types of particles (cohesive and non-cohesive) into cylinder -# 'turn' cylinder by changing direction of gravity, then rotate it. -# This simulates a rotating drum powder characterization experiment. - -variable name string rotating_drum_two_types - -atom_style sphere -units lj - -############################################### -# Geometry-related parameters -############################################### - -variable boxx equal 30 -variable boxy equal 30 -variable boxz equal 50 - -variable drum_rad equal ${boxx}*0.5 -variable drum_rad equal 30*0.5 -variable drum_height equal 20 - -variable xc equal 0.5*${boxx} -variable xc equal 0.5*30 -variable yc equal 0.5*${boxx} -variable yc equal 0.5*30 -variable zc equal 0.5*${boxz} -variable zc equal 0.5*50 - -############################################### -# Particle-related parameters -############################################### -variable rlo equal 0.25 -variable rhi equal 0.5 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.25 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.5 - -variable cyl_rad_inner equal ${drum_rad}-1.1*${rhi} -variable cyl_rad_inner equal 15-1.1*${rhi} -variable cyl_rad_inner equal 15-1.1*0.5 - -variable dens equal 1.0 - -variable skin equal 0.4*${rhi} -variable skin equal 0.4*0.5 - -############# -processors * * 1 -region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} -region boxreg block 0 30 0 ${boxy} 0 ${boxz} -region boxreg block 0 30 0 30 0 ${boxz} -region boxreg block 0 30 0 30 0 50 -create_box 2 boxreg -Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (30.000000 30.000000 50.000000) - 2 by 2 by 1 MPI processor grid -change_box all boundary p p f -Changing box ... - -pair_style granular -pair_coeff 1 * hertz/material 1e5 0.2 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji -pair_coeff 2 2 jkr 1e5 0.1 0.3 50 tangential mindlin NULL 1.0 0.5 rolling sds 1e3 1e3 0.1 twisting marshall damping tsuji - -variable theta equal 0 - -region curved_wall cylinder z ${xc} ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 ${yc} ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 ${drum_rad} 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 ${drum_height} side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 ${yc} 0 0 0 1 -region curved_wall cylinder z 15 15 15 0 20 side in rotate v_theta 15 15 0 0 0 1 -region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region bottom_wall plane 15 ${yc} 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 ${yc} 0 0 0 1 -region bottom_wall plane 15 15 0 0 0 1 side in rotate v_theta 15 15 0 0 0 1 - -region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} -region insreg cylinder z 15 ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} -region insreg cylinder z 15 15 ${cyl_rad_inner} ${drum_height} ${boxz} -region insreg cylinder z 15 15 14.45 ${drum_height} ${boxz} -region insreg cylinder z 15 15 14.45 20 ${boxz} -region insreg cylinder z 15 15 14.45 20 50 - -fix 0 all balance 100 1.0 shift xy 5 1.1 -fix 1 all nve/sphere -fix grav all gravity 10 vector 0 0 -1 -fix ins1 all pour 2000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 ${dens} -fix ins1 all pour 2000 1 1234 region insreg diam range 0.5 1 dens 1 1 -Particle insertion: 9396 every 490 steps, 2000 by step 1 -fix ins2 all pour 2000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens ${dens} ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 ${dens} -fix ins2 all pour 2000 2 1234 region insreg diam range 0.5 1 dens 1 1 -Particle insertion: 9396 every 490 steps, 2000 by step 1 - -comm_modify vel yes - -neighbor ${skin} bin -neighbor 0.2 bin -neigh_modify delay 0 every 1 check yes - -fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall -fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region bottom_wall - -thermo_style custom step atoms ke v_theta -thermo_modify lost warn -thermo 100 - -timestep 0.001 - -#dump 1 all custom 100 ${name}.dump id type radius mass x y z - -#For removal later -compute 1 all property/atom radius -variable zmax atom z+c_1>0.5*${drum_height} -variable zmax atom z+c_1>0.5*20 -group delgroup dynamic all var zmax every 10000 -dynamic group delgroup defined - -run 2000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.2 - ghost atom cutoff = 1.2 - binsize = 0.6, bins = 50 50 84 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair granular, perpetual - attributes: half, newton on, size, history - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 12.25 | 12.25 | 12.25 Mbytes -Step Atoms KinEng v_theta - 0 0 -0 0 - 100 4000 -0 0 - 200 4000 -0 0 - 300 4000 -0 0 - 400 4000 -0 0 - 500 4000 -0 0 - 600 4000 -0 0 - 700 4000 -0 0 - 800 4000 -0 0 - 900 4000 -0 0 - 1000 4000 -0 0 - 1100 4000 -0 0 - 1200 4000 -0 0 - 1300 4000 -0 0 - 1400 4000 -0 0 - 1500 4000 -0 0 - 1600 4000 -0 0 - 1700 4000 -0 0 - 1800 4000 -0 0 - 1900 4000 -0 0 - 2000 4000 -0 0 -Loop time of 3.86825 on 4 procs for 2000 steps with 4000 atoms - -Performance: 44671.398 tau/day, 517.030 timesteps/s -96.7% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.26114 | 0.27918 | 0.28728 | 2.0 | 7.22 -Neigh | 1.2044 | 1.2414 | 1.3105 | 3.7 | 32.09 -Comm | 0.38592 | 0.47065 | 0.51052 | 7.4 | 12.17 -Output | 0.0007236 | 0.0013456 | 0.0024846 | 1.8 | 0.03 -Modify | 1.6217 | 1.6723 | 1.7801 | 5.0 | 43.23 -Other | | 0.2034 | | | 5.26 - -Nlocal: 1000.00 ave 1012 max 988 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Nghost: 269.250 ave 278 max 256 min -Histogram: 1 0 0 0 0 0 1 1 0 1 -Neighs: 2060.50 ave 2156 max 1921 min -Histogram: 1 0 0 1 0 0 0 0 0 2 - -Total # of neighbors = 8242 -Ave neighs/atom = 2.0605000 -Neighbor list builds = 1004 -Dangerous builds = 4 - -#Remove any particles that are above z > 0.5*drum_height -delete_atoms group delgroup -Deleted 0 atoms, new total = 4000 - -#Add top lid -region top_wall plane ${xc} ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 ${yc} ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 15 ${drum_height} 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta ${xc} ${yc} 0 0 0 1 -region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 ${yc} 0 0 0 1 -region top_wall plane 15 15 20 0 0 -1 side in rotate v_theta 15 15 0 0 0 1 -fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region top_wall - -# 'Turn' drum by switching the direction of gravity -unfix grav -unfix ins1 -unfix ins2 -fix grav all gravity 10 vector 0 -1 0 - -variable theta equal 2*PI*elapsed/20000.0 -run 3000 -Per MPI rank memory allocation (min/avg/max) = 18.55 | 18.55 | 18.55 Mbytes -Step Atoms KinEng v_theta - 2000 4000 65.819213 0 - 2100 4000 105.02389 0.031415927 - 2200 4000 112.02469 0.062831853 - 2300 4000 92.271262 0.09424778 - 2400 4000 89.369506 0.12566371 - 2500 4000 80.910925 0.15707963 - 2600 4000 31.620722 0.18849556 - 2700 4000 4.3019937 0.21991149 - 2800 4000 3.9913967 0.25132741 - 2900 4000 4.5203726 0.28274334 - 3000 4000 5.484886 0.31415927 - 3100 4000 6.1085958 0.34557519 - 3200 4000 6.7085635 0.37699112 - 3300 4000 7.4787777 0.40840704 - 3400 4000 8.2116413 0.43982297 - 3500 4000 8.7979302 0.4712389 - 3600 4000 9.871649 0.50265482 - 3700 4000 10.012426 0.53407075 - 3800 4000 9.9067754 0.56548668 - 3900 4000 9.725458 0.5969026 - 4000 4000 9.3350056 0.62831853 - 4100 4000 8.8337295 0.65973446 - 4200 4000 8.2712493 0.69115038 - 4300 4000 6.9609934 0.72256631 - 4400 4000 6.0120294 0.75398224 - 4500 4000 5.0490036 0.78539816 - 4600 4000 4.2796544 0.81681409 - 4700 4000 4.1736483 0.84823002 - 4800 4000 3.0860106 0.87964594 - 4900 4000 2.6670909 0.91106187 - 5000 4000 2.2901814 0.9424778 -Loop time of 10.7627 on 4 procs for 3000 steps with 4000 atoms - -Performance: 24083.252 tau/day, 278.741 timesteps/s -97.9% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.6731 | 2.0701 | 2.3327 | 18.9 | 19.23 -Neigh | 2.7389 | 3.1706 | 3.5146 | 15.7 | 29.46 -Comm | 0.93507 | 1.5441 | 2.1182 | 39.1 | 14.35 -Output | 0.0021682 | 0.0044412 | 0.006026 | 2.2 | 0.04 -Modify | 3.0031 | 3.4223 | 3.9262 | 18.3 | 31.80 -Other | | 0.5511 | | | 5.12 - -Nlocal: 1000.00 ave 1277 max 723 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Nghost: 569.750 ave 809 max 454 min -Histogram: 1 2 0 0 0 0 0 0 0 1 -Neighs: 3690.50 ave 4937 max 2426 min -Histogram: 1 1 0 0 0 0 0 0 0 2 - -Total # of neighbors = 14762 -Ave neighs/atom = 3.6905000 -Neighbor list builds = 2187 -Dangerous builds = 1610 -Total wall time: 0:00:14 diff --git a/examples/granular/log.29Oct20.pour.flatwall.g++.1 b/examples/granular/log.29Oct20.pour.flatwall.g++.1 deleted file mode 100644 index 00fc8e31a1..0000000000 --- a/examples/granular/log.29Oct20.pour.flatwall.g++.1 +++ /dev/null @@ -1,188 +0,0 @@ -LAMMPS (29 Oct 2020) - using 1 OpenMP thread(s) per MPI task -# pour two types of particles (cohesive and non-cohesive) on flat wall - -variable name string pour_two_types - -atom_style sphere -units lj - -############################################### -# Geometry-related parameters -############################################### - -variable boxx equal 20 -variable boxy equal 20 -variable boxz equal 30 - -variable xc1 equal 0.3*${boxx} -variable xc1 equal 0.3*20 -variable xc2 equal 0.7*${boxx} -variable xc2 equal 0.7*20 -variable yc equal 0.5*${boxy} -variable yc equal 0.5*20 - -############################################### -# Particle-related parameters -############################################### -variable rlo equal 0.25 -variable rhi equal 0.5 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.25 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.5 - -variable dens equal 1.0 - -variable skin equal 0.3*${rhi} -variable skin equal 0.3*0.5 - -############# -processors * * 1 -region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} -region boxreg block 0 20 0 ${boxy} 0 ${boxz} -region boxreg block 0 20 0 20 0 ${boxz} -region boxreg block 0 20 0 20 0 30 -create_box 2 boxreg -Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (20.000000 20.000000 30.000000) - 1 by 1 by 1 MPI processor grid -change_box all boundary p p f -Changing box ... - -pair_style granular -pair_coeff 1 * jkr 1000.0 50.0 0.3 10 tangential mindlin 800.0 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall -pair_coeff 2 2 hertz 200.0 20.0 tangential linear_history 300.0 1.0 0.1 rolling sds 200.0 100.0 0.1 twisting marshall - -comm_modify vel yes - -region insreg1 cylinder z ${xc1} ${yc} 5 15 ${boxz} -region insreg1 cylinder z 6 ${yc} 5 15 ${boxz} -region insreg1 cylinder z 6 10 5 15 ${boxz} -region insreg1 cylinder z 6 10 5 15 30 -region insreg2 cylinder z ${xc2} ${yc} 5 15 ${boxz} -region insreg2 cylinder z 14 ${yc} 5 15 ${boxz} -region insreg2 cylinder z 14 10 5 15 ${boxz} -region insreg2 cylinder z 14 10 5 15 30 - -fix 1 all nve/sphere -fix grav all gravity 10.0 vector 0 0 -1 -fix ins1 all pour 1500 1 3123 region insreg1 diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens ${dens} ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 1 -Particle insertion: 562 every 346 steps, 1500 by step 693 -fix ins2 all pour 1500 2 3123 region insreg2 diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens ${dens} ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 1 -Particle insertion: 562 every 346 steps, 1500 by step 693 - -neighbor ${skin} bin -neighbor 0.15 bin -neigh_modify delay 0 every 1 check yes - -fix 3 all wall/gran granular hertz/material 1e5 1e3 0.3 tangential mindlin NULL 1.0 0.5 zplane 0 NULL - -thermo_style custom step atoms ke -thermo_modify lost warn -thermo 100 - -timestep 0.001 - -#dump 1 all custom 100 ${name}.dump id type radius mass x y z - -run 5000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.15 - ghost atom cutoff = 1.15 - binsize = 0.575, bins = 35 35 53 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair granular, perpetual - attributes: half, newton on, size, history - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 12.22 | 12.22 | 12.22 Mbytes -Step Atoms KinEng - 0 0 -0 - 100 926 -0 - 200 926 -0 - 300 926 -0 - 400 1498 -0 - 500 1498 -0 - 600 1498 -0 - 700 2275 -0 - 800 2275 -0 - 900 2275 -0 - 1000 2275 -0 - 1100 2954 -0 - 1200 2954 -0 - 1300 2954 -0 - 1400 3000 -0 - 1500 3000 -0 - 1600 3000 -0 - 1700 3000 -0 - 1800 3000 -0 - 1900 3000 -0 - 2000 3000 -0 - 2100 3000 -0 - 2200 3000 -0 - 2300 3000 -0 - 2400 3000 -0 - 2500 3000 -0 - 2600 3000 -0 - 2700 3000 -0 - 2800 3000 -0 - 2900 3000 -0 - 3000 3000 -0 - 3100 3000 -0 - 3200 3000 -0 - 3300 3000 -0 - 3400 3000 -0 - 3500 3000 -0 - 3600 3000 -0 - 3700 3000 -0 - 3800 3000 -0 - 3900 3000 -0 - 4000 3000 -0 - 4100 3000 -0 - 4200 3000 -0 - 4300 3000 -0 - 4400 3000 -0 - 4500 3000 -0 - 4600 3000 -0 - 4700 3000 -0 - 4800 3000 -0 - 4900 3000 -0 - 5000 3000 -0 -Loop time of 24.3889 on 1 procs for 5000 steps with 3000 atoms - -Performance: 17713.003 tau/day, 205.012 timesteps/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 14.362 | 14.362 | 14.362 | 0.0 | 58.89 -Neigh | 3.3483 | 3.3483 | 3.3483 | 0.0 | 13.73 -Comm | 0.42893 | 0.42893 | 0.42893 | 0.0 | 1.76 -Output | 0.0025065 | 0.0025065 | 0.0025065 | 0.0 | 0.01 -Modify | 6.059 | 6.059 | 6.059 | 0.0 | 24.84 -Other | | 0.1876 | | | 0.77 - -Nlocal: 3000.00 ave 3000 max 3000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 462.000 ave 462 max 462 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 17694.0 ave 17694 max 17694 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 17694 -Ave neighs/atom = 5.8980000 -Neighbor list builds = 1133 -Dangerous builds = 0 -Total wall time: 0:00:24 diff --git a/examples/granular/log.29Oct20.pour.flatwall.g++.4 b/examples/granular/log.29Oct20.pour.flatwall.g++.4 deleted file mode 100644 index 1688e52b43..0000000000 --- a/examples/granular/log.29Oct20.pour.flatwall.g++.4 +++ /dev/null @@ -1,188 +0,0 @@ -LAMMPS (29 Oct 2020) - using 1 OpenMP thread(s) per MPI task -# pour two types of particles (cohesive and non-cohesive) on flat wall - -variable name string pour_two_types - -atom_style sphere -units lj - -############################################### -# Geometry-related parameters -############################################### - -variable boxx equal 20 -variable boxy equal 20 -variable boxz equal 30 - -variable xc1 equal 0.3*${boxx} -variable xc1 equal 0.3*20 -variable xc2 equal 0.7*${boxx} -variable xc2 equal 0.7*20 -variable yc equal 0.5*${boxy} -variable yc equal 0.5*20 - -############################################### -# Particle-related parameters -############################################### -variable rlo equal 0.25 -variable rhi equal 0.5 -variable dlo equal 2.0*${rlo} -variable dlo equal 2.0*0.25 -variable dhi equal 2.0*${rhi} -variable dhi equal 2.0*0.5 - -variable dens equal 1.0 - -variable skin equal 0.3*${rhi} -variable skin equal 0.3*0.5 - -############# -processors * * 1 -region boxreg block 0 ${boxx} 0 ${boxy} 0 ${boxz} -region boxreg block 0 20 0 ${boxy} 0 ${boxz} -region boxreg block 0 20 0 20 0 ${boxz} -region boxreg block 0 20 0 20 0 30 -create_box 2 boxreg -Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (20.000000 20.000000 30.000000) - 2 by 2 by 1 MPI processor grid -change_box all boundary p p f -Changing box ... - -pair_style granular -pair_coeff 1 * jkr 1000.0 50.0 0.3 10 tangential mindlin 800.0 1.0 0.5 rolling sds 500.0 200.0 0.5 twisting marshall -pair_coeff 2 2 hertz 200.0 20.0 tangential linear_history 300.0 1.0 0.1 rolling sds 200.0 100.0 0.1 twisting marshall - -comm_modify vel yes - -region insreg1 cylinder z ${xc1} ${yc} 5 15 ${boxz} -region insreg1 cylinder z 6 ${yc} 5 15 ${boxz} -region insreg1 cylinder z 6 10 5 15 ${boxz} -region insreg1 cylinder z 6 10 5 15 30 -region insreg2 cylinder z ${xc2} ${yc} 5 15 ${boxz} -region insreg2 cylinder z 14 ${yc} 5 15 ${boxz} -region insreg2 cylinder z 14 10 5 15 ${boxz} -region insreg2 cylinder z 14 10 5 15 30 - -fix 1 all nve/sphere -fix grav all gravity 10.0 vector 0 0 -1 -fix ins1 all pour 1500 1 3123 region insreg1 diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens ${dens} ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 ${dens} -fix ins1 all pour 1500 1 3123 region insreg1 diam range 0.5 1 dens 1 1 -Particle insertion: 562 every 346 steps, 1500 by step 693 -fix ins2 all pour 1500 2 3123 region insreg2 diam range ${dlo} ${dhi} dens ${dens} ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 ${dhi} dens ${dens} ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens ${dens} ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 ${dens} -fix ins2 all pour 1500 2 3123 region insreg2 diam range 0.5 1 dens 1 1 -Particle insertion: 562 every 346 steps, 1500 by step 693 - -neighbor ${skin} bin -neighbor 0.15 bin -neigh_modify delay 0 every 1 check yes - -fix 3 all wall/gran granular hertz/material 1e5 1e3 0.3 tangential mindlin NULL 1.0 0.5 zplane 0 NULL - -thermo_style custom step atoms ke -thermo_modify lost warn -thermo 100 - -timestep 0.001 - -#dump 1 all custom 100 ${name}.dump id type radius mass x y z - -run 5000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 1.15 - ghost atom cutoff = 1.15 - binsize = 0.575, bins = 35 35 53 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair granular, perpetual - attributes: half, newton on, size, history - pair build: half/size/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 11.98 | 11.98 | 11.98 Mbytes -Step Atoms KinEng - 0 0 -0 - 100 926 -0 - 200 926 -0 - 300 926 -0 - 400 1498 -0 - 500 1498 -0 - 600 1498 -0 - 700 2275 -0 - 800 2275 -0 - 900 2275 -0 - 1000 2275 -0 - 1100 2954 -0 - 1200 2954 -0 - 1300 2954 -0 - 1400 3000 -0 - 1500 3000 -0 - 1600 3000 -0 - 1700 3000 -0 - 1800 3000 -0 - 1900 3000 -0 - 2000 3000 -0 - 2100 3000 -0 - 2200 3000 -0 - 2300 3000 -0 - 2400 3000 -0 - 2500 3000 -0 - 2600 3000 -0 - 2700 3000 -0 - 2800 3000 -0 - 2900 3000 -0 - 3000 3000 -0 - 3100 3000 -0 - 3200 3000 -0 - 3300 3000 -0 - 3400 3000 -0 - 3500 3000 -0 - 3600 3000 -0 - 3700 3000 -0 - 3800 3000 -0 - 3900 3000 -0 - 4000 3000 -0 - 4100 3000 -0 - 4200 3000 -0 - 4300 3000 -0 - 4400 3000 -0 - 4500 3000 -0 - 4600 3000 -0 - 4700 3000 -0 - 4800 3000 -0 - 4900 3000 -0 - 5000 3000 -0 -Loop time of 12.1982 on 4 procs for 5000 steps with 3000 atoms - -Performance: 35414.923 tau/day, 409.895 timesteps/s -97.0% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.7141 | 3.8131 | 6.2143 | 107.3 | 31.26 -Neigh | 0.77648 | 0.96585 | 1.1892 | 18.3 | 7.92 -Comm | 0.7427 | 3.5566 | 5.9731 | 128.4 | 29.16 -Output | 0.0067544 | 0.0086352 | 0.011408 | 1.8 | 0.07 -Modify | 3.3476 | 3.5826 | 3.8235 | 11.5 | 29.37 -Other | | 0.2715 | | | 2.23 - -Nlocal: 750.000 ave 1033 max 463 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Nghost: 435.000 ave 492 max 378 min -Histogram: 2 0 0 0 0 0 0 0 0 2 -Neighs: 4434.50 ave 7028 max 1967 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 17738 -Ave neighs/atom = 5.9126667 -Neighbor list builds = 1139 -Dangerous builds = 0 -Total wall time: 0:00:12 From 4a5d7c671c1ad9fee6ff8f5b9f5cf1441c6f2f82 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Tue, 14 Feb 2023 15:02:12 -0700 Subject: [PATCH 55/57] Switching from new atom style to property/atom --- src/.gitignore | 6 +- src/GRANULAR/atom_vec_sphere_temp.cpp | 173 ------------------ src/GRANULAR/atom_vec_sphere_temp.h | 52 ------ ...flow_sphere_temp.cpp => fix_heat_flow.cpp} | 113 +++++++++++- ...eat_flow_sphere_temp.h => fix_heat_flow.h} | 18 +- src/fix_property_atom.cpp | 111 ++++++++++- src/fix_property_atom.h | 1 + 7 files changed, 226 insertions(+), 248 deletions(-) delete mode 100644 src/GRANULAR/atom_vec_sphere_temp.cpp delete mode 100644 src/GRANULAR/atom_vec_sphere_temp.h rename src/GRANULAR/{fix_heat_flow_sphere_temp.cpp => fix_heat_flow.cpp} (58%) rename src/GRANULAR/{fix_heat_flow_sphere_temp.h => fix_heat_flow.h} (69%) diff --git a/src/.gitignore b/src/.gitignore index fe31736776..bead2e87e5 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -464,8 +464,6 @@ /atom_vec_oxdna.h /atom_vec_peri.cpp /atom_vec_peri.h -/atom_vec_sphere_temp.cpp -/atom_vec_sphere_temp.h /atom_vec_template.cpp /atom_vec_template.h /body_nparticle.cpp @@ -1557,8 +1555,8 @@ /fix_srp.h /fix_srp_react.cpp /fix_srp_react.h -/fix_heat_flow_sphere_temp.cpp -/fix_heat_flow_sphere_temp.h +/fix_heat_flow.cpp +/fix_heat_flow.h /fix_tfmc.cpp /fix_tfmc.h /fix_ttm.cpp diff --git a/src/GRANULAR/atom_vec_sphere_temp.cpp b/src/GRANULAR/atom_vec_sphere_temp.cpp deleted file mode 100644 index 283a55e2da..0000000000 --- a/src/GRANULAR/atom_vec_sphere_temp.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "atom_vec_sphere_temp.h" - -#include "atom.h" -#include "error.h" -#include "fix.h" -#include "fix_adapt.h" -#include "math_const.h" -#include "modify.h" - -using namespace LAMMPS_NS; -using namespace MathConst; - -/* ---------------------------------------------------------------------- */ - -AtomVecSphereTemp::AtomVecSphereTemp(LAMMPS *lmp) : AtomVec(lmp) -{ - mass_type = PER_ATOM; - forceclearflag = 1; - molecular = Atom::ATOMIC; - - atom->sphere_flag = 1; - atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1; - atom->temperature_flag = atom->heatflow_flag = 1; - - // strings with peratom variables to include in each AtomVec method - // strings cannot contain fields in corresponding AtomVec default strings - // order of fields in a string does not matter - // except: fields_data_atom & fields_data_vel must match data file - - fields_grow = {"radius", "rmass", "omega", "torque", "temperature", "heatflow"}; - fields_copy = {"radius", "rmass", "omega", "temperature"}; - fields_comm_vel = {"omega", "temperature"}; - fields_reverse = {"torque", "heatflow"}; - fields_border = {"radius", "rmass", "temperature"}; - fields_border_vel = {"radius", "rmass", "omega", "temperature"}; - fields_exchange = {"radius", "rmass", "omega", "temperature"}; - fields_restart = {"radius", "rmass", "omega", "temperature"}; - fields_create = {"radius", "rmass", "omega", "temperature"}; - fields_data_atom = {"id", "type", "radius", "rmass", "x", "temperature"}; - fields_data_vel = {"id", "v", "omega"}; -} - -/* ---------------------------------------------------------------------- - process sub-style args - optional arg = 0/1 for static/dynamic particle radii -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::process_args(int narg, char **arg) -{ - if (narg != 0 && narg != 1) error->all(FLERR, "Illegal atom_style sphere command"); - - radvary = 0; - if (narg == 1) { - radvary = utils::numeric(FLERR, arg[0], true, lmp); - if (radvary < 0 || radvary > 1) error->all(FLERR, "Illegal atom_style sphere command"); - } - - // dynamic particle radius and mass must be communicated every step - - if (radvary) { - fields_comm = {"radius", "rmass"}; - fields_comm_vel = {"radius", "rmass", "omega"}; - } - - // delay setting up of fields until now - - setup_fields(); -} - -/* ---------------------------------------------------------------------- */ - -void AtomVecSphereTemp::init() -{ - AtomVec::init(); - - // check if optional radvary setting should have been set to 1 - - for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style, "adapt") == 0) { - auto fix = dynamic_cast(modify->fix[i]); - if (fix->diamflag && radvary == 0) - error->all(FLERR, "Fix adapt changes particle radii but atom_style sphere is not dynamic"); - } -} - -/* ---------------------------------------------------------------------- - set local copies of all grow ptrs used by this class, except defaults - needed in replicate when 2 atom classes exist and it calls pack_restart() -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::grow_pointers() -{ - radius = atom->radius; - rmass = atom->rmass; - omega = atom->omega; - temperature = atom->temperature; - heatflow = atom->heatflow; -} - -/* ---------------------------------------------------------------------- - clear extra forces starting at atom N - nbytes = # of bytes to clear for a per-atom vector -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::force_clear(int n, size_t nbytes) -{ - memset(&heatflow[n], 0, nbytes); -} - -/* ---------------------------------------------------------------------- - initialize non-zero atom quantities -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::create_atom_post(int ilocal) -{ - radius[ilocal] = 0.5; - rmass[ilocal] = 4.0 * MY_PI / 3.0 * 0.5 * 0.5 * 0.5; -} - -/* ---------------------------------------------------------------------- - modify what AtomVec::data_atom() just unpacked - or initialize other atom quantities -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::data_atom_post(int ilocal) -{ - radius_one = 0.5 * atom->radius[ilocal]; - radius[ilocal] = radius_one; - if (radius_one > 0.0) rmass[ilocal] *= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; - - if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); - - omega[ilocal][0] = 0.0; - omega[ilocal][1] = 0.0; - omega[ilocal][2] = 0.0; -} - -/* ---------------------------------------------------------------------- - modify values for AtomVec::pack_data() to pack -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::pack_data_pre(int ilocal) -{ - radius_one = radius[ilocal]; - rmass_one = rmass[ilocal]; - - radius[ilocal] *= 2.0; - if (radius_one != 0.0) - rmass[ilocal] = rmass_one / (4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one); -} - -/* ---------------------------------------------------------------------- - unmodify values packed by AtomVec::pack_data() -------------------------------------------------------------------------- */ - -void AtomVecSphereTemp::pack_data_post(int ilocal) -{ - radius[ilocal] = radius_one; - rmass[ilocal] = rmass_one; -} diff --git a/src/GRANULAR/atom_vec_sphere_temp.h b/src/GRANULAR/atom_vec_sphere_temp.h deleted file mode 100644 index de6d5266a5..0000000000 --- a/src/GRANULAR/atom_vec_sphere_temp.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifdef ATOM_CLASS -// clang-format off -AtomStyle(sphere/temp,AtomVecSphereTemp); -// clang-format on -#else - -#ifndef LMP_ATOM_VEC_SPHERE_TEMP_H -#define LMP_ATOM_VEC_SPHERE_TEMP_H - -#include "atom_vec.h" - -namespace LAMMPS_NS { - -class AtomVecSphereTemp : public AtomVec { - public: - AtomVecSphereTemp(class LAMMPS *); - void process_args(int, char **) override; - void init() override; - - void grow_pointers() override; - void force_clear(int, size_t) override; - void create_atom_post(int) override; - void data_atom_post(int) override; - void pack_data_pre(int) override; - void pack_data_post(int) override; - - private: - double *radius, *rmass; - double **omega; - double *temperature, *heatflow; - - int radvary; - double radius_one, rmass_one; -}; - -} // namespace LAMMPS_NS - -#endif -#endif diff --git a/src/GRANULAR/fix_heat_flow_sphere_temp.cpp b/src/GRANULAR/fix_heat_flow.cpp similarity index 58% rename from src/GRANULAR/fix_heat_flow_sphere_temp.cpp rename to src/GRANULAR/fix_heat_flow.cpp index fe7fc49324..d62f914577 100644 --- a/src/GRANULAR/fix_heat_flow_sphere_temp.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -12,12 +12,14 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "fix_heat_flow_sphere_temp.h" +#include "fix_heat_flow.h" #include "atom.h" +#include "comm.h" #include "error.h" #include "force.h" #include "memory.h" +#include "modify.h" #include "respa.h" #include "update.h" @@ -28,12 +30,14 @@ enum {NONE, CONSTANT, TYPE}; /* ---------------------------------------------------------------------- */ -FixHeatFlowSphereTemp::FixHeatFlowSphereTemp(LAMMPS *lmp, int narg, char **arg) : +FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal fix command"); cp_style = NONE; + comm_forward = 1; + comm_reverse = 1; int ntypes = atom->ntypes; if (strcmp(arg[3],"constant") == 0) { @@ -60,7 +64,7 @@ FixHeatFlowSphereTemp::FixHeatFlowSphereTemp(LAMMPS *lmp, int narg, char **arg) /* ---------------------------------------------------------------------- */ -int FixHeatFlowSphereTemp::setmask() +int FixHeatFlow::setmask() { int mask = 0; mask |= FINAL_INTEGRATE; @@ -70,7 +74,7 @@ int FixHeatFlowSphereTemp::setmask() /* ---------------------------------------------------------------------- */ -void FixHeatFlowSphereTemp::init() +void FixHeatFlow::init() { dt = update->dt; @@ -82,7 +86,26 @@ void FixHeatFlowSphereTemp::init() /* ---------------------------------------------------------------------- */ -void FixHeatFlowSphereTemp::final_integrate() +void FixHeatFlow::setup(int /*vflag*/) +{ + // Identify whether this is the first/last instance of fix heat/flow + first_flag = 0; + last_flag = 0; + + int i = 0; + auto fixlist = modify->get_fix_by_style("heat/flow"); + for (const auto &ifix : fixlist) { + if (strcmp(ifix->id, id) == 0) break; + i++; + } + + if (i == 0) first_flag = 1; + if ((i + 1) == fixlist.size()) last_flag = 1; +} + +/* ---------------------------------------------------------------------- */ + +void FixHeatFlow::final_integrate() { // update temperature of atoms in group @@ -95,6 +118,10 @@ void FixHeatFlowSphereTemp::final_integrate() int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; + // add ghost contributions to heatflow if first instance of fix + if (first_flag) + comm->reverse_comm(this); + if (rmass) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { @@ -106,11 +133,18 @@ void FixHeatFlowSphereTemp::final_integrate() temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); } } + + // send updated temperatures to ghosts if last instance of fix + // then clear heatflow for next force calculation + if (last_flag) { + comm->forward_comm(this); + for (int i = 0; i < atom->nmax; i++) heatflow[i] = 0.0; + } } /* ---------------------------------------------------------------------- */ -void FixHeatFlowSphereTemp::final_integrate_respa(int ilevel, int /*iloop*/) +void FixHeatFlow::final_integrate_respa(int ilevel, int /*iloop*/) { dt = update->dt; final_integrate(); @@ -118,14 +152,14 @@ void FixHeatFlowSphereTemp::final_integrate_respa(int ilevel, int /*iloop*/) /* ---------------------------------------------------------------------- */ -void FixHeatFlowSphereTemp::reset_dt() +void FixHeatFlow::reset_dt() { dt = update->dt; } /* ---------------------------------------------------------------------- */ -double FixHeatFlowSphereTemp::calc_cp(int i) +double FixHeatFlow::calc_cp(int i) { if (cp_style == TYPE) { return cp_type[atom->type[i]]; @@ -133,3 +167,66 @@ double FixHeatFlowSphereTemp::calc_cp(int i) return cp; } } + +/* ---------------------------------------------------------------------- */ + +int FixHeatFlow::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +{ + int i, j, m; + + double *temperature = atom->temperature; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = temperature[j]; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixHeatFlow::unpack_forward_comm(int n, int first, double *buf) +{ + int i, m, last; + + m = 0; + last = first + n; + + double *temperature = atom->temperature; + + for (i = first; i < last; i++) temperature[i] = buf[m++]; +} + +/* ---------------------------------------------------------------------- */ + +int FixHeatFlow::pack_reverse_comm(int n, int first, double *buf) +{ + int i,k,last; + + int m = 0; + last = first + n; + double *heatflow = atom->heatflow; + + for (i = first; i < last; i++) { + buf[m++] = heatflow[i]; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixHeatFlow::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,j,k,kk,ncount; + + int m = 0; + double *heatflow = atom->heatflow; + + for (i = 0; i < n; i++) { + j = list[i]; + heatflow[j] += buf[m++]; + } +} diff --git a/src/GRANULAR/fix_heat_flow_sphere_temp.h b/src/GRANULAR/fix_heat_flow.h similarity index 69% rename from src/GRANULAR/fix_heat_flow_sphere_temp.h rename to src/GRANULAR/fix_heat_flow.h index 6bc2d50373..2d311d0104 100644 --- a/src/GRANULAR/fix_heat_flow_sphere_temp.h +++ b/src/GRANULAR/fix_heat_flow.h @@ -13,33 +13,37 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(heat/flow/sphere/temp,FixHeatFlowSphereTemp); +FixStyle(heat/flow,FixHeatFlow); // clang-format on #else -#ifndef LMP_FIX_HEAT_FLOW_SPHERE_TEMP_H -#define LMP_FIX_HEAT_FLOW_SPHERE_TEMP_H +#ifndef LMP_FIX_HEAT_FLOW_H +#define LMP_FIX_HEAT_FLOW_H #include "fix.h" namespace LAMMPS_NS { -class FixHeatFlowSphereTemp : public Fix { +class FixHeatFlow : public Fix { public: - FixHeatFlowSphereTemp(class LAMMPS *, int, char **); + FixHeatFlow(class LAMMPS *, int, char **); int setmask() override; void init() override; + void setup(int) override; void final_integrate() override; void final_integrate_respa(int, int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; void reset_dt() override; protected: double dt; double cp, *cp_type; int cp_style; - - int mass_require; + int first_flag, last_flag; double calc_cp(int); }; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 95e25c59b2..4b43feca74 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum { MOLECULE, CHARGE, RMASS, IVEC, DVEC, IARRAY, DARRAY }; +enum { MOLECULE, CHARGE, RMASS, TEMPERATURE, HEATFLOW, IVEC, DVEC, IARRAY, DARRAY }; /* ---------------------------------------------------------------------- */ @@ -46,6 +46,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : molecule_flag = 0; q_flag = 0; rmass_flag = 0; + temperature_flag = 0; + heatflow_flag = 0; nvalue = 0; values_peratom = 0; @@ -81,6 +83,26 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : values_peratom++; nvalue++; iarg++; + } else if (strcmp(arg[iarg], "temperature") == 0) { + if (atom->temperature_flag) + error->all(FLERR, "Fix property/atom temperature when atom_style already has temperature attribute"); + if (temperature_flag) error->all(FLERR, "Fix property/atom cannot specify temperature twice"); + styles[nvalue] = TEMPERATURE; + cols[nvalue] = 0; + atom->temperature_flag = temperature_flag = 1; + values_peratom++; + nvalue++; + iarg++; + } else if (strcmp(arg[iarg], "heatflow") == 0) { + if (atom->heatflow_flag) + error->all(FLERR, "Fix property/atom heatflow when atom_style already has heatflow attribute"); + if (heatflow_flag) error->all(FLERR, "Fix property/atom cannot specify heatflow twice"); + styles[nvalue] = HEATFLOW; + cols[nvalue] = 0; + atom->heatflow_flag = heatflow_flag = 1; + values_peratom++; + nvalue++; + iarg++; // custom atom vector @@ -163,14 +185,15 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (border) comm_border = values_peratom; - // warn if mol or charge keyword used without ghost yes + // warn if mol, charge, rmass, temperature, or heatflow keyword used without ghost yes if (border == 0) { int flag = 0; for (int i = 0; i < nvalue; i++) - if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS) flag = 1; + if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS || + styles[i] == TEMPERATURE || styles[i] == HEATFLOW) flag = 1; if (flag && comm->me == 0) - error->warning(FLERR, "Fix property/atom mol or charge or rmass w/out ghost communication"); + error->warning(FLERR, "Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost communication"); } // store current atom style @@ -213,6 +236,14 @@ FixPropertyAtom::~FixPropertyAtom() atom->rmass_flag = 0; memory->destroy(atom->rmass); atom->rmass = nullptr; + } else if (styles[nv] == TEMPERATURE) { + atom->temperature_flag = 0; + memory->destroy(atom->temperature); + atom->temperature = nullptr; + } else if (styles[nv] == HEATFLOW) { + atom->heatflow_flag = 0; + memory->destroy(atom->heatflow); + atom->heatflow = nullptr; } else if (styles[nv] == IVEC) { atom->remove_custom(index[nv], 0, cols[nv]); } else if (styles[nv] == DVEC) { @@ -298,6 +329,10 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint atom->q[m] = values.next_double(); } else if (styles[j] == RMASS) { atom->rmass[m] = values.next_double(); + } else if (styles[j] == TEMPERATURE) { + atom->temperature[m] = values.next_double(); + } else if (styles[j] == HEATFLOW) { + atom->heatflow[m] = values.next_double(); } else if (styles[j] == IVEC) { atom->ivector[index[j]][m] = values.next_int(); } else if (styles[j] == DVEC) { @@ -377,6 +412,14 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf) double *rmass = atom->rmass; for (i = 0; i < nlocal; i++) buf[i][icol] = rmass[i]; icol++; + } else if (styles[nv] == TEMPERATURE) { + double *temperature = atom->temperature; + for (i = 0; i < nlocal; i++) buf[i][icol] = temperature[i]; + icol++; + } else if (styles[nv] == HEATFLOW) { + double *heatflow = atom->heatflow; + for (i = 0; i < nlocal; i++) buf[i][icol] = heatflow[i]; + icol++; } else if (styles[nv] == IVEC) { int *ivec = atom->ivector[index[nv]]; for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(ivec[i]).d; @@ -424,6 +467,10 @@ void FixPropertyAtom::write_data_section_keyword(int /*mth*/, FILE *fp) fputs(" q", fp); else if (styles[i] == RMASS) fputs(" rmass", fp); + else if (styles[i] == TEMPERATURE) + fputs(" temperature", fp); + else if (styles[i] == HEATFLOW) + fputs(" heatflow", fp); else if (styles[i] == IVEC) fprintf(fp, " i_%s", atom->ivname[index[i]]); else if (styles[i] == DVEC) @@ -459,6 +506,10 @@ void FixPropertyAtom::write_data_section(int /*mth*/, FILE *fp, int n, double ** line += fmt::format(" {}", buf[i][icol++]); else if (styles[nv] == RMASS) line += fmt::format(" {}", buf[i][icol++]); + else if (styles[nv] == TEMPERATURE) + line += fmt::format(" {}", buf[i][icol++]); + else if (styles[nv] == HEATFLOW) + line += fmt::format(" {}", buf[i][icol++]); else if (styles[nv] == IVEC) line += fmt::format(" {}", (int) ubuf(buf[i][icol++]).i); else if (styles[nv] == DVEC) @@ -491,6 +542,10 @@ double FixPropertyAtom::memory_usage() bytes = atom->nmax * sizeof(double); else if (styles[m] == RMASS) bytes = atom->nmax * sizeof(double); + else if (styles[m] == TEMPERATURE) + bytes = atom->nmax * sizeof(double); + else if (styles[m] == HEATFLOW) + bytes = atom->nmax * sizeof(double); else if (styles[m] == IVEC) bytes = atom->nmax * sizeof(int); else if (styles[m] == DVEC) @@ -525,6 +580,14 @@ void FixPropertyAtom::grow_arrays(int nmax) memory->grow(atom->rmass, nmax, "atom:rmass"); size_t nbytes = (nmax - nmax_old) * sizeof(double); memset(&atom->rmass[nmax_old], 0, nbytes); + } else if (styles[nv] == TEMPERATURE) { + memory->grow(atom->temperature, nmax, "atom:temperature"); + size_t nbytes = (nmax - nmax_old) * sizeof(double); + memset(&atom->temperature[nmax_old], 0, nbytes); + } else if (styles[nv] == HEATFLOW) { + memory->grow(atom->heatflow, nmax, "atom:heatflow"); + size_t nbytes = (nmax - nmax_old) * sizeof(double); + memset(&atom->heatflow[nmax_old], 0, nbytes); } else if (styles[nv] == IVEC) { memory->grow(atom->ivector[index[nv]], nmax, "atom:ivector"); size_t nbytes = (nmax - nmax_old) * sizeof(int); @@ -562,6 +625,10 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/) atom->q[j] = atom->q[i]; else if (styles[nv] == RMASS) atom->rmass[j] = atom->rmass[i]; + else if (styles[nv] == TEMPERATURE) + atom->temperature[j] = atom->temperature[i]; + else if (styles[nv] == HEATFLOW) + atom->heatflow[j] = atom->heatflow[i]; else if (styles[nv] == IVEC) atom->ivector[index[nv]][j] = atom->ivector[index[nv]][i]; else if (styles[nv] == DVEC) @@ -604,6 +671,18 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf) j = list[i]; buf[m++] = rmass[j]; } + } else if (styles[nv] == TEMPERATURE) { + double *temperature = atom->temperature; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = temperature[j]; + } + } else if (styles[nv] == HEATFLOW) { + double *heatflow = atom->heatflow; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = heatflow[j]; + } } else if (styles[nv] == IVEC) { int *ivector = atom->ivector[index[nv]]; for (i = 0; i < n; i++) { @@ -658,6 +737,14 @@ int FixPropertyAtom::unpack_border(int n, int first, double *buf) double *rmass = atom->rmass; last = first + n; for (i = first; i < last; i++) rmass[i] = buf[m++]; + } else if (styles[nv] == TEMPERATURE) { + double *temperature = atom->temperature; + last = first + n; + for (i = first; i < last; i++) temperature[i] = buf[m++]; + } else if (styles[nv] == HEATFLOW) { + double *heatflow = atom->heatflow; + last = first + n; + for (i = first; i < last; i++) heatflow[i] = buf[m++]; } else if (styles[nv] == IVEC) { int *ivector = atom->ivector[index[nv]]; last = first + n; @@ -700,6 +787,10 @@ int FixPropertyAtom::pack_exchange(int i, double *buf) buf[m++] = atom->q[i]; else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i]; + else if (styles[nv] == TEMPERATURE) + buf[m++] = atom->temperature[i]; + else if (styles[nv] == HEATFLOW) + buf[m++] = atom->heatflow[i]; else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; else if (styles[nv] == DVEC) @@ -732,6 +823,10 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf) atom->q[nlocal] = buf[m++]; else if (styles[nv] == RMASS) atom->rmass[nlocal] = buf[m++]; + else if (styles[nv] == TEMPERATURE) + atom->temperature[nlocal] = buf[m++]; + else if (styles[nv] == HEATFLOW) + atom->heatflow[nlocal] = buf[m++]; else if (styles[nv] == IVEC) atom->ivector[index[nv]][nlocal] = (int) ubuf(buf[m++]).i; else if (styles[nv] == DVEC) @@ -768,6 +863,10 @@ int FixPropertyAtom::pack_restart(int i, double *buf) buf[m++] = atom->q[i]; else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i]; + else if (styles[nv] == TEMPERATURE) + buf[m++] = atom->temperature[i]; + else if (styles[nv] == HEATFLOW) + buf[m++] = atom->heatflow[i]; else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; else if (styles[nv] == DVEC) @@ -807,6 +906,10 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth) atom->q[nlocal] = extra[nlocal][m++]; else if (styles[nv] == RMASS) atom->rmass[nlocal] = extra[nlocal][m++]; + else if (styles[nv] == TEMPERATURE) + atom->temperature[nlocal] = extra[nlocal][m++]; + else if (styles[nv] == HEATFLOW) + atom->heatflow[nlocal] = extra[nlocal][m++]; else if (styles[nv] == IVEC) atom->ivector[index[nv]][nlocal] = (int) ubuf(extra[nlocal][m++]).i; else if (styles[nv] == DVEC) diff --git a/src/fix_property_atom.h b/src/fix_property_atom.h index 18a4b61529..7d9f50b75e 100644 --- a/src/fix_property_atom.h +++ b/src/fix_property_atom.h @@ -54,6 +54,7 @@ class FixPropertyAtom : public Fix { protected: int nvalue, border; int molecule_flag, q_flag, rmass_flag; // flags for specific fields + int temperature_flag, heatflow_flag; int *styles; // style of each value, see enum int *index; // indices into atom custom data structs int *cols; // columns per value, for arrays From 329dbd04852281640f8ec5b1e1251da83c40a490 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 15 Feb 2023 11:00:19 -0700 Subject: [PATCH 56/57] Updating doc/examples, moving forward comm to pre_force --- doc/src/Commands_fix.rst | 2 +- doc/src/Howto_granular.rst | 7 ++-- doc/src/atom_style.rst | 14 ++++---- doc/src/fix.rst | 2 +- ...flow_sphere_temp.rst => fix_heat_flow.rst} | 16 ++++----- doc/src/fix_wall_gran.rst | 7 ++-- doc/src/fix_wall_gran_region.rst | 7 ++-- doc/src/pair_granular.rst | 6 ++-- doc/src/set.rst | 9 ++--- examples/granular/in.pour.heat | 13 +++---- examples/granular/log.15Sep22.pour.heat.g++.1 | 36 ++++++++++--------- examples/granular/log.15Sep22.pour.heat.g++.4 | 36 ++++++++++--------- src/GRANULAR/fix_heat_flow.cpp | 32 +++++++++++------ src/GRANULAR/fix_heat_flow.h | 4 ++- 14 files changed, 106 insertions(+), 85 deletions(-) rename doc/src/{fix_heat_flow_sphere_temp.rst => fix_heat_flow.rst} (80%) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 714485983d..1552861129 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -92,7 +92,7 @@ OPT. * :doc:`grem ` * :doc:`halt ` * :doc:`heat ` - * :doc:`heat/flow/sphere/temp ` + * :doc:`heat/flow ` * :doc:`hyper/global ` * :doc:`hyper/local ` * :doc:`imd ` diff --git a/doc/src/Howto_granular.rst b/doc/src/Howto_granular.rst index 6a2346746b..c22cab66bc 100644 --- a/doc/src/Howto_granular.rst +++ b/doc/src/Howto_granular.rst @@ -43,10 +43,11 @@ The fix style *freeze* zeroes both the force and torque of frozen atoms, and should be used for granular system instead of the fix style *setforce*\ . -To model heat conduction, one must use the atom style: -* :doc:`atom_style sphere/temp ` +To model heat conduction, one must add the temperature and heatflow +atom variables with: +* :doc:`fix property/atom ` a temperature integration fix -* :doc:`fix heat/flow/sphere/temp ` +* :doc:`fix heat/flow ` and a heat conduction option defined in both * :doc:`pair_style granular ` * :doc:`fix wall/gran ` diff --git a/doc/src/atom_style.rst b/doc/src/atom_style.rst index bd8843fd2c..2131cd12b2 100644 --- a/doc/src/atom_style.rst +++ b/doc/src/atom_style.rst @@ -123,8 +123,6 @@ quantities. +--------------+-----------------------------------------------------+--------------------------------------+ | *sphere* | diameter, mass, angular velocity | granular models | +--------------+-----------------------------------------------------+--------------------------------------+ -| *sphere/temp*| diameter, mass, angular velocity, temperature | thermal granular models | -+--------------+-----------------------------------------------------+--------------------------------------+ | *bpm/sphere* | diameter, mass, angular velocity, quaternion | granular bonded particle models (BPM)| +--------------+-----------------------------------------------------+--------------------------------------+ | *spin* | magnetic moment | system with magnetic particles | @@ -150,7 +148,7 @@ quantities. custom values. All of the above styles define point particles, except the *sphere*, -*sphere/temp*, *bpm/sphere*, *ellipsoid*, *electron*, *peri*, *wavepacket*, *line*, +*bpm/sphere*, *ellipsoid*, *electron*, *peri*, *wavepacket*, *line*, *tri*, and *body* styles, which define finite-size particles. See the :doc:`Howto spherical ` page for an overview of using finite-size particle models with LAMMPS. @@ -160,11 +158,11 @@ per-type basis, using the :doc:`mass ` command, The finite-size particle styles assign mass to individual particles on a per-particle basis. -For the *sphere*, *sphere/temp*, and *bpm/sphere* styles, the particles -are spheres and each stores a per-particle diameter and mass. If the -diameter > 0.0, the particle is a finite-size sphere. If the diameter -= 0.0, it is a point particle. Note that by use of the *disc* keyword -with the :doc:`fix nve/sphere `, :doc:`fix nvt/sphere +For the *sphere* and *bpm/sphere* styles, the particles are spheres +and each stores a per-particle diameter and mass. If the diameter > +0.0, the particle is a finite-size sphere. If the diameter = 0.0, it +is a point particle. Note that by use of the *disc* keyword with the +:doc:`fix nve/sphere `, :doc:`fix nvt/sphere `, :doc:`fix nph/sphere `, :doc:`fix npt/sphere ` commands for the *sphere* style, spheres can be effectively treated as 2d discs for a 2d simulation if diff --git a/doc/src/fix.rst b/doc/src/fix.rst index d524b06551..ed8349c953 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -244,7 +244,7 @@ accelerated styles exist. * :doc:`grem ` - implements the generalized replica exchange method * :doc:`halt ` - terminate a dynamics run or minimization * :doc:`heat ` - add/subtract momentum-conserving heat -* :doc:`heat/flow/sphere/temp ` - plain time integration of heat flow with per-atom temperature updates +* :doc:`heat/flow ` - plain time integration of heat flow with per-atom temperature updates * :doc:`hyper/global ` - global hyperdynamics * :doc:`hyper/local ` - local hyperdynamics * :doc:`imd ` - implements the "Interactive MD" (IMD) protocol diff --git a/doc/src/fix_heat_flow_sphere_temp.rst b/doc/src/fix_heat_flow.rst similarity index 80% rename from doc/src/fix_heat_flow_sphere_temp.rst rename to doc/src/fix_heat_flow.rst index c604b041ad..ee73d7d4f2 100644 --- a/doc/src/fix_heat_flow_sphere_temp.rst +++ b/doc/src/fix_heat_flow.rst @@ -1,6 +1,6 @@ -.. index:: fix heat/flow/sphere/temp +.. index:: fix heat/flow -fix heat/flow/sphere/temp command +fix heat/flow command ========================== Syntax @@ -8,10 +8,10 @@ Syntax .. parsed-literal:: - fix ID group-ID heat/flow/sphere/temp style values ... + fix ID group-ID heat/flow style values ... * ID, group-ID are documented in :doc:`fix ` command -* heat/flow/sphere/temp = style name of this fix command +* heat/flow = style name of this fix command * one style with corresponding value(s) needs to be listed .. parsed-literal:: @@ -29,8 +29,8 @@ Examples .. code-block:: LAMMPS - fix 1 all heat/flow/sphere/temp constant 1.0 - fix 1 all heat/flow/sphere/temp type 1.0 0.5 + fix 1 all heat/flow constant 1.0 + fix 1 all heat/flow type 1.0 0.5 Description """"""""""" @@ -57,12 +57,12 @@ Restrictions """""""""""" This fix requires that atoms store temperature and heat flow -as defined by the :doc:`atom_style sphere/temp ` command. +as defined by the :doc:`fix property/atom ` command. Related commands """""""""""""""" -:doc:`pair granular ` +:doc:`pair granular `, :doc:`fix property/atom ` Default """"""" diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 0cc4798dd2..0006e1750b 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -185,9 +185,10 @@ The following value can either be a numeric value or an equal-style specified as v_name, where name is the variable name. In this case, the variable will be evaluated each timestep, and its value used to determine the temperature. This option must be used in conjunction with a heat -conduction model defined in :doc:`pair_style granular ` -and a compatible atom style which stores temperature and a heat flow -as defined by the :doc:`atom_style sphere/temp ` command. +conduction model defined in :doc:`pair_style granular `, +:doc:`fix property/atom ` to store temperature and a +heat flow, and :doc:`fix heat/flow ` to integrate heat +flow. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 73a2e9c973..94edebbcf1 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -208,9 +208,10 @@ The following value can either be a numeric value or an equal-style specified as v_name, where name is the variable name. In this case, the variable will be evaluated each timestep, and its value used to determine the temperature. This option must be used in conjunction with a heat -conduction model defined in :doc:`pair_style granular ` -and a compatible atom style which stores temperature and a heat flow -as defined by the :doc:`atom_style sphere/temp ` command. +conduction model defined in :doc:`pair_style granular `, +:doc:`fix property/atom ` to store temperature and a +heat flow, and :doc:`fix heat/flow ` to integrate heat +flow. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 491061b5fb..0911a3486a 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -659,9 +659,9 @@ where :math:`\Delta T` is the difference in the two particles' temperature, :math:`a` is the area of the contact and depends on the normal force model. Note that the option *none* must either be used in all or none of of the -*pair_coeff* calls. See -:doc:`fix heat/flow/sphere/temp ` for more -information on this option. +*pair_coeff* calls. See :doc:`fix heat/flow ` and +:doc:`fix property/atom ` for more information on this +option. ---------- diff --git a/doc/src/set.rst b/doc/src/set.rst index 5563d3199c..6add1de9f3 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -431,10 +431,11 @@ assumed to be in mass/distance\^2 units). If none of these cases are valid, then the mass is set to the density value directly (the input density is assumed to be in mass units). -Keyword *temperature* sets the temperature of a finite-size particle -as defined by the GRANULAR package. Currently, only -:doc:`atom_style sphere/temperature ` defines particles -with this attribute. The values for the temperature must be positive. +Keyword *temperature* sets the temperature of a finite-size particle. +Currently, only the GRANULAR package supports this attribute. The +temperature must be added using an instance of +:doc:`fix property/atom ` The values for the +temperature must be positive. Keyword *volume* sets the volume of all selected particles. Currently, only the :doc:`atom_style peri ` command defines particles diff --git a/examples/granular/in.pour.heat b/examples/granular/in.pour.heat index 69590389b5..f3bf9bcccc 100644 --- a/examples/granular/in.pour.heat +++ b/examples/granular/in.pour.heat @@ -3,7 +3,7 @@ variable name string heat_plate -atom_style sphere/temp +atom_style sphere units lj ############################################### @@ -49,9 +49,10 @@ region bottom_wall plane ${xc} ${yc} 0 0 0 1 side in region insreg cylinder z ${xc} ${yc} ${cyl_rad_inner} ${drum_height} ${boxz} -fix 0 all balance 100 1.0 shift xy 5 1.1 -fix 1 all nve/sphere -fix 2 all heat/flow/sphere/temp constant 1.0 +fix 0 all property/atom temperature heatflow +fix 1 all balance 100 1.0 shift xy 5 1.1 +fix 2 all nve/sphere +fix 3 all heat/flow constant 1.0 fix grav all gravity 10 vector 0 0 -1 fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} fix ins2 all pour 1000 2 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} @@ -63,8 +64,8 @@ neigh_modify delay 0 every 1 check yes variable oscillate equal 1.0*sin(step*0.0001) -fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall -fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate thermo_style custom step atoms ke pxx pyy pzz thermo_modify lost warn diff --git a/examples/granular/log.15Sep22.pour.heat.g++.1 b/examples/granular/log.15Sep22.pour.heat.g++.1 index d232752c74..24c128c0a6 100644 --- a/examples/granular/log.15Sep22.pour.heat.g++.1 +++ b/examples/granular/log.15Sep22.pour.heat.g++.1 @@ -1,10 +1,10 @@ -LAMMPS (15 Sep 2022) +LAMMPS (22 Dec 2022) # pour one types of particles into cylinder and oscillate # temperature of the bottom plate variable name string heat_plate -atom_style sphere/temp +atom_style sphere units lj ############################################### @@ -76,9 +76,11 @@ region insreg cylinder z 5 5 4.45 ${drum_height} ${boxz} region insreg cylinder z 5 5 4.45 30 ${boxz} region insreg cylinder z 5 5 4.45 30 50 -fix 0 all balance 100 1.0 shift xy 5 1.1 -fix 1 all nve/sphere -fix 2 all heat/flow/sphere/temp constant 1.0 +fix 0 all property/atom temperature heatflow +WARNING: Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost communication (../fix_property_atom.cpp:196) +fix 1 all balance 100 1.0 shift xy 5 1.1 +fix 2 all nve/sphere +fix 3 all heat/flow constant 1.0 fix grav all gravity 10 vector 0 0 -1 fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} @@ -101,8 +103,8 @@ neigh_modify delay 0 every 1 check yes variable oscillate equal 1.0*sin(step*0.0001) -fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall -fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate thermo_style custom step atoms ke pxx pyy pzz thermo_modify lost warn @@ -1142,20 +1144,20 @@ WARNING: Less insertions than requested (../fix_pour.cpp:681) 99800 2000 -0 7.9486941 7.5271104 6.5519215 99900 2000 -0 7.9486942 7.5271152 6.5519136 100000 2000 -0 7.9486939 7.5271185 6.5519079 -Loop time of 87.7116 on 1 procs for 100000 steps with 2000 atoms +Loop time of 85.1866 on 1 procs for 100000 steps with 2000 atoms -Performance: 98504.589 tau/day, 1140.099 timesteps/s, 2.280 Matom-step/s -99.5% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 101424.442 tau/day, 1173.894 timesteps/s, 2.348 Matom-step/s +99.4% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 66.081 | 66.081 | 66.081 | 0.0 | 75.34 -Neigh | 2.7411 | 2.7411 | 2.7411 | 0.0 | 3.13 -Comm | 1.3393 | 1.3393 | 1.3393 | 0.0 | 1.53 -Output | 0.029473 | 0.029473 | 0.029473 | 0.0 | 0.03 -Modify | 16.598 | 16.598 | 16.598 | 0.0 | 18.92 -Other | | 0.9233 | | | 1.05 +Pair | 63.448 | 63.448 | 63.448 | 0.0 | 74.48 +Neigh | 2.7318 | 2.7318 | 2.7318 | 0.0 | 3.21 +Comm | 1.2139 | 1.2139 | 1.2139 | 0.0 | 1.43 +Output | 0.030165 | 0.030165 | 0.030165 | 0.0 | 0.04 +Modify | 16.878 | 16.878 | 16.878 | 0.0 | 19.81 +Other | | 0.8845 | | | 1.04 Nlocal: 2000 ave 2000 max 2000 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -1169,4 +1171,4 @@ Ave neighs/atom = 4.8175 Neighbor list builds = 3285 Dangerous builds = 0 -Total wall time: 0:01:27 +Total wall time: 0:01:25 diff --git a/examples/granular/log.15Sep22.pour.heat.g++.4 b/examples/granular/log.15Sep22.pour.heat.g++.4 index f159302d65..864a7898c3 100644 --- a/examples/granular/log.15Sep22.pour.heat.g++.4 +++ b/examples/granular/log.15Sep22.pour.heat.g++.4 @@ -1,10 +1,10 @@ -LAMMPS (15 Sep 2022) +LAMMPS (22 Dec 2022) # pour one types of particles into cylinder and oscillate # temperature of the bottom plate variable name string heat_plate -atom_style sphere/temp +atom_style sphere units lj ############################################### @@ -76,9 +76,11 @@ region insreg cylinder z 5 5 4.45 ${drum_height} ${boxz} region insreg cylinder z 5 5 4.45 30 ${boxz} region insreg cylinder z 5 5 4.45 30 50 -fix 0 all balance 100 1.0 shift xy 5 1.1 -fix 1 all nve/sphere -fix 2 all heat/flow/sphere/temp constant 1.0 +fix 0 all property/atom temperature heatflow +WARNING: Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost communication (../fix_property_atom.cpp:196) +fix 1 all balance 100 1.0 shift xy 5 1.1 +fix 2 all nve/sphere +fix 3 all heat/flow constant 1.0 fix grav all gravity 10 vector 0 0 -1 fix ins1 all pour 1000 1 1234 region insreg diam range ${dlo} ${dhi} dens ${dens} ${dens} fix ins1 all pour 1000 1 1234 region insreg diam range 0.5 ${dhi} dens ${dens} ${dens} @@ -101,8 +103,8 @@ neigh_modify delay 0 every 1 check yes variable oscillate equal 1.0*sin(step*0.0001) -fix 3 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall -fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate +fix 4 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji region curved_wall +fix 5 all wall/gran/region granular hertz/material 1e5 0.1 0.3 tangential mindlin NULL 1.0 0.5 damping tsuji heat area 5.0 region bottom_wall temperature v_oscillate thermo_style custom step atoms ke pxx pyy pzz thermo_modify lost warn @@ -1142,20 +1144,20 @@ WARNING: Less insertions than requested (../fix_pour.cpp:681) 99800 2000 -0 7.5931492 7.7670928 6.2908349 99900 2000 -0 7.5931443 7.7670902 6.29084 100000 2000 -0 7.5931395 7.7670875 6.2908449 -Loop time of 28.4684 on 4 procs for 100000 steps with 2000 atoms +Loop time of 29.8443 on 4 procs for 100000 steps with 2000 atoms -Performance: 303494.659 tau/day, 3512.670 timesteps/s, 7.025 Matom-step/s -96.7% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 289502.519 tau/day, 3350.724 timesteps/s, 6.701 Matom-step/s +96.9% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 14.471 | 15.426 | 16.874 | 24.3 | 54.19 -Neigh | 0.50185 | 0.52867 | 0.55379 | 3.1 | 1.86 -Comm | 5.277 | 6.8933 | 7.8956 | 40.4 | 24.21 -Output | 0.019683 | 0.022775 | 0.031664 | 3.4 | 0.08 -Modify | 4.7145 | 4.8537 | 5.0111 | 6.1 | 17.05 -Other | | 0.7439 | | | 2.61 +Pair | 14.343 | 15.321 | 16.586 | 22.2 | 51.34 +Neigh | 0.50641 | 0.541 | 0.58175 | 3.8 | 1.81 +Comm | 4.9356 | 6.3418 | 7.3742 | 38.3 | 21.25 +Output | 0.019257 | 0.022039 | 0.029648 | 3.0 | 0.07 +Modify | 6.8727 | 6.9724 | 7.084 | 2.9 | 23.36 +Other | | 0.6461 | | | 2.16 Nlocal: 500 ave 504 max 496 min Histogram: 2 0 0 0 0 0 0 0 0 2 @@ -1169,4 +1171,4 @@ Ave neighs/atom = 4.8195 Neighbor list builds = 3151 Dangerous builds = 0 -Total wall time: 0:00:28 +Total wall time: 0:00:29 diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index d62f914577..f9ad309f98 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -67,6 +67,7 @@ FixHeatFlow::FixHeatFlow(LAMMPS *lmp, int narg, char **arg) : int FixHeatFlow::setmask() { int mask = 0; + mask |= PRE_FORCE; mask |= FINAL_INTEGRATE; mask |= FINAL_INTEGRATE_RESPA; return mask; @@ -88,9 +89,8 @@ void FixHeatFlow::init() void FixHeatFlow::setup(int /*vflag*/) { - // Identify whether this is the first/last instance of fix heat/flow + // Identify whether this is the first instance of fix heat/flow first_flag = 0; - last_flag = 0; int i = 0; auto fixlist = modify->get_fix_by_style("heat/flow"); @@ -100,7 +100,26 @@ void FixHeatFlow::setup(int /*vflag*/) } if (i == 0) first_flag = 1; - if ((i + 1) == fixlist.size()) last_flag = 1; +} + +/* ---------------------------------------------------------------------- */ + +void FixHeatFlow::setup_pre_force(int /*vflag*/) +{ + pre_force(0); +} + +/* ---------------------------------------------------------------------- */ + +void FixHeatFlow::pre_force(int /*vflag*/) +{ + // send updated temperatures to ghosts if first instance of fix + // then clear heatflow for next force calculation + double *heatflow = atom->heatflow; + if (first_flag) { + comm->forward_comm(this); + for (int i = 0; i < atom->nmax; i++) heatflow[i] = 0.0; + } } /* ---------------------------------------------------------------------- */ @@ -133,13 +152,6 @@ void FixHeatFlow::final_integrate() temperature[i] += dt * heatflow[i] / (calc_cp(i) * mass[type[i]]); } } - - // send updated temperatures to ghosts if last instance of fix - // then clear heatflow for next force calculation - if (last_flag) { - comm->forward_comm(this); - for (int i = 0; i < atom->nmax; i++) heatflow[i] = 0.0; - } } /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/fix_heat_flow.h b/src/GRANULAR/fix_heat_flow.h index 2d311d0104..5a06eed4d3 100644 --- a/src/GRANULAR/fix_heat_flow.h +++ b/src/GRANULAR/fix_heat_flow.h @@ -31,6 +31,8 @@ class FixHeatFlow : public Fix { int setmask() override; void init() override; void setup(int) override; + void setup_pre_force(int) override; + void pre_force(int) override; void final_integrate() override; void final_integrate_respa(int, int) override; int pack_forward_comm(int, int *, double *, int, int *) override; @@ -43,7 +45,7 @@ class FixHeatFlow : public Fix { double dt; double cp, *cp_type; int cp_style; - int first_flag, last_flag; + int first_flag; double calc_cp(int); }; From f1539d0ef52f9f0644a8b8258135f5980adeb821 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 16 Mar 2023 17:53:58 -0400 Subject: [PATCH 57/57] silence compiler warnings --- src/GRANULAR/fix_heat_flow.cpp | 16 +++++----------- src/GRANULAR/fix_wall_gran.cpp | 2 +- src/GRANULAR/fix_wall_gran_region.cpp | 2 +- src/GRANULAR/gran_sub_mod_tangential.cpp | 3 +-- src/GRANULAR/pair_granular.cpp | 4 +--- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/GRANULAR/fix_heat_flow.cpp b/src/GRANULAR/fix_heat_flow.cpp index f9ad309f98..a9c110a2e7 100644 --- a/src/GRANULAR/fix_heat_flow.cpp +++ b/src/GRANULAR/fix_heat_flow.cpp @@ -156,7 +156,7 @@ void FixHeatFlow::final_integrate() /* ---------------------------------------------------------------------- */ -void FixHeatFlow::final_integrate_respa(int ilevel, int /*iloop*/) +void FixHeatFlow::final_integrate_respa(int /*ilevel*/, int /*iloop*/) { dt = update->dt; final_integrate(); @@ -215,13 +215,11 @@ void FixHeatFlow::unpack_forward_comm(int n, int first, double *buf) int FixHeatFlow::pack_reverse_comm(int n, int first, double *buf) { - int i,k,last; - int m = 0; - last = first + n; + int last = first + n; double *heatflow = atom->heatflow; - for (i = first; i < last; i++) { + for (int i = first; i < last; i++) { buf[m++] = heatflow[i]; } @@ -232,13 +230,9 @@ int FixHeatFlow::pack_reverse_comm(int n, int first, double *buf) void FixHeatFlow::unpack_reverse_comm(int n, int *list, double *buf) { - int i,j,k,kk,ncount; - int m = 0; double *heatflow = atom->heatflow; - for (i = 0; i < n; i++) { - j = list[i]; - heatflow[j] += buf[m++]; - } + for (int i = 0; i < n; i++) + heatflow[list[i]] += buf[m++]; } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 7029074fe8..8ebe2d5a4c 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -452,7 +452,7 @@ void FixWallGran::post_force(int /*vflag*/) } for (int i = 0; i < nlocal; i++) { - if (! mask[i] & groupbit) continue; + if ((!mask[i]) & groupbit) continue; dx = dy = dz = 0.0; diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 57f84e26cb..02cbd94510 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -195,7 +195,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) } for (i = 0; i < nlocal; i++) { - if (! mask[i] & groupbit) continue; + if ((!mask[i]) & groupbit) continue; if (! region->match(x[i][0], x[i][1], x[i][2])) continue; nc = region->surface(x[i][0], x[i][1], x[i][2], model->pulloff_distance(radius[i], 0.0)); diff --git a/src/GRANULAR/gran_sub_mod_tangential.cpp b/src/GRANULAR/gran_sub_mod_tangential.cpp index 677ba4d363..ed7704349d 100644 --- a/src/GRANULAR/gran_sub_mod_tangential.cpp +++ b/src/GRANULAR/gran_sub_mod_tangential.cpp @@ -174,9 +174,8 @@ GranSubModTangentialLinearHistoryClassic::GranSubModTangentialLinearHistoryClass void GranSubModTangentialLinearHistoryClassic::calculate_forces() { - double magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl; + double magfs, magfs_inv, rsht, shrmag; double temp_array[3]; - int frame_update = 0; damp = xt * gm->damping_model->damp_prefactor; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index c4711d6f59..85cee11564 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -685,7 +685,7 @@ void PairGranular::reset_dt() /* ---------------------------------------------------------------------- */ double PairGranular::single(int i, int j, int itype, int jtype, - double rsq, double /* factor_coul */, + double /*rsq*/, double /* factor_coul */, double factor_lj, double &fforce) { if (factor_lj == 0) { @@ -764,8 +764,6 @@ double PairGranular::single(int i, int j, int itype, int jtype, model->calculate_forces(); double *forces = model->forces; - double *torquesi = model->torquesi; - double *torquesj = model->torquesj; // apply forces & torques fforce = MathExtra::len3(forces);