MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StressStrainControlBoundary.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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"
34 
36 
53 {
54 public:
57 
60 
62  virtual ~StressStrainControlBoundary() = default;
63 
65  void read(std::istream& is) override;
66 
68  void write(std::ostream& os) const override;
69 
71  std::string getName() const override;
72 
74  StressStrainControlBoundary* copy() const override;
75 
77  void checkBoundaryAfterParticlesMove(ParticleHandler& particleHandler) override;
78 
82  void set(const Matrix3D& stressGoal, const Matrix3D& strainRate, const Matrix3D& gainFactor,
83  bool isStrainRateControlled);
84 
86  void createPeriodicParticles(ParticleHandler& particleHandler) override;
87 
88  //helper functions
89 
92 
95 
97  void activateStrainRateControl(const ParticleHandler& particleHandler);
98 
100  void computeStrainRate();
101 
104 
106  void updateDomainSize();
107 
110 
113 
116 
117 private:
118 
119  //Set by the user.
125 
128 
135 
138 
139  //Defined in the set function.
140 
144  std::vector<LeesEdwardsBoundary> leesEdwardsBoundaries_;
145  std::vector<PeriodicBoundary> periodicBoundaries_;
146 };
147 
148 #endif
Mdouble integratedShift_
Shift integrated for all the time when using Lees-Edwards Boundary.
void checkBoundaryAfterParticlesMove(ParticleHandler &particleHandler) override
Virtual function that does things to particles, each timestep after particles have moved...
Matrix3D getStrainRate() const
Accesses the strainrate tensor.
Vec3D lengthBox_
Box length in x-y-z.
void activateStrainRateControl(const ParticleHandler &particleHandler)
Activate the strainrate control for particle movement based on user's boolean input.
std::vector< PeriodicBoundary > periodicBoundaries_
double Mdouble
Definition: GeneralDefine.h:34
void determineStressControlledShearBoundaries()
Determines stress-controlled shear Lees-Edwards boundary in x-y direction and normal periodic in z di...
StressStrainControlBoundary()
default constructor.
virtual ~StressStrainControlBoundary()=default
destructor.
std::vector< LeesEdwardsBoundary > leesEdwardsBoundaries_
Store boundaries into a vector for the pushback.
void updateDomainSize()
Update the domain to new sizes.
Vec3D relativeToCenter_
Particle position relative to the center of domain.
Container to store pointers to all BasePeriodicBoundary objects.
void read(std::istream &is) override
Reads the object's id_ from given istream.
Matrix3D stressGoal_
Stores the stress value the boundary should attain.
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 ...
void computeStrainRate()
Compute the change of strainrate tensor based on the stress difference and then update the tensor...
Vec3D centerBox_
Center position of the domain.
A cuboid box consists of periodic boundaries that can be strain/stress controlled and achieve differe...
StressStrainControlBoundary * copy() const override
Used to create a copy of the object.
Container to store all BaseParticle.
Matrix3D getGainFactor() const
Accesses the gainFactor.
bool isStrainRateControlled_
The boolean input, true means switch on the strain rate control for particles affine movements...
Matrix3D getStressGoal() const
Accesses the target stress tensor.
std::string getName() const override
Sets the name of the boundary.
void write(std::ostream &os) const override
Adds object's id_ to given ostream.
Implementation of a 3D matrix.
Definition: Matrix.h:37
Definition: Vector.h:49
void createPeriodicParticles(ParticleHandler &particleHandler) override
Create the periodic particles after read in from a restart file to attain right information.
void checkPeriodicLeesEdwardsBoundariesAfterParticlesMove(ParticleHandler &particleHandler)
Call the boundary and update them based on the new domain size after the stress-control movement...
void determineLengthAndCentre()
Determine the length in x,y,z and center location of domain.