Renaming files/classes, other small, misc updates

This commit is contained in:
jtclemm
2022-11-10 16:06:36 -07:00
parent ea8ded470b
commit d1dd8d3c11
28 changed files with 468 additions and 459 deletions

View File

@ -95,27 +95,27 @@ function(RegisterIntegrateStyle path)
endfunction(RegisterIntegrateStyle) endfunction(RegisterIntegrateStyle)
function(RegisterStyles search_path) function(RegisterStyles search_path)
FindStyleHeaders(${search_path} ANGLE_CLASS angle_ ANGLE ) # angle ) # force 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} 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} BODY_CLASS body_ BODY ) # body ) # atom_vec_body
FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force FindStyleHeaders(${search_path} BOND_CLASS bond_ BOND ) # bond ) # force
FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input FindStyleHeaders(${search_path} COMMAND_CLASS "[^.]" COMMAND ) # command ) # input
FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify FindStyleHeaders(${search_path} COMPUTE_CLASS compute_ COMPUTE ) # compute ) # modify
FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force
FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump
FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify
FindStyleHeaders(${search_path} GSM_CLASS gsm_ GSM ) # gsm ) # granular_model 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} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force
FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update
FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force
FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update FindStyleHeaders(${search_path} MINIMIZE_CLASS min_ MINIMIZE ) # minimize ) # update
FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor FindStyleHeaders(${search_path} NBIN_CLASS nbin_ NBIN ) # nbin ) # neighbor
FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor FindStyleHeaders(${search_path} NPAIR_CLASS npair_ NPAIR ) # npair ) # neighbor
FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor FindStyleHeaders(${search_path} NSTENCIL_CLASS nstencil_ NSTENCIL ) # nstencil ) # neighbor
FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor FindStyleHeaders(${search_path} NTOPO_CLASS ntopo_ NTOPO ) # ntopo ) # neighbor
FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force FindStyleHeaders(${search_path} PAIR_CLASS pair_ PAIR ) # pair ) # force
FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump FindStyleHeaders(${search_path} READER_CLASS reader_ READER ) # reader ) # read_dump
FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain
endfunction(RegisterStyles) endfunction(RegisterStyles)
function(RegisterStylesExt search_path extension sources) function(RegisterStylesExt search_path extension sources)

View File

