https://mooseframework.inl.gov
Public Member Functions | Private Attributes | List of all members
MultiAppCoordTransform Class Reference

This class contains transformation information that only exists in a context in which there are multiple applications. More...

#include <MooseAppCoordTransform.h>

Public Member Functions

 MultiAppCoordTransform (const MooseAppCoordTransform &our_app_transform)
 
libMesh::Point operator() (const libMesh::Point &point) const
 Transforms a point from our domain into the reference domain. More...
 
libMesh::Point mapBack (const libMesh::Point &point) const
 Inverse transform from the reference space to our space. More...
 
void setTranslationVector (const libMesh::Point &translation)
 Set how much our domain should be translated in order to match a reference frame. More...
 
void setDestinationCoordTransform (const MooseAppCoordTransform &destination_coord_transform)
 Set the destination coordinate system and destination radial and symmetry axes as appropriate for RZ or RSPHERICAL simulations. More...
 
bool isIdentity () const
 
bool hasNonTranslationTransformation () const
 
bool hasCoordinateSystemTypeChange () const
 
Moose::CoordinateSystemType coordinateSystem () const
 
void skipCoordinateCollapsing (bool skip_coordinate_collapsing)
 set whether coordinate collapsing operations should be skipped More...
 
bool skipCoordinateCollapsing () const
 whether coordinate collapsing operations should be skipped More...
 
const MooseAppCoordTransformourAppTransform () const
 

Private Attributes

const MooseAppCoordTransform_our_app_transform
 A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g. More...
 
const MooseAppCoordTransform_destination_app_transform
 A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from the destination domain to the reference domain, e.g. More...
 
libMesh::Point _translation
 Describes a forward translation transformation from our domain to the reference frame domain. More...
 
bool _skip_coordinate_collapsing
 whether coordinate collapsing operations should be skipped More...
 

Detailed Description

This class contains transformation information that only exists in a context in which there are multiple applications.

Such information includes translation and coordinate collapsing

Definition at line 245 of file MooseAppCoordTransform.h.

Constructor & Destructor Documentation

◆ MultiAppCoordTransform()

MultiAppCoordTransform::MultiAppCoordTransform ( const MooseAppCoordTransform our_app_transform)
explicit

Definition at line 462 of file MooseAppCoordTransform.C.

463  : _our_app_transform(our_app_transform),
466 {
467 }
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

Member Function Documentation

◆ coordinateSystem()

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

Definition at line 316 of file MooseAppCoordTransform.h.

Moose::CoordinateSystemType _coord_type
Our coordinate system.
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.

◆ hasCoordinateSystemTypeChange()

bool MultiAppCoordTransform::hasCoordinateSystemTypeChange ( ) const
Returns
whether there are any coordinate system type change because the mapping back from RZ to XYZ for example is non-unique and would error

Definition at line 624 of file MooseAppCoordTransform.C.

Referenced by hasNonTranslationTransformation().

625 {
627  return false;
628 
634  return true;
635 
636  return false;
637 }
Moose::CoordinateSystemType _coord_type
Our coordinate system.
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

◆ hasNonTranslationTransformation()

bool MultiAppCoordTransform::hasNonTranslationTransformation ( ) const
Returns
whether there are any transformations other than translation in the transform. We have this method because translation has always been supported natively by the multiapp transfer system through the 'positions' parameter

Definition at line 609 of file MooseAppCoordTransform.C.

Referenced by isIdentity().

610 {
612  return true;
613 
615  return false;
616 
618  return true;
619 
620  return false;
621 }
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
bool hasCoordinateSystemTypeChange() const
bool hasScalingOrRotationTransformation() const
Returns true if the app has scaling and/or rotation transformation.
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

◆ isIdentity()

bool MultiAppCoordTransform::isIdentity ( ) const
Returns
whether the coordinate transformation object modifies an incoming point, e.g. whether the transformation is anything other than the identity matrix

Definition at line 640 of file MooseAppCoordTransform.C.

641 {
643  return false;
644 
645  for (const auto i : make_range(Moose::dim))
647  return false;
648 
649  return true;
650 }
libMesh::Point _translation
Describes a forward translation transformation from our domain to the reference frame domain...
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
Definition: MooseUtils.h:371
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
IntRange< T > make_range(T beg, T end)
bool hasNonTranslationTransformation() const

◆ mapBack()

Point MultiAppCoordTransform::mapBack ( const libMesh::Point point) const

