Unverified Commit 27510f31 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

change formatting to closer resemble LAMMPS common source code format style

parent d278cfe2
Loading
Loading
Loading
Loading
+82 −104
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ enum{NONE,CONSTANT,EQUAL};

enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR};
enum {VELOCITY, VISCOELASTIC, TSUJI};
enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE};
enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY,
      TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE};
enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL};
enum {ROLL_NONE, ROLL_SDS};

@@ -64,7 +65,8 @@ enum {ROLL_NONE, ROLL_SDS};
/* ---------------------------------------------------------------------- */

FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
          Fix(lmp, narg, arg), idregion(NULL), history_one(NULL), fix_rigid(NULL), mass_rigid(NULL)
  Fix(lmp, narg, arg), idregion(NULL), history_one(NULL),
  fix_rigid(NULL), mass_rigid(NULL)
{
  if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command");

@@ -116,8 +118,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
      kt /= force->nktv2p;
    }
    iarg = 10;
  }
  else {
  } else {
    iarg = 4;
    damping_model = VISCOELASTIC;
    roll_model = twist_model = NONE;
@@ -128,16 +129,14 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
        normal_coeffs[0] = force->numeric(FLERR,arg[iarg+1]); //kn
        normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping
        iarg += 3;
      }
      else if (strcmp(arg[iarg], "hertz") == 0){
      } 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] = force->numeric(FLERR,arg[iarg+1]); //kn
        normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping
        iarg += num_coeffs+1;
      }
      else if (strcmp(arg[iarg], "hertz/material") == 0){
      } 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;
@@ -147,8 +146,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
        normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS;
        normal_coeffs[2] = poiss;
        iarg += num_coeffs+1;
      }
      else if (strcmp(arg[iarg], "dmt") == 0){
      } 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 = force->numeric(FLERR,arg[iarg+1]); //E
@@ -158,8 +156,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
        normal_coeffs[2] = poiss;
        normal_coeffs[3] = force->numeric(FLERR,arg[iarg+4]); //cohesion
        iarg += 5;
      }
      else if (strcmp(arg[iarg], "jkr") == 0){
      } 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");
        beyond_contact = 1;
        normal_model = JKR;
@@ -170,25 +167,20 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
        normal_coeffs[2] = poiss;
        normal_coeffs[3] = force->numeric(FLERR,arg[iarg+4]); //cohesion
        iarg += 5;
      }
      else if (strcmp(arg[iarg], "damping") == 0){
      } 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], "viscoelastic") == 0){
        } else if (strcmp(arg[iarg+1], "viscoelastic") == 0) {
          damping_model = VISCOELASTIC;
          iarg += 1;
        }
        else if (strcmp(arg[iarg+1], "tsuji") == 0){
        } else if (strcmp(arg[iarg+1], "tsuji") == 0) {
          damping_model = TSUJI;
          iarg += 1;
        }
        else error->all(FLERR, "Illegal wall/gran command, unrecognized damping model");
        } else error->all(FLERR, "Illegal wall/gran command, unrecognized damping model");
        iarg += 1;
      }
      else if (strcmp(arg[iarg], "tangential") == 0){
      } 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");
@@ -197,8 +189,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
          tangential_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //gammat
          tangential_coeffs[2] = force->numeric(FLERR,arg[iarg+3]); //friction coeff.
          iarg += 4;
        }
        else if ((strcmp(arg[iarg+1], "linear_history") == 0) ||
        } else if ((strcmp(arg[iarg+1], "linear_history") == 0) ||
            (strcmp(arg[iarg+1], "mindlin") == 0) ||
            (strcmp(arg[iarg+1], "mindlin_rescale") == 0)) {
          if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for tangential model");
@@ -211,26 +202,22 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
              error->all(FLERR, "NULL setting for Mindlin tangential stiffness requires a normal contact model that specifies material properties");
            }
            tangential_coeffs[0] = 4*(2-poiss)*(1+poiss)/Emod;
          }
          else{
          } else {
            tangential_coeffs[0] = force->numeric(FLERR,arg[iarg+2]); //kt
          }
          tangential_history = 1;
          tangential_coeffs[1] = force->numeric(FLERR,arg[iarg+3]); //gammat
          tangential_coeffs[2] = force->numeric(FLERR,arg[iarg+4]); //friction coeff.
          iarg += 5;
        }
        else{
        } else {
          error->all(FLERR, "Illegal pair_coeff command, tangential model not recognized");
        }
      }
      else if (strcmp(arg[iarg], "rolling") == 0){
      } 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){
        } 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;
@@ -238,23 +225,19 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
          roll_coeffs[1] = force->numeric(FLERR,arg[iarg+3]); //gammaR
          roll_coeffs[2] = force->numeric(FLERR,arg[iarg+4]); //rolling friction coeff.
          iarg += 5;
        }
        else{
        } else {
          error->all(FLERR, "Illegal wall/gran command, rolling friction model not recognized");
        }
      }
      else if (strcmp(arg[iarg], "twisting") == 0){
      } 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){
        } 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){
        } 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;
@@ -262,19 +245,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
          twist_coeffs[1] = force->numeric(FLERR,arg[iarg+3]); //gammat
          twist_coeffs[2] = force->numeric(FLERR,arg[iarg+4]); //friction coeff.
          iarg += 5;
        }
        else{
        } else {
          error->all(FLERR, "Illegal wall/gran command, twisting friction model not recognized");
        }
      }
      else if (strcmp(arg[iarg], "xplane") == 0 ||
      } else if (strcmp(arg[iarg], "xplane") == 0 ||
          strcmp(arg[iarg], "yplane") == 0 ||
          strcmp(arg[iarg], "zplane") == 0 ||
          strcmp(arg[iarg], "zcylinder") == 0 ||
          strcmp(arg[iarg], "region") == 0) {
        break;
      }
      else{
      } else {
        error->all(FLERR, "Illegal fix wall/gran command");
      }
    }
@@ -1056,7 +1036,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz,
 double fs, fs1, fs2, fs3;

 double tor1,tor2,tor3;
 double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3,vrlmag,vrlmaginv;
 double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3;

 //For JKR
 double R2, coh, F_pulloff, a, a2, E;
@@ -1277,9 +1257,6 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz,
   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;
   vrlmag = sqrt(vrl1*vrl1+vrl2*vrl2+vrl3*vrl3);
   if (vrlmag != 0.0) vrlmaginv = 1.0/vrlmag;
   else vrlmaginv = 0.0;

   int rhist0 = roll_history_index;
   int rhist1 = rhist0 + 1;
@@ -1558,7 +1535,8 @@ void FixWallGran::reset_dt()
  dt = update->dt;
}

double FixWallGran::pulloff_distance(double radius){
double FixWallGran::pulloff_distance(double radius)
{
  double coh, E, a, dist;
  coh = normal_coeffs[3];
  E = normal_coeffs[0]*THREEQUARTERS;
+9 −9
Original line number Diff line number Diff line
@@ -46,17 +46,17 @@ class FixWallGran : public Fix {
  virtual int maxsize_restart();
  void reset_dt();

  void hooke(double, double, double, double, double *,
      double *, double *, double *, double *, double, double, double*);
  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 *);
                     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 *, double *, double *, double *, double,
                double, double *, double *);

  double pulloff_distance(double);