MercuryOS.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 #ifndef MERCURYDPM_MERCURYOS_H
26 #define MERCURYDPM_MERCURYOS_H
27 
28 #include <Mercury3D.h>
30 #include <Logger.h>
31 
36 class MercuryOS : public Mercury3D
37 {
38  // if true, additional output files are written
39  bool writeOutput_ = false;
40  // if true, the simulation time is shortened
41  bool test_ = false;
42  // if true, smooth walls are used instead of the stl walls
43  bool useMercuryWalls_ = false;
44  // if true, the simulation time is shortened
45  bool soft_ = false;
46 
47 public:
48 
49  // sets the variable writeOutput_
51  {
53  }
54 
55  // returns the variable writeOutput_
56  bool writeOutput() const
57  {
58  return writeOutput_;
59  }
60 
61  // sets the variable test_
62  void test(bool test)
63  {
64  test_ = test;
65  }
66 
67  // returns the variable test_
68  bool test() const
69  {
70  return test_;
71  }
72 
73  // sets the variable soft_
74  void soft(bool soft)
75  {
76  soft_ = soft;
77  }
78 
79  // returns the variable soft_
80  bool soft() const
81  {
82  return soft_;
83  }
84 
85  // sets the variable useMercuryWalls_
87  {
89  }
90 
91  // returns the variable useMercuryWalls_
92  bool useMercuryWalls() const
93  {
94  return useMercuryWalls_;
95  }
96 
97 private:
98 
102  static double getEffectiveElasticModulus(double E1, double v1, double E2, double v2)
103  {
104  return 1. / ((1 - v1 * v1) / E1 + (1 - v2 * v2) / E2);
105  }
106 
110  static double getEffectiveShearModulus(double E1, double v1, double E2, double v2)
111  {
112  double G1 = E1 / 2 / (1 + v1), G2 = E2 / 2 / (1 + v2);
113  return 1. / ((2 - v1) / G1 + (2 - v2) / G2);
114  }
115 
116 protected:
117  // pointers to the species
119 
120 public:
125  {
126  // Young's modulus and Poisson ratios of M1, M2, steel
127  double E1 = 1e9, E2 = 0.5e9, ES = 210e9;
128  double v1 = 0.2, v2 = 0.2, vS = 0.2;
129 
130  if (soft()) {
131  E1 = 2e6;
132  E2 = 1e6;
133  }
134 
135  // effective elastic and shear moduli
136  double E11 = getEffectiveElasticModulus(E1, v1, E1, v1);
137  double E12 = getEffectiveElasticModulus(E1, v1, E2, v2);
138  double E1S = getEffectiveElasticModulus(E1, v1, ES, vS);
139  double E22 = getEffectiveElasticModulus(E2, v2, E2, v2);
140  double E2S = getEffectiveElasticModulus(E2, v2, ES, vS);
141  double ESS = getEffectiveElasticModulus(ES, vS, ES, vS);
142  double G11 = getEffectiveShearModulus(E1, v1, E1, v1);
143  double G12 = getEffectiveShearModulus(E1, v1, E2, v2);
144  double G1S = getEffectiveShearModulus(E1, v1, ES, vS);
145  double G22 = getEffectiveShearModulus(E2, v2, E2, v2);
146  double G2S = getEffectiveShearModulus(E2, v2, ES, vS);
147  double GSS = getEffectiveShearModulus(ES, vS, ES, vS);
148 
149  // restitution coefficients
150  double r11 = 0.5, r12 = 0.45, r1S = 0.4, r22 = 0.4, r2S = 0.4, rSS = 0.6;
151  // sliding friction coefficients
152  double mu11 = 0.3, mu12 = 0.2, mu1S = 0.2, mu22 = 0.4, mu2S = 0.2, muSS = 0.5;
153 
155  species.setEffectiveElasticModulusAndRestitutionCoefficient(E11, r11);
156  species.setEffectiveShearModulus(G11);
157  species.setSlidingFrictionCoefficient(mu11);
158  species.setDensity(2500);
160 
161  species.setEffectiveElasticModulusAndRestitutionCoefficient(E22, r22);
162  species.setEffectiveShearModulus(G22);
163  species.setSlidingFrictionCoefficient(mu22);
164  species.setDensity(2000);
166 
167  species.setEffectiveElasticModulusAndRestitutionCoefficient(ESS, rSS);
168  species.setEffectiveShearModulus(GSS);
169  species.setSlidingFrictionCoefficient(muSS);
170  species.setDensity(7200);
172 
173  auto m12 = speciesHandler.getMixedObject(m1, m2);
174  m12->setEffectiveElasticModulusAndRestitutionCoefficient(E12, r12);
175  m12->setEffectiveShearModulus(G12);
176  m12->setSlidingFrictionCoefficient(mu12);
177 
178  auto m1S = speciesHandler.getMixedObject(m1, steel);
179  m1S->setEffectiveElasticModulusAndRestitutionCoefficient(E1S, r1S);
180  m1S->setEffectiveShearModulus(G1S);
181  m1S->setSlidingFrictionCoefficient(mu1S);
182 
183  auto m2S = speciesHandler.getMixedObject(m2, steel);
184  m2S->setEffectiveElasticModulusAndRestitutionCoefficient(E2S, r2S);
185  m2S->setEffectiveShearModulus(G2S);
186  m2S->setSlidingFrictionCoefficient(mu2S);
187  }
188 
189 
190 };
191 
192 
193 #endif //MERCURYDPM_MERCURYOS_H
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:379
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37
Definition: MercuryOS.h:37
static double getEffectiveElasticModulus(double E1, double v1, double E2, double v2)
Definition: MercuryOS.h:102
bool writeOutput() const
Definition: MercuryOS.h:56
static double getEffectiveShearModulus(double E1, double v1, double E2, double v2)
Definition: MercuryOS.h:110
bool test() const
Definition: MercuryOS.h:68
void setMaterialProperties()
Definition: MercuryOS.h:124
bool test_
Definition: MercuryOS.h:41
bool soft() const
Definition: MercuryOS.h:80
bool useMercuryWalls_
Definition: MercuryOS.h:43
void soft(bool soft)
Definition: MercuryOS.h:74
void useMercuryWalls(bool useMercuryWalls)
Definition: MercuryOS.h:86
void test(bool test)
Definition: MercuryOS.h:62
HertzianViscoelasticMindlinSpecies * m1
Definition: MercuryOS.h:118
bool soft_
Definition: MercuryOS.h:45
void writeOutput(bool writeOutput)
Definition: MercuryOS.h:50
HertzianViscoelasticMindlinSpecies * steel
Definition: MercuryOS.h:118
bool writeOutput_
Definition: MercuryOS.h:39
HertzianViscoelasticMindlinSpecies * m2
Definition: MercuryOS.h:118
bool useMercuryWalls() const
Definition: MercuryOS.h:92
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:74
Contains material and contact force properties.
Definition: Species.h:35