Inverse transform from the reference space to our space.

This will error if coordinate collapsing would occur in operator(). When doing inversion we invert the order of operations, e.g. we will perform

  1. invert translation
  2. invert rotation
  3. invert scaling

Definition at line 538 of file MooseAppCoordTransform.C.

539 {
540  Point ret(point);
541 
542  // Translation, rotation and scaling already applied, coordinate system conversion not supported
544  return ret;
545 
546  // inverse translate
547  ret -= _translation;
548 
549  // inverse rotate and then inverse scale
551  ret = (*_our_app_transform._rs_inverse) * ret;
552 
554  return ret;
555 
556  // Finally, coordinate system conversions
562  mooseError("Coordinate collapsing occurred in going to the reference space. There is no unique "
563  "return mapping");
564 
565  return ret;
566 }
libMesh::Point _translation
Describes a forward translation transformation from our domain to the reference frame domain...
bool _mesh_transformed
Whether the mesh has been translated and rotated.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
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.
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

◆ operator()()

Point MultiAppCoordTransform::operator() ( const libMesh::Point point) const

Transforms a point from our domain into the reference domain.

The sequence of transformations applied is:

  1. Scaling
  2. Rotation
  3. Translation
  4. Potential collapse of XYZ coordinates into RZ or RSPHERICAL coordinates depending on the destination coordinate system (if there is no destination coordinate system or the destination coordinate system is XYZ, then nothing happens in this stage)
    Parameters
    pointA point in our domain
    Returns
    The corresponding position in the reference domain

Definition at line 470 of file MooseAppCoordTransform.C.

471 {
472  mooseAssert(_destination_app_transform, "The destination application transform must be set");
473 
474  Point ret(point);
475 
476  // Translation, rotation and scaling already applied, coordinate system conversion not supported
478  return ret;
479 
480  // Apply scaling and then rotation
482  ret = (*_our_app_transform._rs) * ret;
483 
484  // If this shows up in profiling we can make _translation a pointer
485  ret += _translation;
486 
488  return ret;
489 
490  // Finally, coordinate system conversions
493  {
494  Real r_squared = 0;
495  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
497  r_squared += ret(i) * ret(i);
498 
499  const auto r = std::sqrt(r_squared);
500  const auto z = ret(_destination_app_transform->_z_axis);
501  ret = 0;
504  }
507  {
508  Real r_squared = 0;
509  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
510  r_squared += ret(i) * ret(i);
511 
512  const auto r = std::sqrt(r_squared);
513  ret = 0;
515  }
518  {
519  Real r_squared = 0;
520  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
521  {
522  mooseAssert(
525  "Our point should be 0 if we are evaluating at an index that is neither our r or z-axis");
526  r_squared += ret(i) * ret(i);
527  }
528 
529  const auto r = std::sqrt(r_squared);
530  ret = 0;
532  }
533 
534  return ret;
535 }
libMesh::Point _translation
Describes a forward translation transformation from our domain to the reference frame domain...
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
Definition: MooseUtils.h:371
bool _mesh_transformed
Whether the mesh has been translated and rotated.
Direction _z_axis
If we are RZ, the Cartesian axis corresponding to the axial/axis-of-symmetry coordinate.
Moose::CoordinateSystemType _coord_type
Our coordinate system.
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
Direction _r_axis
If we are RZ or RSPHERICAL, the Cartesian axis corresponding to the radial coordinate.
std::unique_ptr< libMesh::RealTensorValue > _rs
Represents the product of rotation and scaling transformations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

◆ ourAppTransform()

const MooseAppCoordTransform& MultiAppCoordTransform::ourAppTransform ( ) const
inline
Returns
our moose-app coordinate transformation object

Definition at line 331 of file MooseAppCoordTransform.h.

331 { return _our_app_transform; }
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.

◆ setDestinationCoordTransform()

void MultiAppCoordTransform::setDestinationCoordTransform ( const MooseAppCoordTransform destination_coord_transform)

Set the destination coordinate system and destination radial and symmetry axes as appropriate for RZ or RSPHERICAL simulations.

Depending on the coordinate system type of the provided coordinate transform we may perform additional transformations. For instance if the destination coordinate system is RZ and we are XYZ, we will translate our xyz points into RZ points, e.g. we will collapse from three dimensions into two. The transformation would be non-unique if we were to attempt to go from RZ to XYZ, e.g. a single RZ point could correspond to any point in a 2pi rotation around the symmetry axis

