9#ifndef model_SLIPSYSTEM_cpp_
10#define model_SLIPSYSTEM_cpp_
14#include <LatticeModule.h>
23 const std::shared_ptr<DislocationMobility>& mobility_in,
24 const std::shared_ptr<GlidePlaneNoise>& planeNoise_in):
44 std::cout<<
" s= "<<std::setprecision(15)<<std::scientific<<
s.cartesian().transpose()<<std::endl;
45 std::cout<<
" n= "<<std::setprecision(15)<<std::scientific<<
n.cartesian().transpose()<<std::endl;
46 std::cout<<
" mobility= "<<
mobility->name<<std::endl;
51 throw std::runtime_error(
"SlipSystem: PLANE NORMAL AND SLIP DIRECTION ARE NOT ORTHOGONAL.");
55 throw std::runtime_error(
"SlipSystem: MOBILITY CANNOT BE A NULLPTR.");
58 if((
G2Lfull*
G2Lfull.transpose()-MatrixDim::Identity()).squaredNorm()>FLT_EPSILON)
60 throw std::runtime_error(
"G2Lfull is not orthogonal.");
67 return abs(
s.rat.d)!=1;
72 if( ((
s-
s1).squaredNorm()==0 && (
n-n1).base().squaredNorm()==0)
73 || ((
s+
s1).squaredNorm()==0 && (
n+n1).base().squaredNorm()==0)
86 return (
G2Lfull*
x).template segment<2>(0);
91 return (
G2Lfull.transpose()).template block<3,2>(0,0)*
x;
101 const Eigen::Matrix<double,3,3> ssStress( std::get<0>(gridNoise)*(
G2Lfull.row(2).transpose()*
G2Lfull.row(0)+
G2Lfull.row(0).transpose()*
G2Lfull.row(2))
104 return std::make_tuple(ssStress,ssRSS,std::get<2>(gridNoise));
108 return std::make_tuple(Eigen::Matrix<double,3,3>::Zero(),0.0,0.0);
112 std::tuple<Eigen::Matrix<double,3,3>,double,
double>
SlipSystem::gridVal(
const Eigen::Array<int,2,1>& idx)
const
117 const std::tuple<double,double,double> gridNoise(
planeNoise->gridVal(idx));
119 const Eigen::Matrix<double,3,3> ssStress( std::get<0>(gridNoise)*(
G2Lfull.row(2).transpose()*
G2Lfull.row(0)+
G2Lfull.row(0).transpose()*
G2Lfull.row(2))
122 return std::make_tuple(ssStress,ssRSS,std::get<2>(gridNoise));
126 return std::make_tuple(Eigen::Matrix<double,3,3>::Zero(),0.0,0.0);
static std::string greenColor
static std::string defaultColor
Eigen::Matrix< double, 2, 1 > globalToLocal(const VectorDim &x) const
const std::shared_ptr< GlidePlaneNoise > planeNoise
std::tuple< Eigen::Matrix< double, 3, 3 >, double, double > gridVal(const Eigen::Array< int, 2, 1 > &idx) const
std::tuple< Eigen::Matrix< double, 3, 3 >, double, double > gridInterp(const VectorDim &x) const
Eigen::Matrix< double, 3, 1 > VectorDim
const RationalLatticeDirection< 3 > s
const VectorDim unitNormal
VectorDim localToGlobal(const Eigen::Matrix< double, 2, 1 > &x) const
double velocity(const MatrixDim &S, const VectorDim &xi, const double &T) const
Eigen::Matrix< double, 3, 3 > MatrixDim
bool isSameAs(const RationalLatticeDirection< 3 > &s1, const ReciprocalLatticeDirection< 3 > &n1)
const std::shared_ptr< DislocationMobility > mobility
SlipSystem(const GlidePlaneBase &n_in, const RationalLatticeDirection< 3 > &slip_in, const std::shared_ptr< DislocationMobility > &mobility_in, const std::shared_ptr< GlidePlaneNoise > &planeNoise_in)
const VectorDim unitSlipFull