@ -34,6 +34,6 @@ style requirements and recommendations <Modify_style>`.
Modify_min Modify_min
Modify_region Modify_region
Modify_body Modify_body
Modify_gsm Modify_gran_sub_mod
Modify_thermo Modify_thermo
Modify_variable Modify_variable

View File

@ -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 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 GranularModel class. The GranularModel class organizes the details of an
interaction using a series of granular sub-models 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 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 * GranSubModNormal: normal force sub-model
* GSMDamping: normal damping sub-model * GranSubModDamping: normal damping sub-model
* GSMTangential: tangential forces and sliding friction sub-model * GranSubModTangential: tangential forces and sliding friction sub-model
* GSMRolling: rolling friction sub-model * GranSubModRolling: rolling friction sub-model
* GSMTwisting: twisting friction sub-model * GranSubModTwisting: twisting friction sub-model
* GSMHeat: heat conduction sub-model * GranSubModHeat: heat conduction sub-model
For each type of sub-model, 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 a specific implementation. For instance, from the GranSubModNormal class the
GSMNormalHooke, GSMNormalHertz, and GSMNormalJKR classes are derived which GranSubModNormalHooke, GranSubModNormalHertz, and GranSubModNormalJKR classes
calculate Hookean, Hertzian, or JKR normal forces, respectively. This modular are derived which calculate Hookean, Hertzian, or JKR normal forces, respectively.
structure simplifies the addition of new granular contact models as as one only This modular structure simplifies the addition of new granular contact models as
needs to create a new GSM class without having to modify the more complex as one onlyneeds to create a new GranSubMod class without having to modify the more
PairGranular, FixGranWall, and GranularModel classes. Most GSM methods are also complex PairGranular, FixGranWall, and GranularModel classes. Most GranSubMod methods
already defined by the parent classes so new contact models typically only require are also already defined by the parent classes so new contact models typically only
edits to a few relevant methods (e.g. methods that define coefficients and require edits to a few relevant methods (e.g. methods that define coefficients and
calculate forces). 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 class which owns it, ``lmp`` and ``gm``, respectively. The GranularModel class
includes several public variables that describe the geometry/dynamics of the includes several public variables that describe the geometry/dynamics of the
contact such as 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 and ``GranularModel->calculate_forces()`` methods which can be referred to for more
details. details.
To create a new GSM class, it is recommended that one first looks at similar GSM To create a new GranSubMod class, it is recommended that one first looks at similar
classes. All GSM classes share several general methods which may need to be defined GranSubMod classes. All GranSubMod classes share several general methods which may
need to be defined
.. list-table:: .. 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. - 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. - Parses coefficients to define local variables. Run once at model construction.
* - ``GSM->init()`` * - ``GranSubMod->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. - 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 There are also several type-specific methods
.. list-table:: .. list-table::
* - ``GSMNormal->touch()`` * - ``GranSubModNormal->touch()``
- Optional method to test when particles are in contact. By default, this is when particles overlap. - 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. - 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. - 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. - 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 - Required method that returns the normal contact force
* - ``GSMDamping->calculate_forces()`` * - ``GranSubModDamping->calculate_forces()``
- Required method that returns the normal damping force - Required method that returns the normal damping force
* - ``GSMTangential->calculate_forces()`` * - ``GranSubModTangential->calculate_forces()``
- Required method that calculates tangential forces/torques - Required method that calculates tangential forces/torques
* - ``GSMTwisting->calculate_forces()`` * - ``GranSubModTwisting->calculate_forces()``
- Required method that calculates twisting friction forces/torques - Required method that calculates twisting friction forces/torques
* - ``GSMRolling->calculate_forces()`` * - ``GranSubModRolling->calculate_forces()``
- Required method that calculates rolling friction forces/torques - Required method that calculates rolling friction forces/torques
* - ``GSMHeat->calculate_heat()`` * - ``GranSubModHeat->calculate_heat()``
- Required method that returns the rate of heat flow - Required method that returns the rate of heat flow
As an example, say one wanted to create a new normal force option that consisted 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 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++ .. code-block:: c++
#ifdef GSM_CLASS #ifdef GranSubMod_CLASS
// clang-format off // clang-format off
GSMStyle(hooke/piecewise, GranSubModStyle(hooke/piecewise,
GSMNormalHookePiecewise, GranSubModNormalHookePiecewise,
NORMAL); NORMAL);
// clang-format on // clang-format on
#else #else
#ifndef GSM_CUSTOM_H_ #ifndef GRAN_SUB_MOD_CUSTOM_H_
#define GSM_CUSTOM_H_ #define GRAN_SUB_MOD_CUSTOM_H_
#include "gsm.h" #include "gran_sub_mod.h"
#include "gsm_normal.h" #include "gran_sub_mod_normal.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMNormalHookePiecewise : public GSMNormal { class GranSubModNormalHookePiecewise : public GranSubModNormal {
public: public:
GSMNormalHookePiecewise(class GranularModel *, class LAMMPS *); GranSubModNormalHookePiecewise(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
double calculate_forces(); double calculate_forces();
protected: protected:
@ -131,29 +132,29 @@ set of files ``gsm_custom.h``:
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_CUSTOM_H_ */ #endif /*GRAN_SUB_MOD_CUSTOM_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */
and ``gsm_custom.cpp`` and ``gran_sub_mod_custom.cpp``
.. code-block:: c++ .. code-block:: c++
#include "gsm_custom.h" #include "gran_sub_mod_custom.h"
#include "gsm_normal.h" #include "gran_sub_mod_normal.h"
#include "granular_model.h" #include "granular_model.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace Granular_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; num_coeffs = 4;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSMNormalHookePiecewise::coeffs_to_local() void GranSubModNormalHookePiecewise::coeffs_to_local()
{ {
k1 = coeffs[0]; k1 = coeffs[0];
k2 = coeffs[1]; k2 = coeffs[1];
@ -163,7 +164,7 @@ and ``gsm_custom.cpp``
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double GSMNormalHookePiecewise::calculate_forces() double GranSubModNormalHookePiecewise::calculate_forces()
{ {
double Fne; double Fne;
if (gm->delta >= delta_switch) { if (gm->delta >= delta_switch) {

View File

@ -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 Syntax
@ -8,10 +8,10 @@ Syntax
.. parsed-literal:: .. 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 <fix>` command * ID, group-ID are documented in :doc:`fix <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 * one style with corresponding value(s) needs to be listed
.. parsed-literal:: .. parsed-literal::
@ -29,8 +29,8 @@ Examples
.. code-block:: LAMMPS .. code-block:: LAMMPS
fix 1 all temp/integrate constant 1.0 fix 1 all heat/flow/sphere/temp constant 1.0
fix 1 all temp/integrate type 1.0 0.5 fix 1 all heat/flow/sphere/temp type 1.0 0.5
Description Description
""""""""""" """""""""""

32
src/.gitignore vendored
View File

@ -1533,8 +1533,8 @@
/fix_srp.h /fix_srp.h
/fix_srp_react.cpp /fix_srp_react.cpp
/fix_srp_react.h /fix_srp_react.h
/fix_temp_integrate.cpp /fix_heat_flow_sphere_temp.cpp
/fix_temp_integrate.h /fix_heat_flow_sphere_temp.h
/fix_tfmc.cpp /fix_tfmc.cpp
/fix_tfmc.h /fix_tfmc.h
/fix_ttm.cpp /fix_ttm.cpp
@ -1545,20 +1545,20 @@
/fix_ttm_mod.h /fix_ttm_mod.h
/granular_model.cpp /granular_model.cpp
/granular_model.h /granular_model.h
/gsm_normal.cpp /gran_sub_mod_normal.cpp
/gsm_normal.h /gran_sub_mod_normal.h
/gsm_damping.cpp /gran_sub_mod_damping.cpp
/gsm_damping.h /gran_sub_mod_damping.h
/gsm_tangential.cpp /gran_sub_mod_tangential.cpp
/gsm_tangential.h /gran_sub_mod_tangential.h
/gsm_twisting.cpp /gran_sub_mod_twisting.cpp
/gsm_twisting.h /gran_sub_mod_twisting.h
/gsm_rolling.cpp /gran_sub_mod_rolling.cpp
/gsm_rolling.h /gran_sub_mod_rolling.h
/gsm_heat.cpp /gran_sub_mod_heat.cpp
/gsm_heat.h /gran_sub_mod_heat.h
/gsm.cpp /gran_sub_mod.cpp
/gsm.h /gran_sub_mod.h
/pair_born_coul_long_cs.cpp /pair_born_coul_long_cs.cpp
/pair_born_coul_long_cs.h /pair_born_coul_long_cs.h
/pair_born_coul_dsf_cs.cpp /pair_born_coul_dsf_cs.cpp

View File

@ -12,7 +12,7 @@
See the README file in the top-level LAMMPS directory. 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 "atom.h"
#include "error.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) Fix(lmp, narg, arg)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix command"); 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) if (cp_style == NONE)
error->all(FLERR, "Must specify specific heat in fix temp/integrate"); error->all(FLERR, "Must specify specific heat in fix temp/integrate");
dynamic_group_allow = 1; dynamic_group_allow = 1;
time_integrate = 1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int FixTempIntegrate::setmask() int FixHeatFlowSphereTemp::setmask()
{ {
int mask = 0; int mask = 0;
mask |= FINAL_INTEGRATE; mask |= FINAL_INTEGRATE;
@ -71,7 +70,7 @@ int FixTempIntegrate::setmask()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixTempIntegrate::init() void FixHeatFlowSphereTemp::init()
{ {
dt = update->dt; dt = update->dt;
@ -83,7 +82,7 @@ void FixTempIntegrate::init()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixTempIntegrate::final_integrate() void FixHeatFlowSphereTemp::final_integrate()
{ {
// update temperature of atoms in group // 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; dt = update->dt;
final_integrate(); 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; dt = update->dt;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double FixTempIntegrate::calc_cp(int i) double FixHeatFlowSphereTemp::calc_cp(int i)
{ {
if (cp_style == TYPE) { if (cp_style == TYPE) {
return cp_type[atom->type[i]]; return cp_type[atom->type[i]];

View File

@ -13,20 +13,20 @@
#ifdef FIX_CLASS #ifdef FIX_CLASS
// clang-format off // clang-format off
FixStyle(temp/integrate,FixTempIntegrate); FixStyle(heat/flow/sphere/temp,FixHeatFlowSphereTemp);
// clang-format on // clang-format on
#else #else
#ifndef LMP_FIX_TEMP_INTEGRATE_H #ifndef LMP_FIX_HEAT_FLOW_SPHERE_TEMP_H
#define LMP_FIX_TEMP_INTEGRATE_H #define LMP_FIX_HEAT_FLOW_SPHERE_TEMP_H
#include "fix.h" #include "fix.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class FixTempIntegrate : public Fix { class FixHeatFlowSphereTemp : public Fix {
public: public:
FixTempIntegrate(class LAMMPS *, int, char **); FixHeatFlowSphereTemp(class LAMMPS *, int, char **);
int setmask() override; int setmask() override;
void init() override; void init() override;

View File

@ -21,7 +21,7 @@
#include "atom.h" #include "atom.h"
#include "granular_model.h" #include "granular_model.h"
#include "gsm.h" #include "gran_sub_mod.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "input.h" #include "input.h"

View File

@ -25,6 +25,10 @@ FixStyle(wall/gran,FixWallGran);
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS {
class GranularModel;
}
class FixWallGran : public Fix { class FixWallGran : public Fix {
public: public:
FixWallGran(class LAMMPS *, int, char **); FixWallGran(class LAMMPS *, int, char **);
@ -53,7 +57,7 @@ class FixWallGran : public Fix {
bigint time_origin; bigint time_origin;
// for granular model choices // for granular model choices
Granular_NS::GranularModel *model; class Granular_NS::GranularModel *model;
double lo, hi, cylradius; double lo, hi, cylradius;
double amplitude, period, omega, vshear; double amplitude, period, omega, vshear;

View File

@ -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 normal, damping, tangential, rolling, twisting, and heat
These are used to calculate forces/torques/etc based on contact geometry These are used to calculate forces/torques/etc based on contact geometry
@ -21,7 +21,7 @@
Dan Bolintineanu (SNL), Joel Clemmer (SNL) Dan Bolintineanu (SNL), Joel Clemmer (SNL)
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#include "gsm.h" #include "gran_sub_mod.h"
#include "error.h" #include "error.h"
#include "utils.h" #include "utils.h"
@ -32,7 +32,7 @@ using namespace Granular_NS;
Parent class for all types of granular submodels 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; this->gm = gm;
@ -51,7 +51,7 @@ GSM::GSM(class GranularModel *gm, LAMMPS *lmp) : Pointers(lmp)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
GSM::~GSM() GranSubMod::~GranSubMod()
{ {
if (allocated) delete [] coeffs; if (allocated) delete [] coeffs;
delete [] transfer_history_factor; delete [] transfer_history_factor;
@ -59,7 +59,7 @@ GSM::~GSM()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSM::allocate_coeffs() void GranSubMod::allocate_coeffs()
{ {
allocated = 1; allocated = 1;
coeffs = new double[num_coeffs]; 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++) for (int i = 0; i < num_coeffs; i++)
coeffs[i] = mix_geom(icoeffs[i], jcoeffs[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) 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 pois1, double pois2)
{ {
double factor1 = (1 - pois1 * pois1) / E1; double factor1 = (1 - pois1 * pois1) / E1;
@ -90,7 +90,7 @@ double GSM::mix_stiffnessE(double E1, double E2,
mixing of shear modulus (G) 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 pois1, double pois2)
{ {
double factor1 = 2 * (2 - pois1) * (1 + pois1) / E1; 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 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); double factor = 2 * (1 - pois);
return E / factor; return E / factor;
@ -112,7 +112,7 @@ double GSM::mix_stiffnessE_wall(double E, double pois)
mixing of shear modulus (G) for walls 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); double factor = 32.0 * (2 - pois) * (1 + pois);
return E / factor; return E / factor;
@ -122,7 +122,7 @@ double GSM::mix_stiffnessG_wall(double E, double pois)
mixing of everything else mixing of everything else
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double GSM::mix_geom(double val1, double val2) double GranSubMod::mix_geom(double val1, double val2)
{ {
return sqrt(val1 * val2); return sqrt(val1 * val2);
} }

View File

@ -11,8 +11,8 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifndef LMP_GSM_H_ #ifndef LMP_GRAN_SUB_MOD_H_
#define LMP_GSM_H_ #define LMP_GRAN_SUB_MOD_H_
#include "granular_model.h" #include "granular_model.h"
#include "pointers.h" // IWYU pragma: export #include "pointers.h" // IWYU pragma: export
@ -20,10 +20,10 @@
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSM : protected Pointers { class GranSubMod : protected Pointers {
public: public:
GSM(class GranularModel *, class LAMMPS *); GranSubMod(class GranularModel *, class LAMMPS *);
virtual ~GSM(); virtual ~GranSubMod();
int num_coeffs; int num_coeffs;
double *coeffs; double *coeffs;
@ -59,4 +59,4 @@ class GSM : protected Pointers {
} // namespace GranularModel } // namespace GranularModel
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /* GSM_H_ */ #endif /* GRAN_SUB_MOD_H_ */

View File

@ -12,8 +12,8 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "gsm_damping.h" #include "gran_sub_mod_damping.h"
#include "gsm_normal.h" #include "gran_sub_mod_normal.h"
#include "granular_model.h" #include "granular_model.h"
#include "math_special.h" #include "math_special.h"
@ -25,11 +25,11 @@ using namespace MathSpecial;
Default damping model 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; damp = gm->normal_model->damp;
} }
@ -38,11 +38,11 @@ void GSMDamping::init()
No model 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; damp_prefactor = 0.0;
return 0.0; return 0.0;
@ -52,11 +52,11 @@ double GSMDampingNone::calculate_forces()
Velocity damping 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; damp_prefactor = damp;
return -damp_prefactor * gm->vnnr; return -damp_prefactor * gm->vnnr;
@ -66,11 +66,11 @@ double GSMDampingVelocity::calculate_forces()
Mass velocity damping 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; damp_prefactor = damp * gm->meff;
return -damp_prefactor * gm->vnnr; return -damp_prefactor * gm->vnnr;
@ -80,14 +80,14 @@ double GSMDampingMassVelocity::calculate_forces()
Default, viscoelastic damping Default, viscoelastic damping
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMDampingViscoelastic::GSMDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) GranSubModDampingViscoelastic::GranSubModDampingViscoelastic(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp)
{ {
area_flag = 1; area_flag = 1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double GSMDampingViscoelastic::calculate_forces() double GranSubModDampingViscoelastic::calculate_forces()
{ {
damp_prefactor = damp * gm->meff * gm->area; damp_prefactor = damp * gm->meff * gm->area;
return -damp_prefactor * gm->vnnr; return -damp_prefactor * gm->vnnr;
@ -97,14 +97,14 @@ double GSMDampingViscoelastic::calculate_forces()
Tsuji damping Tsuji damping
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMDampingTsuji::GSMDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GSMDamping(gm, lmp) GranSubModDampingTsuji::GranSubModDampingTsuji(GranularModel *gm, LAMMPS *lmp) : GranSubModDamping(gm, lmp)
{ {
allow_cohesion = 0; allow_cohesion = 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSMDampingTsuji::init() void GranSubModDampingTsuji::init()
{ {
double tmp = gm->normal_model->damp; double tmp = gm->normal_model->damp;
damp = 1.2728 - 4.2783 * tmp + 11.087 * square(tmp); 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); damp_prefactor = damp * sqrt(gm->meff * gm->Fnormal / gm->delta);
return -damp_prefactor * gm->vnnr; return -damp_prefactor * gm->vnnr;

View File

@ -11,43 +11,43 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef GSM_CLASS #ifdef GRAN_SUB_MOD_CLASS
// clang-format off // clang-format off
GSMStyle(none, GranSubModStyle(none,
GSMDampingNone, GranSubModDampingNone,
DAMPING); DAMPING);
GSMStyle(velocity, GranSubModStyle(velocity,
GSMDampingVelocity, GranSubModDampingVelocity,
DAMPING); DAMPING);
GSMStyle(mass_velocity, GranSubModStyle(mass_velocity,
GSMDampingMassVelocity, GranSubModDampingMassVelocity,
DAMPING); DAMPING);
GSMStyle(viscoelastic, GranSubModStyle(viscoelastic,
GSMDampingViscoelastic, GranSubModDampingViscoelastic,
DAMPING); DAMPING);
GSMStyle(tsuji, GranSubModStyle(tsuji,
GSMDampingTsuji, GranSubModDampingTsuji,
DAMPING); DAMPING);
// clang-format on // clang-format on
#else #else
#ifndef GSM_DAMPING_H_ #ifndef GRAN_SUB_MOD_DAMPING_H_
#define GSM_DAMPING_H_ #define GRAN_SUB_MOD_DAMPING_H_
#include "gsm.h" #include "gran_sub_mod.h"
#include "pointers.h" #include "pointers.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMDamping : public GSM { class GranSubModDamping : public GranSubMod {
public: public:
GSMDamping(class GranularModel *, class LAMMPS *); GranSubModDamping(class GranularModel *, class LAMMPS *);
~GSMDamping() {}; ~GranSubModDamping() {};
virtual void coeffs_to_local() {}; virtual void coeffs_to_local() {};
virtual void mix_coeffs(double*, double*) {}; virtual void mix_coeffs(double*, double*) {};
virtual void init(); virtual void init();
@ -59,42 +59,42 @@ class GSMDamping : public GSM {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMDampingNone : public GSMDamping { class GranSubModDampingNone : public GranSubModDamping {
public: public:
GSMDampingNone(class GranularModel *, class LAMMPS *); GranSubModDampingNone(class GranularModel *, class LAMMPS *);
void init() override {}; void init() override {};
double calculate_forces(); double calculate_forces();
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMDampingVelocity : public GSMDamping { class GranSubModDampingVelocity : public GranSubModDamping {
public: public:
GSMDampingVelocity(class GranularModel *, class LAMMPS *); GranSubModDampingVelocity(class GranularModel *, class LAMMPS *);
double calculate_forces(); double calculate_forces();
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMDampingMassVelocity : public GSMDamping { class GranSubModDampingMassVelocity : public GranSubModDamping {
public: public:
GSMDampingMassVelocity(class GranularModel *, class LAMMPS *); GranSubModDampingMassVelocity(class GranularModel *, class LAMMPS *);
double calculate_forces(); double calculate_forces();
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMDampingViscoelastic : public GSMDamping { class GranSubModDampingViscoelastic : public GranSubModDamping {
public: public:
GSMDampingViscoelastic(class GranularModel *, class LAMMPS *); GranSubModDampingViscoelastic(class GranularModel *, class LAMMPS *);
double calculate_forces(); double calculate_forces();
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMDampingTsuji : public GSMDamping { class GranSubModDampingTsuji : public GranSubModDamping {
public: public:
GSMDampingTsuji(class GranularModel *, class LAMMPS *); GranSubModDampingTsuji(class GranularModel *, class LAMMPS *);
void init() override; void init() override;
double calculate_forces(); double calculate_forces();
}; };
@ -102,5 +102,5 @@ class GSMDampingTsuji : public GSMDamping {
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_DAMPING_H_ */ #endif /*GRAN_SUB_MOD_DAMPING_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */

View File

@ -12,7 +12,7 @@
See the README file in the top-level LAMMPS directory. 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 "granular_model.h"
#include "error.h" #include "error.h"
@ -23,17 +23,17 @@ using namespace Granular_NS;
Default heat conduction 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 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; return 0.0;
} }
@ -42,7 +42,7 @@ double GSMHeatNone::calculate_heat()
Area-based heat conduction 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; num_coeffs = 1;
area_flag = 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]; 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); return conductivity * gm->area * (gm->Tj - gm->Ti);
} }

View File

@ -11,30 +11,30 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef GSM_CLASS #ifdef GRAN_SUB_MOD_CLASS
// clang-format off // clang-format off
GSMStyle(none, GranSubModStyle(none,
GSMHeatNone, GranSubModHeatNone,
HEAT); HEAT);
GSMStyle(area, GranSubModStyle(area,
GSMHeatArea, GranSubModHeatArea,
HEAT); HEAT);
// clang-format on // clang-format on
#else #else
#ifndef GSM_HEAT_H_ #ifndef GRAN_SUB_MOD_HEAT_H_
#define GSM_HEAT_H_ #define GRAN_SUB_MOD_HEAT_H_
#include "gsm.h" #include "gran_sub_mod.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMHeat : public GSM { class GranSubModHeat : public GranSubMod {
public: public:
GSMHeat(class GranularModel *, class LAMMPS *); GranSubModHeat(class GranularModel *, class LAMMPS *);
~GSMHeat() {}; ~GranSubModHeat() {};
virtual void coeffs_to_local() {}; virtual void coeffs_to_local() {};
virtual void init() {}; virtual void init() {};
virtual double calculate_heat() = 0; virtual double calculate_heat() = 0;
@ -42,17 +42,17 @@ class GSMHeat : public GSM {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMHeatNone : public GSMHeat { class GranSubModHeatNone : public GranSubModHeat {
public: public:
GSMHeatNone(class GranularModel *, class LAMMPS *); GranSubModHeatNone(class GranularModel *, class LAMMPS *);
double calculate_heat(); double calculate_heat();
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMHeatArea : public GSMHeat { class GranSubModHeatArea : public GranSubModHeat {
public: public:
GSMHeatArea(class GranularModel *, class LAMMPS *); GranSubModHeatArea(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
double calculate_heat(); double calculate_heat();
protected: protected:
@ -62,5 +62,5 @@ class GSMHeatArea : public GSMHeat {
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_HEAT_H_ */ #endif /*GRAN_SUB_MOD_HEAT_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */

View File

@ -12,7 +12,7 @@
See the README file in the top-level LAMMPS directory. 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 "granular_model.h"
#include "error.h" #include "error.h"
#include "math_const.h" #include "math_const.h"
@ -33,7 +33,7 @@ using namespace MathConst;
Default normal model Default normal model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMNormal::GSMNormal(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) GranSubModNormal::GranSubModNormal(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp)
{ {
material_properties = 0; material_properties = 0;
cohesive_flag = 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); bool touchflag = (gm->rsq < gm->radsum * gm->radsum);
return touchflag; 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 //called outside of compute(), do not assume correct geometry defined in contact
return radi + radj; 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); return sqrt(gm->dR);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSMNormal::set_fncrit() void GranSubModNormal::set_fncrit()
{ {
Fncrit = fabs(gm->Fntot); Fncrit = fabs(gm->Fntot);
} }
@ -73,11 +73,11 @@ void GSMNormal::set_fncrit()
No model 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; return 0.0;
} }
@ -86,14 +86,14 @@ double GSMNormalNone::calculate_forces()
Hookean normal force Hookean normal force
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMNormalHooke::GSMNormalHooke(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) GranSubModNormalHooke::GranSubModNormalHooke(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp)
{ {
num_coeffs = 2; num_coeffs = 2;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSMNormalHooke::coeffs_to_local() void GranSubModNormalHooke::coeffs_to_local()
{ {
k = coeffs[0]; k = coeffs[0];
damp = coeffs[1]; damp = coeffs[1];
@ -103,7 +103,7 @@ void GSMNormalHooke::coeffs_to_local()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double GSMNormalHooke::calculate_forces() double GranSubModNormalHooke::calculate_forces()
{ {
return k * gm->delta; return k * gm->delta;
} }
@ -112,7 +112,7 @@ double GSMNormalHooke::calculate_forces()
Hertzian normal force Hertzian normal force
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMNormalHertz::GSMNormalHertz(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) GranSubModNormalHertz::GranSubModNormalHertz(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp)
{ {
num_coeffs = 2; num_coeffs = 2;
area_flag = 1; 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]; k = coeffs[0];
damp = coeffs[1]; 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; return k * gm->area * gm->delta;
} }
@ -139,7 +139,7 @@ double GSMNormalHertz::calculate_forces()
Hertzian normal force with material properties 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; material_properties = 1;
num_coeffs = 3; 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]; Emod = coeffs[0];
damp = coeffs[1]; 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[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]);
coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]);
@ -176,7 +176,7 @@ void GSMNormalHertzMaterial::mix_coeffs(double* icoeffs, double* jcoeffs)
DMT normal force DMT normal force
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMNormalDMT::GSMNormalDMT(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) GranSubModNormalDMT::GranSubModNormalDMT(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp)
{ {
material_properties = 1; material_properties = 1;
cohesive_flag = 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]; Emod = coeffs[0];
damp = coeffs[1]; 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[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]);
coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); 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; Fne = k * gm->area * gm->delta;
F_pulloff = 4.0 * MathConst::MY_PI * cohesion * gm->Reff; 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); Fncrit = fabs(Fne + 2.0 * F_pulloff);
} }
@ -233,7 +233,7 @@ void GSMNormalDMT::set_fncrit()
JKR normal force JKR normal force
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMNormalJKR::GSMNormalJKR(GranularModel *gm, LAMMPS *lmp) : GSMNormal(gm, lmp) GranSubModNormalJKR::GranSubModNormalJKR(GranularModel *gm, LAMMPS *lmp) : GranSubModNormal(gm, lmp)
{ {
material_properties = 1; material_properties = 1;
cohesive_flag = 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]; Emod = coeffs[0];
damp = coeffs[1]; 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[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0],icoeffs[2], jcoeffs[2]);
coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); 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; double area_at_pulloff, R2, delta_pulloff, dist_pulloff;
bool touchflag; bool touchflag;
@ -297,7 +297,7 @@ bool GSMNormalJKR::touch()
called outside of compute(), do not assume geometry defined in contact 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; 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 R2, dR2, t0, t1, t2, t3, t4, t5, t6;
double sqrt1, sqrt2, sqrt3; double sqrt1, sqrt2, sqrt3;
@ -335,7 +335,7 @@ double GSMNormalJKR::calculate_area()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double GSMNormalJKR::calculate_forces() double GranSubModNormalJKR::calculate_forces()
{ {
double a2; double a2;
a2 = gm->area * gm->area; 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); Fncrit = fabs(Fne + 2.0 * F_pulloff);
} }

View File

@ -11,46 +11,46 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef GSM_CLASS #ifdef GRAN_SUB_MOD_CLASS
// clang-format off // clang-format off
GSMStyle(none, GranSubModStyle(none,
GSMNormalNone, GranSubModNormalNone,
NORMAL); NORMAL);
GSMStyle(hooke, GranSubModStyle(hooke,
GSMNormalHooke, GranSubModNormalHooke,
NORMAL); NORMAL);
GSMStyle(hertz, GranSubModStyle(hertz,
GSMNormalHertz, GranSubModNormalHertz,
NORMAL); NORMAL);
GSMStyle(hertz/material, GranSubModStyle(hertz/material,
GSMNormalHertzMaterial, GranSubModNormalHertzMaterial,
NORMAL); NORMAL);
GSMStyle(dmt, GranSubModStyle(dmt,
GSMNormalDMT, GranSubModNormalDMT,
NORMAL); NORMAL);
GSMStyle(jkr, GranSubModStyle(jkr,
GSMNormalJKR, GranSubModNormalJKR,
NORMAL); NORMAL);
// clang-format on // clang-format on
#else #else
#ifndef GSM_NORMAL_H_ #ifndef GRAN_SUB_MOD_NORMAL_H_
#define GSM_NORMAL_H_ #define GRAN_SUB_MOD_NORMAL_H_
#include "gsm.h" #include "gran_sub_mod.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMNormal : public GSM { class GranSubModNormal : public GranSubMod {
public: public:
GSMNormal(class GranularModel *, class LAMMPS *); GranSubModNormal(class GranularModel *, class LAMMPS *);
~GSMNormal() {}; ~GranSubModNormal() {};
virtual void coeffs_to_local() {}; virtual void coeffs_to_local() {};
virtual void init() {}; virtual void init() {};
virtual bool touch(); virtual bool touch();
@ -66,17 +66,17 @@ class GSMNormal : public GSM {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMNormalNone : public GSMNormal { class GranSubModNormalNone : public GranSubModNormal {
public: public:
GSMNormalNone(class GranularModel *, class LAMMPS *); GranSubModNormalNone(class GranularModel *, class LAMMPS *);
double calculate_forces(); double calculate_forces();
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMNormalHooke : public GSMNormal { class GranSubModNormalHooke : public GranSubModNormal {
public: public:
GSMNormalHooke(class GranularModel *, class LAMMPS *); GranSubModNormalHooke(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
double calculate_forces(); double calculate_forces();
protected: protected:
@ -85,9 +85,9 @@ class GSMNormalHooke : public GSMNormal {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMNormalHertz : public GSMNormal { class GranSubModNormalHertz : public GranSubModNormal {
public: public:
GSMNormalHertz(class GranularModel *, class LAMMPS *); GranSubModNormalHertz(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
double calculate_forces(); double calculate_forces();
protected: protected:
@ -96,18 +96,18 @@ class GSMNormalHertz : public GSMNormal {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMNormalHertzMaterial : public GSMNormalHertz { class GranSubModNormalHertzMaterial : public GranSubModNormalHertz {
public: public:
GSMNormalHertzMaterial(class GranularModel *, class LAMMPS *); GranSubModNormalHertzMaterial(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void mix_coeffs(double*, double*) override; void mix_coeffs(double*, double*) override;
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMNormalDMT : public GSMNormal { class GranSubModNormalDMT : public GranSubModNormal {
public: public:
GSMNormalDMT(class GranularModel *, class LAMMPS *); GranSubModNormalDMT(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void mix_coeffs(double*, double*) override; void mix_coeffs(double*, double*) override;
double calculate_forces(); double calculate_forces();
@ -119,9 +119,9 @@ class GSMNormalDMT : public GSMNormal {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMNormalJKR : public GSMNormal { class GranSubModNormalJKR : public GranSubModNormal {
public: public:
GSMNormalJKR(class GranularModel *, class LAMMPS *); GranSubModNormalJKR(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void mix_coeffs(double*, double*) override; void mix_coeffs(double*, double*) override;
bool touch() override; bool touch() override;
@ -137,5 +137,5 @@ class GSMNormalJKR : public GSMNormal {
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_NORMAL_H_ */ #endif /*GRAN_SUB_MOD_NORMAL_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */

View File

@ -12,8 +12,8 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "gsm_normal.h" #include "gran_sub_mod_normal.h"
#include "gsm_rolling.h" #include "gran_sub_mod_rolling.h"
#include "granular_model.h" #include "granular_model.h"
#include "error.h" #include "error.h"
#include "math_const.h" #include "math_const.h"
@ -24,23 +24,25 @@ using namespace Granular_NS;
using namespace MathConst; using namespace MathConst;
using namespace MathExtra; using namespace MathExtra;
#define EPSILON 1e-10
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
Default rolling friction model Default rolling friction model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMRolling::GSMRolling(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} GranSubModRolling::GranSubModRolling(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
No model No model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMRollingNone::GSMRollingNone(GranularModel *gm, LAMMPS *lmp) : GSMRolling(gm, lmp) {} GranSubModRollingNone::GranSubModRollingNone(GranularModel *gm, LAMMPS *lmp) : GranSubModRolling(gm, lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
SDS rolling friction model 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; num_coeffs = 3;
size_history = 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]; k = coeffs[0];
gamma = coeffs[1]; 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; int rhist0, rhist1, rhist2, frameupdate;
double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], scalefac, temp_array[3]; double Frcrit, rolldotn, rollmag, prjmag, magfr, hist_temp[3], scalefac, temp_array[3];

View File

@ -11,30 +11,30 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef GSM_CLASS #ifdef GRAN_SUB_MOD_CLASS
// clang-format off // clang-format off
GSMStyle(none, GranSubModStyle(none,
GSMRollingNone, GranSubModRollingNone,
ROLLING); ROLLING);
GSMStyle(sds, GranSubModStyle(sds,
GSMRollingSDS, GranSubModRollingSDS,
ROLLING); ROLLING);
// clang-format on // clang-format on
#else #else
#ifndef GSM_ROLLING_H_ #ifndef GRAN_SUB_MOD_ROLLING_H_
#define GSM_ROLLING_H_ #define GRAN_SUB_MOD_ROLLING_H_
#include "gsm.h" #include "gran_sub_mod.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMRolling : public GSM { class GranSubModRolling : public GranSubMod {
public: public:
GSMRolling(class GranularModel *, class LAMMPS *); GranSubModRolling(class GranularModel *, class LAMMPS *);
~GSMRolling() {}; ~GranSubModRolling() {};
virtual void coeffs_to_local() {}; virtual void coeffs_to_local() {};
virtual void init() {}; virtual void init() {};
virtual void calculate_forces() = 0; virtual void calculate_forces() = 0;
@ -42,17 +42,17 @@ class GSMRolling : public GSM {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMRollingNone : public GSMRolling { class GranSubModRollingNone : public GranSubModRolling {
public: public:
GSMRollingNone(class GranularModel *, class LAMMPS *); GranSubModRollingNone(class GranularModel *, class LAMMPS *);
void calculate_forces() {}; void calculate_forces() {};
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMRollingSDS : public GSMRolling { class GranSubModRollingSDS : public GranSubModRolling {
public: public:
GSMRollingSDS(class GranularModel *, class LAMMPS *); GranSubModRollingSDS(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void calculate_forces(); void calculate_forces();
protected: protected:
@ -62,5 +62,5 @@ class GSMRollingSDS : public GSMRolling {
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_ROLLING_H_ */ #endif /*GRAN_SUB_MOD_ROLLING_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */

View File

@ -12,9 +12,9 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "gsm_damping.h" #include "gran_sub_mod_damping.h"
#include "gsm_normal.h" #include "gran_sub_mod_normal.h"
#include "gsm_tangential.h" #include "gran_sub_mod_tangential.h"
#include "granular_model.h" #include "granular_model.h"
#include "error.h" #include "error.h"
#include "math_const.h" #include "math_const.h"
@ -25,23 +25,25 @@ using namespace Granular_NS;
using namespace MathConst; using namespace MathConst;
using namespace MathExtra; using namespace MathExtra;
#define EPSILON 1e-10
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
Default model Default model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTangential::GSMTangential(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} GranSubModTangential::GranSubModTangential(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
No model 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 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; num_coeffs = 2;
size_history = 0; 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 k = 0.0; // No tangential stiffness with no history
xt = coeffs[0]; 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) // classic pair gran/hooke (no history)
damp = xt * gm->damping_model->damp_prefactor; damp = xt * gm->damping_model->damp_prefactor;
@ -80,7 +82,7 @@ void GSMTangentialLinearNoHistory::calculate_forces()
Linear model with history 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; num_coeffs = 3;
size_history = 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]; k = coeffs[0];
xt = coeffs[1]; 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 // 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]; 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 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 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 magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl;
double temp_array[3]; double temp_array[3];
@ -222,7 +224,7 @@ void GSMTangentialLinearHistoryClassic::calculate_forces()
Mindlin from pair gran/hertz/history 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 area_flag = 1; // Sets gran/hertz/history behavior
} }
@ -231,7 +233,7 @@ GSMTangentialMindlinClassic::GSMTangentialMindlinClassic(GranularModel *gm, LAMM
Mindlin model Mindlin model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTangentialMindlin::GSMTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GSMTangential(gm, lmp) GranSubModTangentialMindlin::GranSubModTangentialMindlin(GranularModel *gm, LAMMPS *lmp) : GranSubModTangential(gm, lmp)
{ {
num_coeffs = 3; num_coeffs = 3;
size_history = 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]; k = coeffs[0];
xt = coeffs[1]; 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; if (icoeffs[0] == -1 || jcoeffs[0] == -1) coeffs[0] = -1;
else coeffs[0] = mix_geom(icoeffs[0], jcoeffs[0]); 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 k_scaled, magfs, magfs_inv, rsht, shrmag, prjmag, temp_dbl;
double temp_array[3]; double temp_array[3];
@ -366,7 +368,7 @@ void GSMTangentialMindlin::calculate_forces()
Mindlin force model Mindlin force model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) GranSubModTangentialMindlinForce::GranSubModTangentialMindlinForce(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialMindlin(gm, lmp)
{ {
mindlin_force = 1; mindlin_force = 1;
} }
@ -375,7 +377,7 @@ GSMTangentialMindlinForce::GSMTangentialMindlinForce(GranularModel *gm, LAMMPS *
Mindlin rescale model Mindlin rescale model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMMPS *lmp) : GSMTangentialMindlin(gm, lmp) GranSubModTangentialMindlinRescale::GranSubModTangentialMindlinRescale(GranularModel *gm, LAMMPS *lmp) : GranSubModTangentialMindlin(gm, lmp)
{ {
size_history = 4; size_history = 4;
mindlin_rescale = 1; mindlin_rescale = 1;
@ -390,7 +392,7 @@ GSMTangentialMindlinRescale::GSMTangentialMindlinRescale(GranularModel *gm, LAMM
Mindlin rescale force model 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; size_history = 4;
mindlin_force = 1; mindlin_force = 1;

View File

@ -11,58 +11,58 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef GSM_CLASS #ifdef GRAN_SUB_MOD_CLASS
// clang-format off // clang-format off
GSMStyle(none, GranSubModStyle(none,
GSMTangentialNone, GranSubModTangentialNone,
TANGENTIAL); TANGENTIAL);
GSMStyle(linear_nohistory, GranSubModStyle(linear_nohistory,
GSMTangentialLinearNoHistory, GranSubModTangentialLinearNoHistory,
TANGENTIAL); TANGENTIAL);
GSMStyle(linear_history, GranSubModStyle(linear_history,
GSMTangentialLinearHistory, GranSubModTangentialLinearHistory,
TANGENTIAL); TANGENTIAL);
GSMStyle(linear_history_classic, GranSubModStyle(linear_history_classic,
GSMTangentialLinearHistoryClassic, GranSubModTangentialLinearHistoryClassic,
TANGENTIAL); TANGENTIAL);
GSMStyle(mindlin_classic, GranSubModStyle(mindlin_classic,
GSMTangentialMindlinClassic, GranSubModTangentialMindlinClassic,
TANGENTIAL); TANGENTIAL);
GSMStyle(mindlin, GranSubModStyle(mindlin,
GSMTangentialMindlin, GranSubModTangentialMindlin,
TANGENTIAL); TANGENTIAL);
GSMStyle(mindlin/force, GranSubModStyle(mindlin/force,
GSMTangentialMindlinForce, GranSubModTangentialMindlinForce,
TANGENTIAL); TANGENTIAL);
GSMStyle(mindlin_rescale, GranSubModStyle(mindlin_rescale,
GSMTangentialMindlinRescale, GranSubModTangentialMindlinRescale,
TANGENTIAL); TANGENTIAL);
GSMStyle(mindlin_rescale/force, GranSubModStyle(mindlin_rescale/force,
GSMTangentialMindlinRescaleForce, GranSubModTangentialMindlinRescaleForce,
TANGENTIAL); TANGENTIAL);
// clang-format on // clang-format on
#else #else
#ifndef GSM_TANGENTIAL_H_ #ifndef GRAN_SUB_MOD_TANGENTIAL_H_
#define GSM_TANGENTIAL_H_ #define GRAN_SUB_MOD_TANGENTIAL_H_
#include "gsm.h" #include "gran_sub_mod.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMTangential : public GSM { class GranSubModTangential : public GranSubMod {
public: public:
GSMTangential(class GranularModel *, class LAMMPS *); GranSubModTangential(class GranularModel *, class LAMMPS *);
virtual ~GSMTangential() {}; virtual ~GranSubModTangential() {};
virtual void coeffs_to_local() {}; virtual void coeffs_to_local() {};
virtual void init() {}; virtual void init() {};
virtual void calculate_forces() = 0; virtual void calculate_forces() = 0;
@ -71,17 +71,17 @@ class GSMTangential : public GSM {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialNone : public GSMTangential { class GranSubModTangentialNone : public GranSubModTangential {
public: public:
GSMTangentialNone(class GranularModel *, class LAMMPS *); GranSubModTangentialNone(class GranularModel *, class LAMMPS *);
void calculate_forces() {}; void calculate_forces() {};
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialLinearNoHistory : public GSMTangential { class GranSubModTangentialLinearNoHistory : public GranSubModTangential {
public: public:
GSMTangentialLinearNoHistory(class GranularModel *, class LAMMPS *); GranSubModTangentialLinearNoHistory(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void calculate_forces(); void calculate_forces();
protected: protected:
@ -90,9 +90,9 @@ class GSMTangentialLinearNoHistory : public GSMTangential {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialLinearHistory : public GSMTangential { class GranSubModTangentialLinearHistory : public GranSubModTangential {
public: public:
GSMTangentialLinearHistory(class GranularModel *, class LAMMPS *); GranSubModTangentialLinearHistory(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void calculate_forces(); void calculate_forces();
protected: protected:
@ -101,9 +101,9 @@ class GSMTangentialLinearHistory : public GSMTangential {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory { class GranSubModTangentialLinearHistoryClassic : public GranSubModTangentialLinearHistory {
public: public:
GSMTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *); GranSubModTangentialLinearHistoryClassic(class GranularModel *, class LAMMPS *);
void calculate_forces(); void calculate_forces();
protected: protected:
double xt; double xt;
@ -111,16 +111,16 @@ class GSMTangentialLinearHistoryClassic : public GSMTangentialLinearHistory {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialMindlinClassic : public GSMTangentialLinearHistoryClassic { class GranSubModTangentialMindlinClassic : public GranSubModTangentialLinearHistoryClassic {
public: public:
GSMTangentialMindlinClassic(class GranularModel *, class LAMMPS *); GranSubModTangentialMindlinClassic(class GranularModel *, class LAMMPS *);
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialMindlin : public GSMTangential { class GranSubModTangentialMindlin : public GranSubModTangential {
public: public:
GSMTangentialMindlin(class GranularModel *, class LAMMPS *); GranSubModTangentialMindlin(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void mix_coeffs(double*, double*) override; void mix_coeffs(double*, double*) override;
void calculate_forces(); void calculate_forces();
@ -131,27 +131,27 @@ class GSMTangentialMindlin : public GSMTangential {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialMindlinForce : public GSMTangentialMindlin { class GranSubModTangentialMindlinForce : public GranSubModTangentialMindlin {
public: public:
GSMTangentialMindlinForce(class GranularModel *, class LAMMPS *); GranSubModTangentialMindlinForce(class GranularModel *, class LAMMPS *);
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialMindlinRescale : public GSMTangentialMindlin { class GranSubModTangentialMindlinRescale : public GranSubModTangentialMindlin {
public: public:
GSMTangentialMindlinRescale(class GranularModel *, class LAMMPS *); GranSubModTangentialMindlinRescale(class GranularModel *, class LAMMPS *);
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTangentialMindlinRescaleForce : public GSMTangentialMindlin { class GranSubModTangentialMindlinRescaleForce : public GranSubModTangentialMindlin {
public: public:
GSMTangentialMindlinRescaleForce(class GranularModel *, class LAMMPS *); GranSubModTangentialMindlinRescaleForce(class GranularModel *, class LAMMPS *);
}; };
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_TANGENTIAL_H_ */ #endif /*GRAN_SUB_MOD_TANGENTIAL_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */

View File

@ -12,9 +12,9 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "gsm_normal.h" #include "gran_sub_mod_normal.h"
#include "gsm_tangential.h" #include "gran_sub_mod_tangential.h"
#include "gsm_twisting.h" #include "gran_sub_mod_twisting.h"
#include "granular_model.h" #include "granular_model.h"
#include "error.h" #include "error.h"
#include "math_const.h" #include "math_const.h"
@ -27,19 +27,19 @@ using namespace MathConst;
Default twisting model Default twisting model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTwisting::GSMTwisting(GranularModel *gm, LAMMPS *lmp) : GSM(gm, lmp) {} GranSubModTwisting::GranSubModTwisting(GranularModel *gm, LAMMPS *lmp) : GranSubMod(gm, lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
No model No model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTwistingNone::GSMTwistingNone(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) {} GranSubModTwistingNone::GranSubModTwistingNone(GranularModel *gm, LAMMPS *lmp) : GranSubModTwisting(gm, lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
Marshall twisting model Marshall twisting model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTwistingMarshall::GSMTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) GranSubModTwistingMarshall::GranSubModTwistingMarshall(GranularModel *gm, LAMMPS *lmp) : GranSubModTwisting(gm, lmp)
{ {
num_coeffs = 0; num_coeffs = 0;
size_history = 3; 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; k_tang = gm->tangential_model->k;
mu_tang = gm->tangential_model->mu; mu_tang = gm->tangential_model->mu;
@ -57,7 +57,7 @@ void GSMTwistingMarshall::init()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSMTwistingMarshall::calculate_forces() void GranSubModTwistingMarshall::calculate_forces()
{ {
double signtwist, Mtcrit; double signtwist, Mtcrit;
@ -86,7 +86,7 @@ void GSMTwistingMarshall::calculate_forces()
SDS twisting model SDS twisting model
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
GSMTwistingSDS::GSMTwistingSDS(GranularModel *gm, LAMMPS *lmp) : GSMTwisting(gm, lmp) GranSubModTwistingSDS::GranSubModTwistingSDS(GranularModel *gm, LAMMPS *lmp) : GranSubModTwisting(gm, lmp)
{ {
num_coeffs = 3; num_coeffs = 3;
size_history = 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]; k = coeffs[0];
damp = coeffs[1]; damp = coeffs[1];
@ -106,7 +106,7 @@ void GSMTwistingSDS::coeffs_to_local()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void GSMTwistingSDS::calculate_forces() void GranSubModTwistingSDS::calculate_forces()
{ {
double signtwist, Mtcrit; double signtwist, Mtcrit;

View File

@ -11,34 +11,34 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef GSM_CLASS #ifdef GRAN_SUB_MOD_CLASS
// clang-format off // clang-format off
GSMStyle(none, GranSubModStyle(none,
GSMTwistingNone, GranSubModTwistingNone,
TWISTING); TWISTING);
GSMStyle(marshall, GranSubModStyle(marshall,
GSMTwistingMarshall, GranSubModTwistingMarshall,
TWISTING); TWISTING);
GSMStyle(sds, GranSubModStyle(sds,
GSMTwistingSDS, GranSubModTwistingSDS,
TWISTING); TWISTING);
// clang-format on // clang-format on
#else #else
#ifndef GSM_TWISTING_H_ #ifndef GRAN_SUB_MOD_TWISTING_H_
#define GSM_TWISTING_H_ #define GRAN_SUB_MOD_TWISTING_H_
#include "gsm.h" #include "gran_sub_mod.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
class GSMTwisting : public GSM { class GranSubModTwisting : public GranSubMod {
public: public:
GSMTwisting(class GranularModel *, class LAMMPS *); GranSubModTwisting(class GranularModel *, class LAMMPS *);
virtual ~GSMTwisting() {}; virtual ~GranSubModTwisting() {};
virtual void coeffs_to_local() {}; virtual void coeffs_to_local() {};
virtual void init() {}; virtual void init() {};
virtual void calculate_forces() = 0; virtual void calculate_forces() = 0;
@ -46,17 +46,17 @@ class GSMTwisting : public GSM {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTwistingNone : public GSMTwisting { class GranSubModTwistingNone : public GranSubModTwisting {
public: public:
GSMTwistingNone(class GranularModel *, class LAMMPS *); GranSubModTwistingNone(class GranularModel *, class LAMMPS *);
void calculate_forces() {}; void calculate_forces() {};
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTwistingMarshall : public GSMTwisting { class GranSubModTwistingMarshall : public GranSubModTwisting {
public: public:
GSMTwistingMarshall(class GranularModel *, class LAMMPS *); GranSubModTwistingMarshall(class GranularModel *, class LAMMPS *);
void calculate_forces(); void calculate_forces();
void init(); void init();
protected: protected:
@ -65,9 +65,9 @@ class GSMTwistingMarshall : public GSMTwisting {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
class GSMTwistingSDS : public GSMTwisting { class GranSubModTwistingSDS : public GranSubModTwisting {
public: public:
GSMTwistingSDS(class GranularModel *, class LAMMPS *); GranSubModTwistingSDS(class GranularModel *, class LAMMPS *);
void coeffs_to_local() override; void coeffs_to_local() override;
void calculate_forces(); void calculate_forces();
protected: protected:
@ -77,5 +77,5 @@ class GSMTwistingSDS : public GSMTwisting {
} // namespace Granular_NS } // namespace Granular_NS
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
#endif /*GSM_TWISTING_H_ */ #endif /*GRAN_SUB_MOD_TWISTING_H_ */
#endif /*GSM_CLASS_H_ */ #endif /*GRAN_SUB_MOD_CLASS_H_ */

View File

@ -22,12 +22,12 @@
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
#include "granular_model.h" #include "granular_model.h"
#include "gsm.h" #include "gran_sub_mod.h"
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "math_extra.h" #include "math_extra.h"
#include "style_gsm.h" // IWYU pragma: keep #include "style_gran_sub_mod.h" // IWYU pragma: keep
#include <cmath> #include <cmath>
@ -36,10 +36,10 @@ using namespace Granular_NS;
using namespace MathExtra; using namespace MathExtra;
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
one instance per GSM style in style_gsm.h one instance per GranSubMod style in style_gran_sub_mod.h
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
template <typename T> static GSM *gsm_creator(GranularModel *gm, LAMMPS *lmp) template <typename T> static GranSubMod *gran_sub_mod_creator(GranularModel *gm, LAMMPS *lmp)
{ {
return new T(gm, 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; for (int i = 0; i < NSUBMODELS; i++) sub_models[i] = nullptr;
transfer_history_factor = 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; nclass = 0;
#define GSM_CLASS #define GRANSUBMOD_CLASS
#define GSMStyle(key,Class,type) nclass++; #define GranSubModStyle(key,Class,type) nclass++;
#include "style_gsm.h" // IWYU pragma: keep #include "style_gran_sub_mod.h" // IWYU pragma: keep
#undef GSMStyle #undef GranSubModStyle
#undef GSM_CLASS #undef GRANSUBMOD_CLASS
gsmclass = new GSMCreator[nclass]; gran_sub_mod_class = new GranSubModCreator[nclass];
gsmnames = new char*[nclass]; gran_sub_mod_names = new char*[nclass];
gsmtypes = new int[nclass]; gran_sub_mod_types = new int[nclass];
nclass = 0; nclass = 0;
#define GSM_CLASS #define GRANSUBMOD_CLASS
#define GSMStyle(key,Class,type) \ #define GranSubModStyle(key,Class,type) \
gsmclass[nclass] = &gsm_creator<Class>; \ gran_sub_mod_class[nclass] = &gran_sub_mod_creator<Class>; \
gsmnames[nclass] = (char *) #key; \ gran_sub_mod_names[nclass] = (char *) #key; \
gsmtypes[nclass++] = type; gran_sub_mod_types[nclass++] = type;
#include "style_gsm.h" // IWYU pragma: keep #include "style_gran_sub_mod.h" // IWYU pragma: keep
#undef GSMStyle #undef GranSubModStyle
#undef GSM_CLASS #undef GRANSUBMOD_CLASS
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -94,9 +94,9 @@ GranularModel::GranularModel(LAMMPS *lmp) : Pointers(lmp)
GranularModel::~GranularModel() GranularModel::~GranularModel()
{ {
delete [] transfer_history_factor; delete [] transfer_history_factor;
delete [] gsmclass; delete [] gran_sub_mod_class;
delete [] gsmnames; delete [] gran_sub_mod_names;
delete [] gsmtypes; delete [] gran_sub_mod_types;
for (int i = 0; i < NSUBMODELS; i ++) delete sub_models[i]; 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; int i;
for (i = 0; i < nclass; i++) { for (i = 0; i < nclass; i++) {
if (gsmtypes[i] == model_type) { if (gran_sub_mod_types[i] == model_type) {
if (strcmp(gsmnames[i], model_name.c_str()) == 0) { if (strcmp(gran_sub_mod_names[i], model_name.c_str()) == 0) {
GSMCreator &gsm_creator = gsmclass[i]; GranSubModCreator &gran_sub_mod_creator = gran_sub_mod_class[i];
delete sub_models[model_type]; delete sub_models[model_type];
sub_models[model_type] = gsm_creator(this, lmp); sub_models[model_type] = gran_sub_mod_creator(this, lmp);
break; 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]->name.assign(model_name);
sub_models[model_type]->allocate_coeffs(); sub_models[model_type]->allocate_coeffs();
if (model_type == NORMAL) normal_model = dynamic_cast<GSMNormal *> (sub_models[NORMAL]); if (model_type == NORMAL) normal_model = dynamic_cast<GranSubModNormal *> (sub_models[NORMAL]);
if (model_type == DAMPING) damping_model = dynamic_cast<GSMDamping *> (sub_models[DAMPING]); if (model_type == DAMPING) damping_model = dynamic_cast<GranSubModDamping *> (sub_models[DAMPING]);
if (model_type == TANGENTIAL) tangential_model = dynamic_cast<GSMTangential *> (sub_models[TANGENTIAL]); if (model_type == TANGENTIAL) tangential_model = dynamic_cast<GranSubModTangential *> (sub_models[TANGENTIAL]);
if (model_type == ROLLING) rolling_model = dynamic_cast<GSMRolling *> (sub_models[ROLLING]); if (model_type == ROLLING) rolling_model = dynamic_cast<GranSubModRolling *> (sub_models[ROLLING]);
if (model_type == TWISTING) twisting_model = dynamic_cast<GSMTwisting *> (sub_models[TWISTING]); if (model_type == TWISTING) twisting_model = dynamic_cast<GranSubModTwisting *> (sub_models[TWISTING]);
if (model_type == HEAT) heat_model = dynamic_cast<GSMHeat *> (sub_models[HEAT]); if (model_type == HEAT) heat_model = dynamic_cast<GranSubModHeat *> (sub_models[HEAT]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -19,8 +19,6 @@
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS { namespace Granular_NS {
#define EPSILON 1e-10
enum SubmodelType { enum SubmodelType {
NORMAL = 0, NORMAL = 0,
DAMPING, DAMPING,
@ -38,13 +36,13 @@ enum ContactType {
}; };
// forward declarations // forward declarations
class GSM; class GranSubMod;
class GSMNormal; class GranSubModNormal;
class GSMDamping; class GranSubModDamping;
class GSMTangential; class GranSubModTangential;
class GSMRolling; class GranSubModRolling;
class GSMTwisting; class GranSubModTwisting;
class GSMHeat; class GranSubModHeat;
class GranularModel : protected Pointers { class GranularModel : protected Pointers {
public: public:
@ -64,13 +62,13 @@ class GranularModel : protected Pointers {
void read_restart(FILE *); void read_restart(FILE *);
// Sub models // Sub models
GSMNormal *normal_model; GranSubModNormal *normal_model;
GSMDamping *damping_model; GranSubModDamping *damping_model;
GSMTangential *tangential_model; GranSubModTangential *tangential_model;
GSMRolling *rolling_model; GranSubModRolling *rolling_model;
GSMTwisting *twisting_model; GranSubModTwisting *twisting_model;
GSMHeat *heat_model; GranSubModHeat *heat_model;
GSM *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors GranSubMod *sub_models[NSUBMODELS]; // Need to resize if we add more model flavors
// Extra options // Extra options
int beyond_contact, limit_damping, history_update; int beyond_contact, limit_damping, history_update;
@ -102,10 +100,10 @@ class GranularModel : protected Pointers {
int nclass; int nclass;
typedef class GSM *(*GSMCreator)(class GranularModel *, class LAMMPS *); typedef class GranSubMod *(*GranSubModCreator)(class GranularModel *, class LAMMPS *);
GSMCreator *gsmclass; GranSubModCreator *gran_sub_mod_class;
char **gsmnames; char **gran_sub_mod_names;
int *gsmtypes; int *gran_sub_mod_types;
}; };
} // namespace Granular_NS } // namespace Granular_NS

View File

@ -23,7 +23,7 @@
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "granular_model.h" #include "granular_model.h"
#include "gsm.h" #include "gran_sub_mod.h"
#include "error.h" #include "error.h"
#include "fix.h" #include "fix.h"
#include "fix_dummy.h" #include "fix_dummy.h"

View File

@ -20,12 +20,15 @@ PairStyle(granular,PairGranular);
#ifndef LMP_PAIR_GRANULAR_H #ifndef LMP_PAIR_GRANULAR_H
#define LMP_PAIR_GRANULAR_H #define LMP_PAIR_GRANULAR_H
#include "granular_model.h"
#include "pair.h" #include "pair.h"
#include <vector> #include <vector>
namespace LAMMPS_NS { namespace LAMMPS_NS {
namespace Granular_NS {
class GranularModel;
}
class PairGranular : public Pair { class PairGranular : public Pair {
public: public:
PairGranular(class LAMMPS *); PairGranular(class LAMMPS *);
@ -73,7 +76,7 @@ class PairGranular : public Pair {
// granular models // granular models
int nmodels, maxmodels; int nmodels, maxmodels;
Granular_NS::GranularModel** models_list; class Granular_NS::GranularModel** models_list;
int **types_indices; int **types_indices;
// optional user-specified global cutoff, per-type user-specified cutoffs // optional user-specified global cutoff, per-type user-specified cutoffs

View File

@ -95,27 +95,27 @@ cmd=$1
if (test $cmd = "style") || (test $cmd = "packages") then if (test $cmd = "style") || (test $cmd = "packages") then
$cmd ANGLE_CLASS angle_ angle force $cmd ANGLE_CLASS angle_ angle force
$cmd ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid $cmd ATOM_CLASS atom_vec_ atom atom atom_vec_hybrid
$cmd BODY_CLASS body_ body atom_vec_body $cmd BODY_CLASS body_ body atom_vec_body
$cmd BOND_CLASS bond_ bond force $cmd BOND_CLASS bond_ bond force
$cmd COMMAND_CLASS "" command input $cmd COMMAND_CLASS "" command input
$cmd COMPUTE_CLASS compute_ compute modify $cmd COMPUTE_CLASS compute_ compute modify
$cmd DIHEDRAL_CLASS dihedral_ dihedral force $cmd DIHEDRAL_CLASS dihedral_ dihedral force
$cmd DUMP_CLASS dump_ dump output write_dump $cmd DUMP_CLASS dump_ dump output write_dump
$cmd FIX_CLASS fix_ fix modify $cmd FIX_CLASS fix_ fix modify
$cmd GSM_CLASS gsm_ gsm granular_model $cmd GRAN_SUB_MOD_CLASS gran_sub_mod_ gran_sub_mod granular_model
$cmd IMPROPER_CLASS improper_ improper force $cmd IMPROPER_CLASS improper_ improper force
$cmd INTEGRATE_CLASS "" integrate update $cmd INTEGRATE_CLASS "" integrate update
$cmd KSPACE_CLASS "" kspace force $cmd KSPACE_CLASS "" kspace force
$cmd MINIMIZE_CLASS min_ minimize update $cmd MINIMIZE_CLASS min_ minimize update
$cmd NBIN_CLASS nbin_ nbin neighbor $cmd NBIN_CLASS nbin_ nbin neighbor
$cmd NPAIR_CLASS npair_ npair neighbor $cmd NPAIR_CLASS npair_ npair neighbor
$cmd NSTENCIL_CLASS nstencil_ nstencil neighbor $cmd NSTENCIL_CLASS nstencil_ nstencil neighbor
$cmd NTOPO_CLASS ntopo_ ntopo neighbor $cmd NTOPO_CLASS ntopo_ ntopo neighbor
$cmd PAIR_CLASS pair_ pair force $cmd PAIR_CLASS pair_ pair force
$cmd READER_CLASS reader_ reader read_dump $cmd READER_CLASS reader_ reader read_dump
$cmd REGION_CLASS region_ region domain $cmd REGION_CLASS region_ region domain
# edit Makefile.lib, for creating non-shared lib # edit Makefile.lib, for creating non-shared lib
# called by "make makelib" # called by "make makelib"