Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
GrainBoundaryDissociation.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_GrainBoundaryDissociation_H_
9#define model_GrainBoundaryDissociation_H_
10
11#include <deque>
12#include <utility>
13#include <math.h>
14#include <TerminalColors.h>
15#include <DissociateSegment.h>
16 // defines mode::cout
17
18
19namespace model
20{
21
22 template <typename DislocationNetworkType>
23 class GrainBoundaryDissociation : private std::deque<DissociateSegment<typename DislocationNetworkType::LinkType> >
24 {
25
27
28 static constexpr double chordTol=1.0;
29
30 public:
31
32 static bool use_GBdissociation;
33
34 /**********************************************************************/
36 /* init */ DN(DN_in)
37 {
39 {
40 for (const auto& segment : DN.links() )
41 {
42
43 if ( !(segment.second.source->isBoundaryNode() && segment.second.sink->isBoundaryNode())
44 && segment.second.isGrainBoundarySegment()
45 && segment.second.chord().norm()>chordTol*DislocationNetworkRemesh<TypeTraits<DislocationNetworkType>::dim>::Lmin)
46 {
47 this->emplace_back(segment.second);
48 }
49 }
50 }
51
52 }
53
54 /**********************************************************************/
56 {
58 {
59 std::cout<<" grain-boundary dissociation..."<<std::flush;
60
61 const auto t0= std::chrono::system_clock::now();
62 size_t nDissociateted=0;
63 for(const auto& gbSegment : *this)
64 {
65 if(DN.link(gbSegment.sourceID,gbSegment.sinkID).first)
66 {
67 if(gbSegment.isValidDissociation)
68 {
69 DN.template disconnect<false>(gbSegment.sourceID,gbSegment.sinkID);
70 DN.connect(gbSegment.sourceID,gbSegment.sinkID,gbSegment.residualBurgers);
71 const size_t newNodeID(DN.insertVertex(gbSegment.dissociateMidpoint.cartesian(),gbSegment.grain.grainID).first->first);
72 DN.connect(gbSegment.sinkID,newNodeID,gbSegment.dissociateBurgers);
73 DN.connect(newNodeID,gbSegment.sourceID,gbSegment.dissociateBurgers);
74 nDissociateted++;
75 }
76 }
77 }
78
79 std::cout<<"("<<nDissociateted<<" dissociations)"<<magentaColor<<" ["<<(std::chrono::duration<double>(std::chrono::system_clock::now()-t0)).count()<<" sec]"<<defaultColor<<std::endl;
80 }
81 }
82
83 };
84
85 template <typename DislocationNetworkType>
87
88} // end namespace
89#endif
90
Class template that handles the nodal remesh of the DislocationNetwork.
GrainBoundaryDissociation(DislocationNetworkType &DN_in)
size_t InstanceCount< Derived >::count
static std::string magentaColor
static std::string defaultColor
DislocationNetwork< 3 > DislocationNetworkType
Definition pyMoDELib.cxx:69
REAL t0