https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MooseAppCoordTransform Class Reference

#include <MooseAppCoordTransform.h>

Public Types

enum  Direction : unsigned int { X = 0 , Y , Z , INVALID }
 A class scope enumeration for conveniently denoting X, Y, and Z axis directions. More...
 
typedef std::tuple< short int, Real, short int, std::array< Real, 3 >, int, unsigned int, unsigned int, short int, short int, short intMinimalData
 A typedef for conveniency that describes the minimal data necessary to broadcast and build a MooseAppCoordTransform.
 

Public Member Functions

 MooseAppCoordTransform ()
 Default constructor.
 
 MooseAppCoordTransform (const MooseAppCoordTransform &other)
 
 MooseAppCoordTransform (MooseAppCoordTransform &&other)=default
 
 MooseAppCoordTransform (const MinimalData &minimal_data)
 Construct a coordinate transformation object from the minimal set of data required.
 
 MooseAppCoordTransform (const MooseMesh &mesh)
 Construct this object from the provided mesh and its input parameters.
 
 ~MooseAppCoordTransform ()=default
 
MooseAppCoordTransformoperator= (const MooseAppCoordTransform &other)
 
MooseAppCoordTransformoperator= (MooseAppCoordTransform &&other)=default
 
MinimalData minimalDataDescription () const
 
Moose::CoordinateSystemType coordinateSystem () const
 
void setTranslationVector (const libMesh::Point &translation)
 Set how much our domain should be translated in order to match a reference frame.
 
void setUpDirection (Direction up_direction)
 Will setup a rotation transformation.
 
void setRotation (Real alpha, Real beta, Real gamma)
 Setup an \emph extrinsic rotation defined in the following way:
 
void setLengthUnit (const MooseUnits &length_unit)
 Set the scaling transformation.
 
const MooseUnitslengthUnit () const
 
void setCoordinateSystem (Moose::CoordinateSystemType system_type, Direction rz_symmetry_axis=INVALID)
 Set our coordinate system.
 
void setCoordinateSystem (const MooseMesh &mesh)
 Set our coordinate system based on the MooseMesh coordinate system data.
 
void computeRS ()
 Compute the RS and (RS)^{-1} matrices.
 
void transformMesh (MooseMesh &mesh, const libMesh::Point &translation)
 Transforms the entire mesh with the coordinate transform This can be done to output in position, or to avoid transforming on every data point.
 
bool hasScalingOrRotationTransformation () const
 Returns true if the app has scaling and/or rotation transformation.
 

Static Public Member Functions

static InputParameters validParams ()
 Describes the parameters this object can take to setup transformations.
 

Private Member Functions

Direction processZAxis (Direction z_axis)
 If the coordinate system type is RZ, then we return the provided argument.
 

Private Attributes

std::unique_ptr< libMesh::RealTensorValue_scale
 Represents a forward scaling transformation from our units to reference frame units of meters.
 
std::unique_ptr< libMesh::RealTensorValue_rotate
 Represents a forward rotation transformation from our domain to the reference frame domain.
 
std::unique_ptr< libMesh::RealTensorValue_rs
 Represents the product of rotation and scaling transformations.
 
std::unique_ptr< libMesh::RealTensorValue_rs_inverse
 Represents the inverse of the product of rotation and scaling transformations.
 
Moose::CoordinateSystemType _coord_type
 Our coordinate system.
 
Direction _r_axis
 If we are RZ or RSPHERICAL, the Cartesian axis corresponding to the radial coordinate.
 
Direction _z_axis
 If we are RZ, the Cartesian axis corresponding to the axial/axis-of-symmetry coordinate.
 
bool _has_different_coord_sys
 Whether we have different coordinate systems within our single domain.
 
bool _using_general_rz_coord_axes
 Whether general axisymmetric coordinate axes are being used.
 
MooseUnits _length_unit
 How much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5 inches.
 
std::array< Real, 3 > _euler_angles
 The Euler angles describing rotation.
 
bool _mesh_transformed
 Whether the mesh has been translated and rotated.
 

Friends

class MultiAppCoordTransform
 

Detailed Description

Definition at line 24 of file MooseAppCoordTransform.h.

Member Typedef Documentation

◆ MinimalData

