CASM  1.1.0
A Clusters Approach to Statistical Mechanics
StrainConverter.hh
Go to the documentation of this file.
1 #ifndef STRAINCONVERTER_HH
2 #define STRAINCONVERTER_HH
3 
4 #include <vector>
5 
7 #include "casm/external/Eigen/Dense"
10 
11 //--------------------------------------------------
12 // STRAIN CLASS
13 // NAMING CONVENTION:
14 // - F: deformation tensor (F = R * U)
15 // - E: strain metric (calculated based on what STRAIN_METRIC_MODE is)
16 // - R: rotation tensor
17 // - U: stretch tensor
18 // - C: F^{T} * F
19 // - unrolled_E: the 6 unique components of E ordered in an order
20 // specified by order_strain
21 // - sop: strain order parameter (sop = sop_transf_mat * unrolled_E)
22 
23 namespace CASM {
24 class SymGroup;
25 namespace SymRepTools {
26 struct IrrepWedge;
27 }
28 
32 
33 // Enum type that will define how the strain metrics used to
34 // calculate strain order parameters are going to be calculated
36 /* enum STRAIN_METRIC {GREEN_LAGRANGE = 0, BIOT = 1, HENCKY = 2, EULER_ALMANSI =
37  * 3, STRETCH = 4, DISP_GRAD = 5}; */
38 
40  public:
41  // Static methods for conversion from F to various strain metrics
42 
44  static Matrix3d green_lagrange(Eigen::Ref<const Matrix3d> const &F);
45  static Matrix3d green_lagrange_to_F(Eigen::Ref<const Matrix3d> const &E);
46 
48  static Matrix3d biot(Eigen::Ref<const Matrix3d> const &F);
49  static Matrix3d biot_to_F(Eigen::Ref<const Matrix3d> const &B);
50 
52  static Matrix3d hencky(Eigen::Ref<const Matrix3d> const &F);
53  static Matrix3d hencky_to_F(Eigen::Ref<const Matrix3d> const &H);
54 
56  static Matrix3d euler_almansi(Eigen::Ref<const Matrix3d> const &F);
57  static Matrix3d euler_almansi_to_F(Eigen::Ref<const Matrix3d> const &A);
58 
60  static Matrix3d disp_grad(Eigen::Ref<const Matrix3d> const &F);
61  static Matrix3d disp_grad_to_F(Eigen::Ref<const Matrix3d> const &F) {
62  return F;
63  }
64 
65  //-------------------------------------------------
66  // Routines that calculate derived quantities given the
67  // deformation tensor
68  static Matrix3d metric_tensor(Eigen::Ref<const Matrix3d> const &F);
70  Eigen::Ref<const Matrix3d> const &F);
71  static Matrix3d right_stretch_tensor(Eigen::Ref<const Matrix3d> const &F);
72 
73  static Matrix3d strain_metric(Eigen::Ref<const Matrix3d> const &F,
74  STRAIN_METRIC MODE);
75  //-------------------------------------------------
76 
77  StrainConverter(const STRAIN_METRIC &_MODE, const MatrixXd &_sop_transf_mat,
78  const std::vector<std::vector<Index> > &_order_strain)
79  : STRAIN_METRIC_MODE(_MODE),
80  m_sop_transf_mat(_sop_transf_mat),
81  m_order_strain(_order_strain) {
82  if (_MODE == STRAIN_METRIC::GREEN_LAGRANGE)
84  else if (_MODE == STRAIN_METRIC::BIOT)
86  else if (_MODE == STRAIN_METRIC::HENCKY)
88  else if (_MODE == STRAIN_METRIC::EULER_ALMANSI)
90  else if (_MODE == STRAIN_METRIC::STRETCH)
92  else if (_MODE == STRAIN_METRIC::DISP_GRAD)
94  }
95 
96  StrainConverter(const std::string &mode_name) { set_mode(mode_name); }
97 
98  Index dim() const { return m_order_strain.size(); }
99 
100  //-------------------------------------------------
102  Matrix3d strain_metric(Eigen::Ref<const Matrix3d> const &F) const;
103  Matrix3d strain_metric_to_F(Eigen::Ref<const Matrix3d> const &E) const;
104 
106  VectorXd unroll_E(Eigen::Ref<const Matrix3d> const &E) const;
107  Matrix3d rollup_E(Eigen::Ref<const VectorXd> const &_unrolled_E) const;
108 
109  VectorXd unrolled_strain_metric(Eigen::Ref<const Matrix3d> const &F) const;
111  Eigen::Ref<const VectorXd> const &E) const;
112 
114  Eigen::Ref<const Matrix3d> const &F) const;
116  Eigen::Ref<const Matrix3d> const &F, STRAIN_METRIC MODE) const;
117 
118  //--------------------------------------------------
119  // Routines that set the internal parameters of the
120  // class
121  void set_mode(const std::string &mode_name);
122 
124 
125  SymGroupRepID symrep_ID() const { return m_symrep_ID; }
126 
127  void set_symmetrized_sop(const SymGroup &pg);
128 
132 
133  // Need to rewrite these routines to write out only the settings
134  // jsonParser &to_json(const StrainConverter &strain, jsonParser &json);
135  // void from_json(StrainConverter &strain, const jsonParser &json);
136 
137  private:
139  STRAIN_METRIC_MODE; // set the mode when you initialize your PRIM
140  MatrixXd m_sop_transf_mat; // Use as sop = sop_transf_mat * unrolled_E
141  // unrolled_E[i]= m_weight_strain[i]*strain(m_order_strain[i][0],
142  // m_order_strain[i][1])
143  std::vector<std::vector<Index> >
144  m_order_strain; // lists the order of strains to list unrolled_E
145  Eigen::VectorXd m_weight_strain; // weights for the elements of unrolled_E
146 
148  // typedef MetricFuncPtr for method pointers that take displacement gradient
149  // tensor as argument
150  typedef Matrix3d (*MetricFuncPtr)(Eigen::Ref<const Matrix3d> const &);
153 };
154 } // namespace CASM
155 #endif
Matrix3d unrolled_strain_metric_to_F(Eigen::Ref< const VectorXd > const &E) const
std::vector< std::vector< Index > > m_order_strain
VectorXd unroll_E(Eigen::Ref< const Matrix3d > const &E) const
Unrolls the green-lagrange metric ( or any symmetric metric)
static Matrix3d right_stretch_tensor(Matrix3d &C, Eigen::Ref< const Matrix3d > const &F)
static Matrix3d euler_almansi_to_F(Eigen::Ref< const Matrix3d > const &A)
EULER_ALMANSI = (I-(F F^{T})^(-1))/2.
static Matrix3d hencky(Eigen::Ref< const Matrix3d > const &F)
HENCKY = log(C)/2.
static Matrix3d biot(Eigen::Ref< const Matrix3d > const &F)
BIOT = (U-I)
static Matrix3d strain_metric(Eigen::Ref< const Matrix3d > const &F, STRAIN_METRIC MODE)
static Matrix3d hencky_to_F(Eigen::Ref< const Matrix3d > const &H)
HENCKY = log(C)/2.
const Eigen::MatrixXd & sop_transf_mat() const
static Matrix3d euler_almansi(Eigen::Ref< const Matrix3d > const &F)
EULER_ALMANSI = (I-(F F^{T})^(-1))/2.
Matrix3d rollup_E(Eigen::Ref< const VectorXd > const &_unrolled_E) const
static Matrix3d metric_tensor(Eigen::Ref< const Matrix3d > const &F)
VectorXd unrolled_strain_metric(Eigen::Ref< const Matrix3d > const &F) const
Matrix3d(* MetricFuncPtr)(Eigen::Ref< const Matrix3d > const &)
void set_mode(const std::string &mode_name)
static Matrix3d disp_grad(Eigen::Ref< const Matrix3d > const &F)
DISP_GRAD = F.
STRAIN_METRIC STRAIN_METRIC_MODE
StrainConverter(const STRAIN_METRIC &_MODE, const MatrixXd &_sop_transf_mat, const std::vector< std::vector< Index > > &_order_strain)
StrainConverter(const std::string &mode_name)
static Matrix3d green_lagrange_to_F(Eigen::Ref< const Matrix3d > const &E)
GREEN_LAGRANGE = 1/2 * (F^{T} F - I)
static Matrix3d biot_to_F(Eigen::Ref< const Matrix3d > const &B)
BIOT = (U-I)
static Matrix3d disp_grad_to_F(Eigen::Ref< const Matrix3d > const &F)
VectorXd sop(Matrix3d &E, Matrix3d &C, Matrix3d &U, Eigen::Ref< const Matrix3d > const &F) const
static Matrix3d green_lagrange(Eigen::Ref< const Matrix3d > const &F)
GREEN_LAGRANGE = (C-I)/2.
MetricFuncPtr curr_inv_metric_func
void set_symmetrized_sop(const SymGroup &pg)
MetricFuncPtr curr_metric_func
void set_conventional_order_unsymmetric()
SymGroupRepID symrep_ID() const
Eigen::VectorXd m_weight_strain
Matrix3d strain_metric_to_F(Eigen::Ref< const Matrix3d > const &E) const
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
Type-safe ID object for communicating and accessing Symmetry representation info.
Main CASM namespace.
Definition: APICommand.hh:8
Eigen::MatrixXd MatrixXd
Eigen::Matrix3d Matrix3d
strain::METRIC STRAIN_METRIC
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Eigen::VectorXd VectorXd
An irreducible wedge in an irreducible vector space.
Definition: SymRepTools.hh:77