Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize GridTools::rotate for arbitrary rotation axes. #12816

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/news/changes/incompatibilities/20211011Fehling
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Changed: The 3D implementation of GridTools::rotate() with an integer
for a Cartesian coordinate direction has been superseded by the version
that accepts unit vectors as rotation axes. Further,
Physics::Transformations::Rotations::rotation_matrix_3d() now requires
a Tensor<1,3> object instead of a Point<3> as an axis.
<br>
(Marc Fehling, 2021/10/11)
4 changes: 4 additions & 0 deletions doc/news/changes/minor/20211011Fehling
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changed: The 3D implementation of GridTools::rotate() now accepts unit
vectors as rotation axes.
<br>
(Marc Fehling, 2021/10/11)
8 changes: 4 additions & 4 deletions examples/step-18/step-18.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ namespace Step18
{
// Again first compute the curl of the velocity field. This time, it is a
// real vector:
const Point<3> curl(grad_u[2][1] - grad_u[1][2],
grad_u[0][2] - grad_u[2][0],
grad_u[1][0] - grad_u[0][1]);
const Tensor<1, 3> curl({grad_u[2][1] - grad_u[1][2],
grad_u[0][2] - grad_u[2][0],
grad_u[1][0] - grad_u[0][1]});

// From this vector, using its magnitude, compute the tangent of the angle
// of rotation, and from it the actual angle of rotation with respect to
Expand Down Expand Up @@ -317,7 +317,7 @@ namespace Step18
// Otherwise compute the real rotation matrix. For this, again we rely on
// a predefined function to compute the rotation matrix of the local
// coordinate system.
const Point<3> axis = curl / tan_angle;
const Tensor<1, 3> axis = curl / tan_angle;
return Physics::Transformations::Rotations::rotation_matrix_3d(axis,
-angle);
}
Expand Down
6 changes: 3 additions & 3 deletions include/deal.II/base/symmetric_tensor.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,15 @@ namespace internal
{
case (0):
R = dealii::Physics::Transformations::Rotations::rotation_matrix_3d(
{1, 0, 0}, rotation_angle);
Tensor<1, 3>({1., 0., 0.}), rotation_angle);
break;
case (1):
R = dealii::Physics::Transformations::Rotations::rotation_matrix_3d(
{0, 1, 0}, rotation_angle);
Tensor<1, 3>({0., 1., 0.}), rotation_angle);
break;
case (2):
R = dealii::Physics::Transformations::Rotations::rotation_matrix_3d(
{0, 0, 1}, rotation_angle);
Tensor<1, 3>({0., 0., 1.}), rotation_angle);
break;
default:
AssertThrow(false, ExcNotImplemented());
Expand Down