Definition at line 569 of file MooseAppCoordTransform.C.

571 {
572  _destination_app_transform = &destination_app_transform;
573 
576  mooseError("Scaling and rotation are currently not supported for general axisymmetric "
577  "coordinate systems.");
578 
579  // Don't error check mismatching coordinate system types if we've been asked to skip coordinate
580  // collapsing since in that case the mismatch doesn't matter
582  return;
583 
587  mooseError(
588  "The destination coordinate system has different coordinate systems and we have coordinate "
589  "system(s) that could require coordinate collapsing when transforming from our coordinate "
590  "system to the destination coordinate system. Because our transform method only takes a "
591  "point argument, and not subdomain arguments, the transform is ambiguous");
592 
596  mooseError("When the destination coordinate system is RZ or RSPHERICAL, we have to perform "
597  "coordinate collapsing based on *our* coordinate system. However, we have multiple "
598  "coordinate systems, and since when evaluating transformations, we are only "
599  "called with a Point argument, we do not know what subdomain we are on and "
600  "consequently we do not know what coordinate collapse to apply.");
601 
604  mooseError("If either this app or the destination app uses general axisymmetric axes, "
605  "coordinate collapsing must be skipped.");
606 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Moose::CoordinateSystemType _coord_type
Our coordinate system.
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
bool _has_different_coord_sys
Whether we have different coordinate systems within our single domain.
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
bool hasScalingOrRotationTransformation() const
Returns true if the app has scaling and/or rotation transformation.
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped
bool _using_general_rz_coord_axes
Whether general axisymmetric coordinate axes are being used.

◆ setTranslationVector()

void MultiAppCoordTransform::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

Definition at line 659 of file MooseAppCoordTransform.C.

660 {
661  _translation = translation;
662 }
libMesh::Point _translation
Describes a forward translation transformation from our domain to the reference frame domain...

◆ skipCoordinateCollapsing() [1/2]

void MultiAppCoordTransform::skipCoordinateCollapsing ( bool  skip_coordinate_collapsing)

set whether coordinate collapsing operations should be skipped

Definition at line 653 of file MooseAppCoordTransform.C.

Referenced by MultiApp::getBoundingBox().

654 {
655  _skip_coordinate_collapsing = skip_coordinate_collapsing;
656 }
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

◆ skipCoordinateCollapsing() [2/2]

bool MultiAppCoordTransform::skipCoordinateCollapsing ( ) const
inline

whether coordinate collapsing operations should be skipped

Definition at line 326 of file MooseAppCoordTransform.h.

326 { return _skip_coordinate_collapsing; }
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped

Member Data Documentation

◆ _destination_app_transform

const MooseAppCoordTransform* MultiAppCoordTransform::_destination_app_transform
private

A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from the destination domain to the reference domain, e.g.

transformations that occur irrespective of the existence of other applications This attribute is currently mostly providing only the coordinate system for conversions and sanity checking. The actual transformation of destination app points in transfers is done by the MultiAppCoordTransform for the other direction

Definition at line 345 of file MooseAppCoordTransform.h.

Referenced by hasCoordinateSystemTypeChange(), mapBack(), operator()(), and setDestinationCoordTransform().

◆ _our_app_transform

const MooseAppCoordTransform& MultiAppCoordTransform::_our_app_transform
private

A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.

transformations that occur irrespective of the existence of other applications

Definition at line 337 of file MooseAppCoordTransform.h.

Referenced by coordinateSystem(), hasCoordinateSystemTypeChange(), hasNonTranslationTransformation(), mapBack(), operator()(), ourAppTransform(), and setDestinationCoordTransform().

◆ _skip_coordinate_collapsing

bool MultiAppCoordTransform::_skip_coordinate_collapsing
private

whether coordinate collapsing operations should be skipped

Definition at line 351 of file MooseAppCoordTransform.h.

Referenced by hasCoordinateSystemTypeChange(), hasNonTranslationTransformation(), mapBack(), operator()(), setDestinationCoordTransform(), and skipCoordinateCollapsing().

◆ _translation

libMesh::Point MultiAppCoordTransform::_translation
private

Describes a forward translation transformation from our domain to the reference frame domain.

Definition at line 348 of file MooseAppCoordTransform.h.

Referenced by isIdentity(), mapBack(), operator()(), and setTranslationVector().


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