1 /* ---------------------------------------------------------------------- 2 This is the 3 4 ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗████████╗███████╗ 5 ██║ ██║██╔════╝ ██╔════╝ ██╔════╝ ██║ ██║╚══██╔══╝██╔════╝ 6 ██║ ██║██║ ███╗██║ ███╗██║ ███╗███████║ ██║ ███████╗ 7 ██║ ██║██║ ██║██║ ██║██║ ██║██╔══██║ ██║ ╚════██║ 8 ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║ ██║ ██║ ███████║ 9 ╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝® 10 11 DEM simulation engine, released by 12 DCS Computing Gmbh, Linz, Austria 13 http://www.dcs-computing.com, office@dcs-computing.com 14 15 LIGGGHTS® is part of CFDEM®project: 16 http://www.liggghts.com | http://www.cfdem.com 17 18 Core developer and main author: 19 Christoph Kloss, christoph.kloss@dcs-computing.com 20 21 LIGGGHTS® is open-source, distributed under the terms of the GNU Public 22 License, version 2 or later. It is distributed in the hope that it will 23 be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 24 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have 25 received a copy of the GNU General Public License along with LIGGGHTS®. 26 If not, see http://www.gnu.org/licenses . See also top-level README 27 and LICENSE files. 28 29 LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH, 30 the producer of the LIGGGHTS® software and the CFDEM®coupling software 31 See http://www.cfdem.com/terms-trademark-policy for details. 32 33 ------------------------------------------------------------------------- 34 Contributing author and copyright for this file: 35 (if not contributing author is listed, this file has been contributed 36 by the core developer) 37 38 Christoph Kloss (DCS Computing GmbH, JKU Linz) 39 Arno Mayrhofer (DCS Computing GmbH) 40 41 Copyright 2012- DCS Computing GmbH, Linz 42 Copyright 2009-2012 JKU Linz 43 ------------------------------------------------------------------------- */ 44 45 #ifdef MESHMODULE_CLASS 46 47 MeshModuleStyle(stress,MeshModuleStress) 48 49 #else 50 51 #ifndef LMP_MESH_MODULE_STRESS_H 52 #define LMP_MESH_MODULE_STRESS_H 53 54 #include "mesh_module.h" 55 56 namespace LAMMPS_NS 57 { 58 class MeshModuleStress : public MeshModule 59 { 60 public: 61 62 MeshModuleStress(LAMMPS *lmp, int &iarg_, int narg, char **arg, FixMeshSurface *fix_mesh); 63 virtual ~MeshModuleStress(); 64 65 virtual void post_create_pre_restart(); 66 virtual void post_create(); 67 68 virtual void init(); 69 virtual void setup(int vflag) {} 70 virtual int setmask(); 71 72 virtual void pre_force(int vflag); 73 virtual void final_integrate(); 74 75 virtual double compute_vector(int n); 76 77 virtual void add_particle_contribution(int ip, double *frc, 78 double *delta, int iTri, double *v_wall); 79 80 void add_global_external_contribution(double *frc); 81 void add_global_external_contribution(double *frc,double *trq); 82 83 // inline access 84 85 inline bool trackWear() 86 { return wear_flag_; } 87 88 inline bool trackStress() 89 { return stress_flag_; } 90 91 inline void f_total(double *_f) 92 { vectorCopy3D(f_total_,_f); } 93 94 inline double f_total(int i) 95 { return f_total_[i]; } 96 97 inline double *f_total_ptr() 98 { return f_total_; } 99 100 inline double f_total_mag() 101 { return vectorMag3D(f_total_); } 102 103 inline void torque_total(double *_t) 104 { vectorCopy3D(torque_total_,_t); } 105 106 inline double torque_total(int i) 107 { return torque_total_[i]; } 108 109 inline double *torque_total_ptr() 110 { return torque_total_; } 111 112 inline int get_num_vector_components() const 113 { return 9; } 114 115 inline void set_p_ref(double *_p_ref) 116 { p_ref_.set(0,_p_ref); } 117 118 inline double get_wear_increment(int i) 119 { return (*wear_increment_)(i); } 120 121 void set_store_wear_increment(const bool set) 122 { store_wear_increment_ = set; } 123 124 protected: 125 126 // STRESS 127 // total force and total torque 128 double f_total_[3], torque_total_[3]; 129 130 // inline access 131 132 inline double* f(int i) 133 { return (*f_)(i); } 134 135 inline double& sigma_n(int i) 136 { return (*sigma_n_)(i); } 137 138 inline double& sigma_t(int i) 139 { return (*sigma_t_)(i); } 140 141 inline double& wear(int i) 142 { return (*wear_)(i); } 143 144 inline double& wear_step(int i) 145 { return (*wear_step_)(i); } 146 147 inline double& wear_increment(int i) 148 { return (*wear_increment_)(i); } 149 150 inline double p_ref(int i) 151 { return p_ref_(0)[i]; } 152 153 private: 154 155 // inititalization fcts 156 void regStress(); 157 void regWear(); 158 void zeroizeStress(); 159 void zeroizeWear(); 160 161 void calc_total_force(); 162 void add_gravity(); 163 164 // STRESS 165 // 166 bool stress_flag_; 167 168 // buffer variables for correct output 169 double f_total_old_[3], torque_total_old_[3]; 170 bool updatedStresses_; 171 172 // stress flag in FixMeshSurface 173 // reference point, total force and total torque 174 VectorContainer<double,3> &p_ref_; 175 176 // per-element force and torque 177 VectorContainer<double,3> *f_; 178 ScalarContainer<double> *sigma_n_; 179 ScalarContainer<double> *sigma_t_; 180 181 // WEAR 182 183 // flag for wear model and Finnie constant 184 int wear_flag_; 185 double const* const* k_finnie_; 186 ScalarContainer<double> *wear_; 187 ScalarContainer<double> *wear_step_; 188 ScalarContainer<double> *wear_increment_; 189 bool store_wear_increment_; 190 }; 191 192 } /* namespace LAMMPS_NS */ 193 194 #endif 195 #endif 196