PRISMS-PF  v2.1
nucleationParameters.h
Go to the documentation of this file.
1 #ifndef INCLUDE_NUCLEATIONPARAMETERS_H_
2 #define INCLUDE_NUCLEATIONPARAMETERS_H_
3 
4 template<int dim>
6 {
7 public:
8  unsigned int var_index;
9  std::vector<double> semiaxes;
10  std::vector<double> ellipsoid_rotation;
11  std::vector<double> freeze_semiaxes;
13  double hold_time;
14  dealii::Tensor<2,dim,double> rotation_matrix;
15 
16  nucleationParameters(unsigned int _var_index,
17  std::vector<double> _semiaxes,
18  std::vector<double> _freeze_semiaxes,
19  std::vector<double> _ellipsoid_rotation,
20  double _hold_time,
21  double _no_nucleation_border_thickness){
22 
23  var_index =_var_index;
24  semiaxes = _semiaxes;
25  freeze_semiaxes = _freeze_semiaxes;
26  ellipsoid_rotation = _ellipsoid_rotation;
27  hold_time = _hold_time;
28  no_nucleation_border_thickness = _no_nucleation_border_thickness;
29 
31  };
32 
34  // Rotation conventions:
35  // Rx refers to rotations about the x axis, Ry refers to rotations about the y axis, and Rz refers to rotations about the z axis.
36  // A positive rotation angle about the z axis corresponds to a clockwise rotation of the particle in a 2D calculation.
37 
38  double degrees_to_rad = std::acos(0.0)/90.0;
39 
40  dealii::Tensor<2,dim,double> Rx, Ry, Rz;
41 
42  Rx[0][0] = 1.0;
43  Rx[1][1] = std::cos(ellipsoid_rotation.at(0)*degrees_to_rad);
44 
45  Ry[0][0] = std::cos(ellipsoid_rotation.at(1)*degrees_to_rad);
46  Ry[1][1] = 1.0;
47 
48  Rz[0][0] = std::cos(ellipsoid_rotation.at(2)*degrees_to_rad);
49  Rz[1][0] = std::sin(ellipsoid_rotation.at(2)*degrees_to_rad);
50  Rz[0][1] = -std::sin(ellipsoid_rotation.at(2)*degrees_to_rad);
51  Rz[1][1] = std::cos(ellipsoid_rotation.at(2)*degrees_to_rad);
52 
53  if (dim == 3){
54  Rx[1][2] = - std::sin(ellipsoid_rotation.at(0)*degrees_to_rad);
55  Rx[2][1] = std::sin(ellipsoid_rotation.at(0)*degrees_to_rad);
56  Rx[2][2] = std::cos(ellipsoid_rotation.at(0)*degrees_to_rad);
57 
58  Ry[0][2] = std::sin(ellipsoid_rotation.at(1)*degrees_to_rad);
59  Ry[2][0] = -std::sin(ellipsoid_rotation.at(1)*degrees_to_rad);
60  Ry[2][2] = std::cos(ellipsoid_rotation.at(1)*degrees_to_rad);
61 
62  Rz[2][2] = 1.0;
63  }
64 
65  rotation_matrix = Rx*Ry*Rz; // Note: these are tensor multiplications
66 
67  };
68 
69 };
70 
71 #endif
std::vector< double > ellipsoid_rotation
dealii::Tensor< 2, dim, double > rotation_matrix
nucleationParameters(unsigned int _var_index, std::vector< double > _semiaxes, std::vector< double > _freeze_semiaxes, std::vector< double > _ellipsoid_rotation, double _hold_time, double _no_nucleation_border_thickness)
std::vector< double > freeze_semiaxes
std::vector< double > semiaxes