MercuryOS.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef MERCURYDPM_MERCURYOS_H
6 #define MERCURYDPM_MERCURYOS_H
7 
8 #include <Mercury3D.h>
10 #include <Logger.h>
11 
16 class MercuryOS : public Mercury3D
17 {
18  // if true, additional output files are written
19  bool writeOutput_ = false;
20  // if true, the simulation time is shortened
21  bool test_ = false;
22  // if true, smooth walls are used instead of the stl walls
23  bool useMercuryWalls_ = false;
24  // if true, the simulation time is shortened
25  bool soft_ = false;
26 
27 public:
28 
29  // sets the variable writeOutput_
31  {
33  }
34 
35  // returns the variable writeOutput_
36  bool writeOutput() const
37  {
38  return writeOutput_;
39  }
40 
41  // sets the variable test_
42  void test(bool test)
43  {
44  test_ = test;
45  }
46 
47  // returns the variable test_
48  bool test() const
49  {
50  return test_;
51  }
52 
53  // sets the variable soft_
54  void soft(bool soft)
55  {
56  soft_ = soft;
57  }
58 
59  // returns the variable soft_
60  bool soft() const
61  {
62  return soft_;
63  }
64 
65  // sets the variable useMercuryWalls_
67  {
69  }
70 
71  // returns the variable useMercuryWalls_
72  bool useMercuryWalls() const
73  {
74  return useMercuryWalls_;
75  }
76 
77 private:
78 
82  static double getEffectiveElasticModulus(double E1, double v1, double E2, double v2)
83  {
84  return 1. / ((1 - v1 * v1) / E1 + (1 - v2 * v2) / E2);
85  }
86 
90  static double getEffectiveShearModulus(double E1, double v1, double E2, double v2)
91  {
92  double G1 = E1 / 2 / (1 + v1), G2 = E2 / 2 / (1 + v2);
93  return 1. / ((2 - v1) / G1 + (2 - v2) / G2);
94  }
95 
96 protected:
97  // pointers to the species
99 
100 public:
105  {
106  // Young's modulus and Poisson ratios of M1, M2, steel
107  double E1 = 1e9, E2 = 0.5e9, ES = 210e9;
108  double v1 = 0.2, v2 = 0.2, vS = 0.2;
109 
110  if (soft()) {
111  E1 = 2e6;
112  E2 = 1e6;
113  }
114 
115  // effective elastic and shear moduli
116  double E11 = getEffectiveElasticModulus(E1, v1, E1, v1);
117  double E12 = getEffectiveElasticModulus(E1, v1, E2, v2);
118  double E1S = getEffectiveElasticModulus(E1, v1, ES, vS);
119  double E22 = getEffectiveElasticModulus(E2, v2, E2, v2);
120  double E2S = getEffectiveElasticModulus(E2, v2, ES, vS);
121  double ESS = getEffectiveElasticModulus(ES, vS, ES, vS);
122  double G11 = getEffectiveShearModulus(E1, v1, E1, v1);
123  double G12 = getEffectiveShearModulus(E1, v1, E2, v2);
124  double G1S = getEffectiveShearModulus(E1, v1, ES, vS);
125  double G22 = getEffectiveShearModulus(E2, v2, E2, v2);
126  double G2S = getEffectiveShearModulus(E2, v2, ES, vS);
127  double GSS = getEffectiveShearModulus(ES, vS, ES, vS);
128 
129  // restitution coefficients
130  double r11 = 0.5, r12 = 0.45, r1S = 0.4, r22 = 0.4, r2S = 0.4, rSS = 0.6;
131  // sliding friction coefficients
132  double mu11 = 0.3, mu12 = 0.2, mu1S = 0.2, mu22 = 0.4, mu2S = 0.2, muSS = 0.5;
133 
135  species.setEffectiveElasticModulusAndRestitutionCoefficient(E11, r11);
136  species.setEffectiveShearModulus(G11);
137  species.setSlidingFrictionCoefficient(mu11);
138  species.setDensity(2500);
140 
141  species.setEffectiveElasticModulusAndRestitutionCoefficient(E22, r22);
142  species.setEffectiveShearModulus(G22);
143  species.setSlidingFrictionCoefficient(mu22);
144  species.setDensity(2000);
146 
147  species.setEffectiveElasticModulusAndRestitutionCoefficient(ESS, rSS);
148  species.setEffectiveShearModulus(GSS);
149  species.setSlidingFrictionCoefficient(muSS);
150  species.setDensity(7200);
152 
153  auto m12 = speciesHandler.getMixedObject(m1, m2);
154  m12->setEffectiveElasticModulusAndRestitutionCoefficient(E12, r12);
155  m12->setEffectiveShearModulus(G12);
156  m12->setSlidingFrictionCoefficient(mu12);
157 
158  auto m1S = speciesHandler.getMixedObject(m1, steel);
159  m1S->setEffectiveElasticModulusAndRestitutionCoefficient(E1S, r1S);
160  m1S->setEffectiveShearModulus(G1S);
161  m1S->setSlidingFrictionCoefficient(mu1S);
162 
163  auto m2S = speciesHandler.getMixedObject(m2, steel);
164  m2S->setEffectiveElasticModulusAndRestitutionCoefficient(E2S, r2S);
165  m2S->setEffectiveShearModulus(G2S);
166  m2S->setSlidingFrictionCoefficient(mu2S);
167  }
168 
169 
170 };
171 
172 
173 #endif //MERCURYDPM_MERCURYOS_H
Map< RowVectorXf > v2(M2.data(), M2.size())
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:360
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:16
Definition: MercuryOS.h:17
static double getEffectiveElasticModulus(double E1, double v1, double E2, double v2)
Definition: MercuryOS.h:82
bool writeOutput() const
Definition: MercuryOS.h:36
static double getEffectiveShearModulus(double E1, double v1, double E2, double v2)
Definition: MercuryOS.h:90
bool test() const
Definition: MercuryOS.h:48
void setMaterialProperties()
Definition: MercuryOS.h:104
bool test_
Definition: MercuryOS.h:21
bool soft() const
Definition: MercuryOS.h:60
bool useMercuryWalls_
Definition: MercuryOS.h:23
void soft(bool soft)
Definition: MercuryOS.h:54
void useMercuryWalls(bool useMercuryWalls)
Definition: MercuryOS.h:66
void test(bool test)
Definition: MercuryOS.h:42
HertzianViscoelasticMindlinSpecies * m1
Definition: MercuryOS.h:98
bool soft_
Definition: MercuryOS.h:25
void writeOutput(bool writeOutput)
Definition: MercuryOS.h:30
HertzianViscoelasticMindlinSpecies * steel
Definition: MercuryOS.h:98
bool writeOutput_
Definition: MercuryOS.h:19
HertzianViscoelasticMindlinSpecies * m2
Definition: MercuryOS.h:98
bool useMercuryWalls() const
Definition: MercuryOS.h:72
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:52
Contains material and contact force properties.
Definition: Species.h:14
Definition: indexed_view.cpp:20