typedef std::tuple<short int, Real, short int, std::array<Real, 3>, int, unsigned int, unsigned int, short int, short int, short int> MooseAppCoordTransform::MinimalData

A typedef for conveniency that describes the minimal data necessary to broadcast and build a MooseAppCoordTransform.

The data is such: 0: whether a scaling matrix exists 1: a value describing the scaling 2: whether a rotation matrix exists 3: the Euler angles describing the rotation 4: the coordinate system type 5: the r-axis direction 6: the z-axis direction 7: whether there are multiple coordinate system types on the mesh 8: whether general axisymmetric coordinate axes are being used 9: whether the mesh has been transformed using the transform

Definition at line 62 of file MooseAppCoordTransform.h.

Member Enumeration Documentation

◆ Direction

A class scope enumeration for conveniently denoting X, Y, and Z axis directions.

Enumerator
INVALID 

Definition at line 30 of file MooseAppCoordTransform.h.

Constructor & Destructor Documentation

◆ MooseAppCoordTransform() [1/5]

MooseAppCoordTransform::MooseAppCoordTransform ( )

Default constructor.

If no other methods are called to set rotation, translation, or scaling, then when operator() is called the result will be the passed-in point, e.g. no transformation will occur

Definition at line 303 of file MooseAppCoordTransform.C.

309 _length_unit(std::string("1*m")),
311 _mesh_transformed(false)
312{
313}
MooseUnits _length_unit
How much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5 inches.
std::array< Real, 3 > _euler_angles
The Euler angles describing rotation.
bool _has_different_coord_sys
Whether we have different coordinate systems within our single domain.
Moose::CoordinateSystemType _coord_type
Our coordinate system.
Direction _r_axis
If we are RZ or RSPHERICAL, the Cartesian axis corresponding to the radial coordinate.
bool _using_general_rz_coord_axes
Whether general axisymmetric coordinate axes are being used.
Direction _z_axis
If we are RZ, the Cartesian axis corresponding to the axial/axis-of-symmetry coordinate.
bool _mesh_transformed
Whether the mesh has been translated and rotated.
@ COORD_XYZ
Definition MooseTypes.h:865

◆ MooseAppCoordTransform() [2/5]

MooseAppCoordTransform::MooseAppCoordTransform ( const MooseAppCoordTransform other)

Definition at line 315 of file MooseAppCoordTransform.C.

316 : _coord_type(other._coord_type),
317 _r_axis(other._r_axis),
318 _z_axis(other._z_axis),
324{
325 if (other._scale)
326 _scale = std::make_unique<RealTensorValue>(*other._scale);
327 if (other._rotate)
328 _rotate = std::make_unique<RealTensorValue>(*other._rotate);
329 computeRS();
330}
std::unique_ptr< libMesh::RealTensorValue > _rotate
Represents a forward rotation transformation from our domain to the reference frame domain.
std::unique_ptr< libMesh::RealTensorValue > _scale
Represents a forward scaling transformation from our units to reference frame units of meters.
void computeRS()
Compute the RS and (RS)^{-1} matrices.

◆ MooseAppCoordTransform() [3/5]

MooseAppCoordTransform::MooseAppCoordTransform ( MooseAppCoordTransform &&  other)
default

◆ MooseAppCoordTransform() [4/5]

MooseAppCoordTransform::MooseAppCoordTransform ( const MinimalData minimal_data)

Construct a coordinate transformation object from the minimal set of data required.

Definition at line 332 of file MooseAppCoordTransform.C.

