Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions source/particle/property/cpo_bingham_average.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ namespace aspect
const Tensor<1,3,double> eigvec_b = eigenvectors_b[0].second;
const Tensor<1,3,double> eigvec_c = eigenvectors_c[0].second;

// compute cross product to check for handedness of output rotation
double handedness = 0;
for (unsigned int i1=0; i1<3; i1++)
for (unsigned int i2=0; i2<3; i2++)
for (unsigned int i3=0; i3<3; i3++)
handedness += Utilities::Tensors::levi_civita<3>()[i1][i2][i3]*eigvec_a[i1]*eigvec_b[i2]*eigvec_c[i3];

// build rotation matrix from the eigen vectors
Tensor<2,3> R_CPO;
R_CPO[0][0] = eigvec_a[0];
Expand All @@ -278,9 +285,19 @@ namespace aspect
R_CPO[0][1] = eigvec_b[0];
R_CPO[1][1] = eigvec_b[1];
R_CPO[2][1] = eigvec_b[2];
R_CPO[0][2] = eigvec_c[0];
R_CPO[1][2] = eigvec_c[1];
R_CPO[2][2] = eigvec_c[2];
// ensure right-handedness
if (handedness < 0)
{
R_CPO[0][2] = -eigvec_c[0];
R_CPO[1][2] = -eigvec_c[1];
R_CPO[2][2] = -eigvec_c[2];
}
else
{
R_CPO[0][2] = eigvec_c[0];
R_CPO[1][2] = eigvec_c[1];
R_CPO[2][2] = eigvec_c[2];
}

// convert rotation matrix to euler angles phi1, theta, phi2
Tensor<2,3> Rot = transpose(R_CPO);
Expand Down
4 changes: 0 additions & 4 deletions source/particle/property/crystal_preferred_orientation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,6 @@ namespace aspect
void
CrystalPreferredOrientation<dim>::parse_parameters (ParameterHandler &prm)
{
AssertThrow(dim == 3, ExcMessage("CPO computations are currently only supported for 3d models. "
"2d computations will work when this assert is removed, but you will need to make sure that the "
"correct 3d strain-rate and velocity gradient tensors are provided to the algorithm."));

prm.enter_subsection("Crystal Preferred Orientation");
{
random_number_seed = prm.get_integer ("Random number seed");
Expand Down
Loading