StressStrainControlBoundary.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 
26 #ifndef StressStrainControlBoundary_H
27 #define StressStrainControlBoundary_H
28 
29 #include "BaseBoundary.h"
30 #include "Math/ExtendedMath.h"
31 #include "Side.h"
32 #include "LeesEdwardsBoundary.h"
33 #include "PeriodicBoundary.h"
38 
55 {
56 public:
57 
60 
63 
65  virtual ~StressStrainControlBoundary() = default;
66 
68  void read(std::istream& is) override;
69 
71  void write(std::ostream& os) const override;
72 
74  std::string getName() const override;
75 
77  StressStrainControlBoundary* copy() const override;
78 
80  void checkBoundaryAfterParticlesMove(ParticleHandler& particleHandler) override;
81 
85  void set(const Matrix3D& stressGoal, const Matrix3D& strainRate, const Matrix3D& gainFactor,
86  bool isStrainRateControlled);
87 
88  void setStrainRate(const Matrix3D& strainRate);
89 
91  void createPeriodicParticles(ParticleHandler& particleHandler) override;
92 
93  //helper functions
94 
97 
100 
102  void activateStrainRateControl(const ParticleHandler& particleHandler);
103 
105  void computeStrainRate();
106 
109 
111  void updateDomainSize();
112 
115 
118 
121 
122 
124 
125 
126 
127  double getIntegratedShift() const {return integratedShift_;}
128 
129 // // Proportional Controller
130 // static void pControl (Mdouble& strainRate, Mdouble stress, Mdouble stressGoal, Mdouble pGain) {
131 // strainRate = pGain * (stress- stressGoal);
132 // }
133 
134 
135 private:
136 
137  //Set by the user.
144 
147 
150 
151  //Defined in the set function.
152 
156  std::vector<LeesEdwardsBoundary> leesEdwardsBoundaries_;
157  std::vector<PeriodicBoundary> periodicBoundaries_;
158 };
159 
160 #endif
double Mdouble
Definition: GeneralDefine.h:34
Definition: BaseBoundary.h:49
Implementation of a 3D matrix.
Definition: Matrix.h:38
Container to store all BaseParticle.
Definition: ParticleHandler.h:48
Container to store pointers to all BasePeriodicBoundary objects.
Definition: PeriodicBoundaryHandler.h:46
A cuboid box consists of periodic boundaries that can be strain/stress controlled and achieve differe...
Definition: StressStrainControlBoundary.h:55
Matrix3D gainFactor_
Definition: StressStrainControlBoundary.h:143
bool isStrainRateControlled_
The boolean input, true means switch on the strain rate control for particles affine movements.
Definition: StressStrainControlBoundary.h:146
void write(std::ostream &os) const override
Adds object's id_ to given ostream.
Definition: StressStrainControlBoundary.cc:64
void checkPeriodicLeesEdwardsBoundariesAfterParticlesMove(ParticleHandler &particleHandler)
Call the boundary and update them based on the new domain size after the stress-control movement.
Definition: StressStrainControlBoundary.cc:139
Mdouble integratedShift_
Shift integrated for all the time when using Lees-Edwards Boundary.
Definition: StressStrainControlBoundary.h:149
void set(const Matrix3D &stressGoal, const Matrix3D &strainRate, const Matrix3D &gainFactor, bool isStrainRateControlled)
Sets all boundary inputs at once and determines which deformation mode it is, then combine the right ...
Definition: StressStrainControlBoundary.cc:310
std::vector< PeriodicBoundary > periodicBoundaries_
Definition: StressStrainControlBoundary.h:157
Matrix3D getStressGoal() const
Accesses the target stress tensor.
Definition: StressStrainControlBoundary.h:117
void activateStrainRateControl(const ParticleHandler &particleHandler)
Activate the strainrate control for particle movement based on user's boolean input.
Definition: StressStrainControlBoundary.cc:199
virtual ~StressStrainControlBoundary()=default
destructor.
StressStrainControlBoundary * copy() const override
Used to create a copy of the object.
Definition: StressStrainControlBoundary.cc:55
Mdouble computeStressError()
Definition: StressStrainControlBoundary.cc:48
std::string getName() const override
Sets the name of the boundary.
Definition: StressStrainControlBoundary.cc:105
Matrix3D getGainFactor() const
Accesses the gainFactor.
Definition: StressStrainControlBoundary.h:120
void createPeriodicParticles(ParticleHandler &particleHandler) override
Create the periodic particles after read in from a restart file to attain right information.
Definition: StressStrainControlBoundary.cc:384
Matrix3D strainRate_
Definition: StressStrainControlBoundary.h:143
Matrix3D getStrainRate() const
Accesses the strainrate tensor.
Definition: StressStrainControlBoundary.h:114
void determineLengthAndCentre()
Determine the length in x,y,z and center location of domain.
Definition: StressStrainControlBoundary.cc:156
void setStrainRate(const Matrix3D &strainRate)
Definition: StressStrainControlBoundary.cc:375
Matrix3D stressGoal_
Stores the stress value the boundary should attain.
Definition: StressStrainControlBoundary.h:143
void read(std::istream &is) override
Reads the object's id_ from given istream.
Definition: StressStrainControlBoundary.cc:89
void determineStressControlledShearBoundaries()
Determines stress-controlled shear Lees-Edwards boundary in x-y direction and normal periodic in z di...
Definition: StressStrainControlBoundary.cc:268
void checkBoundaryAfterParticlesMove(ParticleHandler &particleHandler) override
Virtual function that does things to particles, each timestep after particles have moved.
Definition: StressStrainControlBoundary.cc:115
void updateDomainSize()
Update the domain to new sizes.
Definition: StressStrainControlBoundary.cc:246
std::vector< LeesEdwardsBoundary > leesEdwardsBoundaries_
Definition: StressStrainControlBoundary.h:156
void computeStrainRate()
Compute the change of strainrate tensor based on the stress difference and then update the tensor.
Definition: StressStrainControlBoundary.cc:165
StressStrainControlBoundary()
default constructor.
Definition: StressStrainControlBoundary.cc:37
double getIntegratedShift() const
Definition: StressStrainControlBoundary.h:127
StressStrainControlBoundary(const StressStrainControlBoundary &b)=default
copy constructor.