333 : _coord_type(static_cast<Moose::CoordinateSystemType>(std::get<4>(minimal_data))),
334 _r_axis(static_cast<Direction>(std::get<5>(minimal_data))),
335 _z_axis(static_cast<Direction>(std::get<6>(minimal_data))),
336 _has_different_coord_sys(std::get<7>(minimal_data)),
337 _using_general_rz_coord_axes(std::get<8>(minimal_data)),
338 _length_unit(std::string("1*m")),
339 _euler_angles(std::get<3>(minimal_data)),
340 _mesh_transformed(std::get<9>(minimal_data))
341{
342 if (std::get<0>(minimal_data))
343 setLengthUnit(MooseUnits(std::to_string(std::get<1>(minimal_data)) + "*m"));
344 if (std::get<2>(minimal_data))
345 _rotate = std::make_unique<RealTensorValue>(RealTensorValue::extrinsic_rotation_matrix(
347 computeRS();
348}
Direction
A class scope enumeration for conveniently denoting X, Y, and Z axis directions.
void setLengthUnit(const MooseUnits &length_unit)
Set the scaling transformation.
Physical unit management class with runtime unit string parsing, unit checking, unit conversion,...
Definition Units.h:33
CoordinateSystemType
Definition MooseTypes.h:864

◆ MooseAppCoordTransform() [5/5]

MooseAppCoordTransform::MooseAppCoordTransform ( const MooseMesh mesh)

Construct this object from the provided mesh and its input parameters.

See the validParams implementation for valid parameters

Definition at line 257 of file MooseAppCoordTransform.C.

263 _length_unit(std::string("1*m")),
265 _mesh_transformed(false)
266{
267 //
268 // Coordinate system transformation
269 //
271
272 const auto & params = mesh.parameters();
273
274 //
275 // Rotation
276 //
277 const bool has_alpha = params.isParamValid("alpha_rotation");
278 const bool has_beta = params.isParamValid("beta_rotation");
279 const bool has_gamma = params.isParamValid("gamma_rotation");
280 const auto & up_direction = params.get<MooseEnum>("up_direction");
281
282 if (has_alpha || has_beta || has_gamma)
283 {
284 if (up_direction.isValid())
285 mooseError("Cannot simultaneously set rotation angles as well as an up direction");
286
287 const auto alpha = (has_alpha ? params.get<Real>("alpha_rotation") : Real(0));
288 const auto beta = (has_beta ? params.get<Real>("beta_rotation") : Real(0));
289 const auto gamma = (has_gamma ? params.get<Real>("gamma_rotation") : Real(0));
290
291 setRotation(alpha, beta, gamma);
292 }
293 else if (up_direction.isValid())
294 setUpDirection(Direction(static_cast<unsigned int>(int(up_direction))));
295
296 //
297 // Scaling
298 //
299 if (params.isParamValid("length_unit"))
300 setLengthUnit(MooseUnits(params.get<std::string>("length_unit")));
301}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
void setCoordinateSystem(Moose::CoordinateSystemType system_type, Direction rz_symmetry_axis=INVALID)
Set our coordinate system.
void setUpDirection(Direction up_direction)
Will setup a rotation transformation.
void setRotation(Real alpha, Real beta, Real gamma)
Setup an \emph extrinsic rotation defined in the following way:
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MeshBase & mesh
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ ~MooseAppCoordTransform()

MooseAppCoordTransform::~MooseAppCoordTransform ( )
default

Member Function Documentation

◆ computeRS()

void MooseAppCoordTransform::computeRS ( )

Compute the RS and (RS)^{-1} matrices.

Definition at line 393 of file MooseAppCoordTransform.C.

394{
395 if (_scale || _rotate)
396 {
397 _rs = std::make_unique<RealTensorValue>(RealTensorValue(1, 0, 0, 0, 1, 0, 0, 0, 1));
398
399 if (_scale)
400 *_rs = *_scale * *_rs;
401 if (_rotate)
402 *_rs = *_rotate * *_rs;
403
404 _rs_inverse = std::make_unique<RealTensorValue>(_rs->inverse());
405 }
406 else
407 {
408 _rs.reset();
409 _rs_inverse.reset();
410 }
411}
std::unique_ptr< libMesh::RealTensorValue > _rs_inverse
Represents the inverse of the product of rotation and scaling transformations.
std::unique_ptr< libMesh::RealTensorValue > _rs
Represents the product of rotation and scaling transformations.
TensorValue< Real > RealTensorValue

Referenced by MooseAppCoordTransform(), MooseAppCoordTransform(), operator=(), setLengthUnit(), setRotation(), and setUpDirection().

◆ coordinateSystem()

Moose::CoordinateSystemType MooseAppCoordTransform::coordinateSystem ( ) const
inline
Returns
our coordinate system

Definition at line 107 of file MooseAppCoordTransform.h.

107{ return _coord_type; }

◆ hasScalingOrRotationTransformation()

bool MooseAppCoordTransform::hasScalingOrRotationTransformation ( ) const

Returns true if the app has scaling and/or rotation transformation.

Definition at line 441 of file MooseAppCoordTransform.C.

442{
443 if (_rs)
444 for (const auto i : make_range(Moose::dim))
445 for (const auto j : make_range(Moose::dim))
446 {
447 const auto matrix_elem = (*_rs)(i, j);
448 if (i == j)
449 {
450 if (!MooseUtils::absoluteFuzzyEqual(matrix_elem, 1))
451 return true;
452 }
453 else if (!MooseUtils::absoluteFuzzyEqual(matrix_elem, 0))
454 return true;
455 }
456
457 return false;
458}
for(PetscInt i=0;i< nvars;++i)
unsigned int dim
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
IntRange< T > make_range(T beg, T end)

Referenced by FEProblemBase::checkProblemIntegrity(), MultiAppCoordTransform::hasNonTranslationTransformation(), MultiAppCoordTransform::setDestinationCoordTransform(), and transformMesh().

◆ lengthUnit()

const MooseUnits & MooseAppCoordTransform::lengthUnit ( ) const
inline
Returns
How much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5 inches

Definition at line 158 of file MooseAppCoordTransform.h.

158{ return _length_unit; }

◆ minimalDataDescription()

MooseAppCoordTransform::MinimalData MooseAppCoordTransform::minimalDataDescription ( ) const
Returns
the minimal data necessary to describe this coordinate transformation object. This data can be broadcast and used to construct identical coordinate transformation objects on other processes

Definition at line 351 of file MooseAppCoordTransform.C.

352{
353 const Real scale_factor = _scale ? (*_scale)(0, 0) : 1;
354 return {static_cast<short int>(bool(_scale)),
355 scale_factor,
356 static_cast<short int>(bool(_rotate)),
358 static_cast<int>(_coord_type),
359 static_cast<unsigned int>(_r_axis),
360 static_cast<unsigned int>(_z_axis),
361 static_cast<short int>(_has_different_coord_sys),
362 static_cast<short int>(_using_general_rz_coord_axes),
363 static_cast<short int>(_mesh_transformed)};
364}

◆ operator=() [1/2]

MooseAppCoordTransform & MooseAppCoordTransform::operator= ( const MooseAppCoordTransform other)

Definition at line 367 of file MooseAppCoordTransform.C.

368{
369 _coord_type = other._coord_type;
370 _r_axis = other._r_axis;
371 _z_axis = other._z_axis;
377
378 if (other._scale)
379 _scale = std::make_unique<RealTensorValue>(*other._scale);
380 else
381 _scale.reset();
382 if (other._rotate)
383 _rotate = std::make_unique<RealTensorValue>(*other._rotate);
384 else
385 _rotate.reset();
386
387 computeRS();
388
389 return *this;
390}

◆ operator=() [2/2]

MooseAppCoordTransform & MooseAppCoordTransform::operator= ( MooseAppCoordTransform &&  other)
default

◆ processZAxis()

MooseAppCoordTransform::Direction MooseAppCoordTransform::processZAxis ( Direction  z_axis)
private

If the coordinate system type is RZ, then we return the provided argument.

Otherwise we return INVALID

Definition at line 18 of file MooseAppCoordTransform.C.

19{
20 return _coord_type == Moose::COORD_RZ ? z_axis : INVALID;
21}
@ COORD_RZ
Definition MooseTypes.h:866

Referenced by setUpDirection().

◆ setCoordinateSystem() [1/2]

void MooseAppCoordTransform::setCoordinateSystem ( const MooseMesh mesh)

Set our coordinate system based on the MooseMesh coordinate system data.

Definition at line 160 of file MooseAppCoordTransform.C.

161{
162 const auto & params = mesh.parameters();
163
164 // If we have multiple different coordinate system types in our problem, we
165 // take note of it because that can cause issues if there is a non-Cartesian
166 // destination coordinate system
167 const auto & coord_sys = mesh.getCoordSystem();
168 std::unordered_set<Moose::CoordinateSystemType> coord_types;
169 auto map_it = coord_sys.begin();
170 // It's possible that the mesh is not in a complete state
171 if (map_it == coord_sys.end())
173 else
175 map_it->second,
176 Direction(static_cast<unsigned int>(int(params.get<MooseEnum>("rz_coord_axis")))));
177 for (; map_it != coord_sys.end(); ++map_it)
178 coord_types.insert(map_it->second);
179
180 _has_different_coord_sys = coord_types.size() > 1;
181
182 if (mesh.usingGeneralAxisymmetricCoordAxes())
184}

◆ setCoordinateSystem() [2/2]

void MooseAppCoordTransform::setCoordinateSystem ( Moose::CoordinateSystemType  system_type,
Direction  rz_symmetry_axis = INVALID 
)

Set our coordinate system.

Parameters
system_typethe coordinate system type
rz_symmetry_axisthe axial coordinate, e.g. the axis of symmetry

Definition at line 141 of file MooseAppCoordTransform.C.

143{
144 _coord_type = coord_type;
145
147 {
148 if (rz_symmetry_axis == INVALID)
149 mooseError("For RZ coordinate systems, the 'rz_symmetry_axis' parameter must be provided to "
150 "'MooseAppCoordTransform::setCoordinateSystem'");
151
152 _z_axis = rz_symmetry_axis;
153 _r_axis = _z_axis == X ? Y : X;
154 }
156 _r_axis = X;
157}
@ COORD_RSPHERICAL
Definition MooseTypes.h:867

Referenced by MooseAppCoordTransform(), and setCoordinateSystem().

◆ setLengthUnit()

void MooseAppCoordTransform::setLengthUnit ( const MooseUnits length_unit)

Set the scaling transformation.

Parameters
length_unitHow much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5 inches. We will save off the value provided to this in the _length_unit data member as well as set the scaling transform

Definition at line 131 of file MooseAppCoordTransform.C.

132{
133 _length_unit = length_unit;
134 const auto scale = Real(_length_unit / MooseUnits("m"));
135 _scale =
136 std::make_unique<RealTensorValue>(RealTensorValue(scale, 0, 0, 0, scale, 0, 0, 0, scale));
137 computeRS();
138}
Real scale
Definition MortarUtils.C:62

Referenced by MooseAppCoordTransform(), and MooseAppCoordTransform().

◆ setRotation()

void MooseAppCoordTransform::setRotation ( Real  alpha,
Real  beta,
Real  gamma 
)

Setup an \emph extrinsic rotation defined in the following way:

  1. rotate by alpha degrees about the z-axis
  2. rotate by beta degrees about the x-axis
  3. rotate by gamma degrees about the z-axis Definitions of the resulting matrix are found in the last row of the Proper Euler angles column of https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix. These rotation angles should describe how points in our domain should be rotated in order to arrive back in the reference frame. For instance, in 2D your mesh may appear 90 degrees rotated (around the z-axis) with respect to the reference frame. In such a case, the angle set you should provide to this function is {-90, 0, 0}, e.g. provide forward transformation angles that will map points from your domain to the reference domain

If our coordinate system is RZ, then only certain values of alpha, beta, and gamma will be accepted such that the radial and axial coordinates are rotated onto Cartesian axes and the resulting radial coordinate is non-negative

Definition at line 89 of file MooseAppCoordTransform.C.

90{
91 const bool must_rotate_axes =
93 bool axes_rotated = false;
94 if (must_rotate_axes)
95 {
96 const auto angles = std::make_tuple(alpha, beta, gamma);
97 if (angles == std::make_tuple(0, 90, 0))
98 {
99 if (_r_axis == X)
100 {
101 mooseAssert((_coord_type == Moose::COORD_RZ && _z_axis == Y) ||
103 "'_z_axis' is not an expected value");
104 _r_axis = X;
106 }
107 else if (_r_axis == Y)
108 {
109 mooseAssert((_coord_type == Moose::COORD_RZ && _z_axis == X) ||
111 "'_z_axis' is not an expected value");
112 _r_axis = Z;
114 }
115 axes_rotated = true;
116 }
117 }
118
119 _euler_angles = {{alpha, beta, gamma}};
120 _rotate = std::make_unique<RealTensorValue>(
121 RealTensorValue::extrinsic_rotation_matrix(alpha, beta, gamma));
122 computeRS();
123
124 if (must_rotate_axes && !axes_rotated)
125 mooseError("Unsupported manual angle prescription in 'MooseAppCoordTransform::setRotation'. "
126 "For non-Cartesian coordinate systems, the only currently supported rotation is "
127 "(alpha, beta, gamma) = (0, 90, 0)");
128}

Referenced by MooseAppCoordTransform().

◆ setTranslationVector()

void MooseAppCoordTransform::setTranslationVector ( const libMesh::Point translation)

Set how much our domain should be translated in order to match a reference frame.

In practice we choose the parent application to be the reference frame with respect to translation, e.g. the parent application origin is the reference frame origin, and we set the translation vectors of child applications to the multiapp positions parameter. Similarly to the setRotation with angles API, this represents a forward transformation from our domain to the reference domain

◆ setUpDirection()

void MooseAppCoordTransform::setUpDirection ( Direction  up_direction)

Will setup a rotation transformation.

The rotation transformation will be a single 90-degree rotation defined such that a point on the axis specified by up_direction is rotated onto the Y-axis, which is our canonical/reference-frame up-direction

Parameters
up_directionWhat direction corresponds to "up" (e.g. the opposite direction of gravity) in our moose mesh

Definition at line 24 of file MooseAppCoordTransform.C.

25{
26 Real alpha = 0, beta = 0, gamma = 0;
27
28 const bool must_rotate_axes =
30 // Don't error immediately for unit testing purposes
31 bool negative_radii = false;
32
33 if (up_direction == X)
34 {
35 alpha = 90, beta = 0, gamma = 0;
36 if (must_rotate_axes)
37 {
38 if (_r_axis == X)
39 {
40 _r_axis = Y;
42 }
43 else if (_r_axis == Y)
44 {
45 negative_radii = true;
46 _r_axis = X;
48 }
49 else
50 mooseError("Bad r-axis value");
51 }
52 }
53 else if (up_direction == Y)
54 alpha = 0, beta = 0, gamma = 0;
55 else if (up_direction == Z)
56 {
57 alpha = 0, beta = -90, gamma = 0;
58 if (must_rotate_axes)
59 {
60 if (_r_axis == X)
61 {
62 _r_axis = X;
64 }
65 else if (_r_axis == Y)
66 {
67 negative_radii = true;
68 _r_axis = Z;
70 }
71 else
72 mooseError("Bad r-axis value");
73 }
74 }
75 else
76 mooseError("Bad up direction value");
77
78 _euler_angles = {{alpha, beta, gamma}};
79
80 _rotate = std::make_unique<RealTensorValue>(
81 RealTensorValue::extrinsic_rotation_matrix(alpha, beta, gamma));
82 computeRS();
83
84 if (negative_radii)
85 mooseError("Rotation yields negative radial values");
86}
Direction processZAxis(Direction z_axis)
If the coordinate system type is RZ, then we return the provided argument.

Referenced by MooseAppCoordTransform().

◆ transformMesh()

void MooseAppCoordTransform::transformMesh ( MooseMesh mesh,
const libMesh::Point translation 
)

Transforms the entire mesh with the coordinate transform This can be done to output in position, or to avoid transforming on every data point.

Parameters
meshthe mesh to modify, usually the child app mesh
translationthe translation to apply to the mesh, often the app position

Definition at line 414 of file MooseAppCoordTransform.C.

415{
416 // Transforming a RZ or R-spherical mesh doesnt always make sense, disallow it
418 mooseError("Running MultiApps 'in position' is only supported for XYZ coordinate systems");
419
421 mooseError("Scaling and rotation are currently not supported for general axisymmetric "
422 "coordinate systems.");
423
425 mooseError("App mesh is being transformed twice");
426
427 // Apply all the transformation to the mesh
428 if (_scale)
429 MeshTools::Modification::scale(mesh, (*_scale)(0, 0), (*_scale)(1, 1), (*_scale)(2, 2));
430 if (_rotate)
431 MeshTools::Modification::rotate(mesh, _euler_angles[0], _euler_angles[1], _euler_angles[2]);
432 if (translation != Point(0, 0, 0))
433 MeshTools::Modification::translate(mesh, translation(0), translation(1), translation(2));
434
435 // Translation, scaling and rotation need not be applied anymore when performing coordinate
436 // transforms
437 _mesh_transformed = true;
438}
bool hasScalingOrRotationTransformation() const
Returns true if the app has scaling and/or rotation transformation.

◆ validParams()

InputParameters MooseAppCoordTransform::validParams ( )
static

Describes the parameters this object can take to setup transformations.

These include parameters related to coordinate system type, rotation, and scaling

One entry of coord system per block, the size of _blocks and _coord_sys has to match, except:

  1. _blocks.size() == 0, then there needs to be just one entry in _coord_sys, which will be set for the whole domain
  2. _blocks.size() > 0 and no coordinate system was specified, then the whole domain will be XYZ.
  3. _blocks.size() > 0 and one coordinate system was specified, then the whole domain will be that system.

Definition at line 187 of file MooseAppCoordTransform.C.

188{
189 auto params = emptyInputParameters();
195 params.addDeprecatedParam<std::vector<SubdomainName>>(
196 "block",
197 "Block IDs for the coordinate systems.",
198 "Please use the 'coord_block' parameter instead.");
199 params.addParam<std::vector<SubdomainName>>(
200 "coord_block",
201 "Block IDs for the coordinate systems. If this parameter is specified, then it must "
202 "encompass all the subdomains on the mesh.");
203 MultiMooseEnum coord_types("XYZ RZ RSPHERICAL", "XYZ");
204 MooseEnum rz_coord_axis("X=0 Y=1", "Y");
205 params.addParam<MultiMooseEnum>(
206 "coord_type", coord_types, "Type of the coordinate system per block param");
207 params.addParam<MooseEnum>(
208 "rz_coord_axis", rz_coord_axis, "The rotation axis (X | Y) for axisymmetric coordinates");
209 params.addParam<std::vector<SubdomainName>>(
210 "rz_coord_blocks", "Blocks using general axisymmetric coordinate systems");
211 params.addParam<std::vector<Point>>("rz_coord_origins",
212 "Axis origin points for each block in 'rz_coord_blocks'");
213 params.addParam<std::vector<RealVectorValue>>(
214 "rz_coord_directions", "Axis directions for each block in 'rz_coord_blocks'");
215 params.addParam<std::string>(
216 "length_unit",
217 "How much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5inches");
218 params.addRangeCheckedParam<Real>(
219 "alpha_rotation",
220 "-180<alpha_rotation<=180",
221 "The number of degrees that the domain should be alpha-rotated using the Euler "
222 "angle ZXZ convention from https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix in "
223 "order to align with a canonical physical space of your choosing.");
224 params.addRangeCheckedParam<Real>(
225 "beta_rotation",
226 "-180<beta_rotation<=180",
227 "The number of degrees that the domain should be beta-rotated using the Euler "
228 "angle ZXZ convention from https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix in "
229 "order to align with a canonical physical space of your choosing.");
230 params.addRangeCheckedParam<Real>(
231 "gamma_rotation",
232 "-180<gamma_rotation<=180",
233 "The number of degrees that the domain should be gamma-rotated using the Euler "
234 "angle ZXZ convention from https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix in "
235 "order to align with a canonical physical space of your choosing.");
236 MooseEnum up_direction("X=0 Y=1 Z=2");
237 params.addParam<MooseEnum>(
238 "up_direction",
239 up_direction,
240 "Specify what axis corresponds to the up direction in physical space (the opposite of the "
241 "gravity vector if you will). If this parameter is provided, we will perform a single 90 "
242 "degree rotation of the domain--if the provided axis is 'x' or 'z', we will not rotate if "
243 "the axis is 'y'--such that a point which was on the provided axis will now lie on the "
244 "y-axis, e.g. the y-axis is our canonical up direction. If you want finer grained control "
245 "than this, please use the 'alpha_rotation', 'beta_rotation', and 'gamma_rotation' "
246 "parameters.");
247 params.addParamNamesToGroup(
248 "block coord_type coord_block rz_coord_axis rz_coord_blocks rz_coord_origins "
249 "rz_coord_directions",
250 "Coordinate system");
251 params.addParamNamesToGroup(
252 "length_unit alpha_rotation beta_rotation gamma_rotation up_direction",
253 "Transformations relative to parent application frame of reference");
254 return params;
255}
InputParameters emptyInputParameters()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.

Referenced by FEProblemBase::checkProblemIntegrity(), and MooseMesh::validParams().

Friends And Related Symbol Documentation

◆ MultiAppCoordTransform

friend class MultiAppCoordTransform
friend

Definition at line 238 of file MooseAppCoordTransform.h.

Member Data Documentation

◆ _coord_type

Moose::CoordinateSystemType MooseAppCoordTransform::_coord_type
private

◆ _euler_angles

std::array<Real, 3> MooseAppCoordTransform::_euler_angles
private

The Euler angles describing rotation.

Definition at line 232 of file MooseAppCoordTransform.h.

Referenced by minimalDataDescription(), MooseAppCoordTransform(), operator=(), setRotation(), setUpDirection(), and transformMesh().

◆ _has_different_coord_sys

bool MooseAppCoordTransform::_has_different_coord_sys
private

Whether we have different coordinate systems within our single domain.

If we do, this will be problematic if we need to collapse from our space into an RZ or RSPHERICAL space because we are only ever provided with a point argument and not a subdomain ID argument. Consequently we will not know in what coordinate system our point lies and will not know how to perform the dimension collapse, and so we will error

Definition at line 223 of file MooseAppCoordTransform.h.

Referenced by minimalDataDescription(), operator=(), setCoordinateSystem(), and MultiAppCoordTransform::setDestinationCoordTransform().

◆ _length_unit

MooseUnits MooseAppCoordTransform::_length_unit
private

How much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5 inches.

Definition at line 229 of file MooseAppCoordTransform.h.

Referenced by lengthUnit(), operator=(), and setLengthUnit().

◆ _mesh_transformed

bool MooseAppCoordTransform::_mesh_transformed
private

Whether the mesh has been translated and rotated.

In this case, applying the transform every time is no longer necessary

Definition at line 236 of file MooseAppCoordTransform.h.

Referenced by MultiAppCoordTransform::mapBack(), minimalDataDescription(), MultiAppCoordTransform::operator()(), operator=(), and transformMesh().

◆ _r_axis

Direction MooseAppCoordTransform::_r_axis
private

If we are RZ or RSPHERICAL, the Cartesian axis corresponding to the radial coordinate.

Definition at line 214 of file MooseAppCoordTransform.h.

Referenced by minimalDataDescription(), MultiAppCoordTransform::operator()(), operator=(), setCoordinateSystem(), setRotation(), and setUpDirection().

◆ _rotate

std::unique_ptr<libMesh::RealTensorValue> MooseAppCoordTransform::_rotate
private

Represents a forward rotation transformation from our domain to the reference frame domain.

Definition at line 203 of file MooseAppCoordTransform.h.

Referenced by computeRS(), minimalDataDescription(), MooseAppCoordTransform(), MooseAppCoordTransform(), operator=(), setRotation(), setUpDirection(), and transformMesh().

◆ _rs

std::unique_ptr<libMesh::RealTensorValue> MooseAppCoordTransform::_rs
private

Represents the product of rotation and scaling transformations.

Definition at line 206 of file MooseAppCoordTransform.h.

Referenced by computeRS(), hasScalingOrRotationTransformation(), and MultiAppCoordTransform::operator()().

◆ _rs_inverse

std::unique_ptr<libMesh::RealTensorValue> MooseAppCoordTransform::_rs_inverse
private

Represents the inverse of the product of rotation and scaling transformations.

Definition at line 209 of file MooseAppCoordTransform.h.

Referenced by computeRS(), and MultiAppCoordTransform::mapBack().

◆ _scale

std::unique_ptr<libMesh::RealTensorValue> MooseAppCoordTransform::_scale
private

Represents a forward scaling transformation from our units to reference frame units of meters.

This matrix will be diagonal

Definition at line 200 of file MooseAppCoordTransform.h.

Referenced by computeRS(), minimalDataDescription(), MooseAppCoordTransform(), operator=(), setLengthUnit(), and transformMesh().

◆ _using_general_rz_coord_axes

bool MooseAppCoordTransform::_using_general_rz_coord_axes
private

Whether general axisymmetric coordinate axes are being used.

Definition at line 226 of file MooseAppCoordTransform.h.

Referenced by minimalDataDescription(), operator=(), setCoordinateSystem(), MultiAppCoordTransform::setDestinationCoordTransform(), and transformMesh().

◆ _z_axis

Direction MooseAppCoordTransform::_z_axis
private

If we are RZ, the Cartesian axis corresponding to the axial/axis-of-symmetry coordinate.

Definition at line 216 of file MooseAppCoordTransform.h.

Referenced by minimalDataDescription(), MultiAppCoordTransform::operator()(), operator=(), setCoordinateSystem(), setRotation(), and setUpDirection().


The documentation for this class was generated from the following files: