https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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.
 
libMesh::Point mapBack (const libMesh::Point &point) const
 Inverse transform from the reference space to our space.
 
void setTranslationVector (const libMesh::Point &translation)
 Set how much our domain should be translated in order to match a reference frame.
 
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.
 
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
 
bool skipCoordinateCollapsing () const
 whether coordinate collapsing operations should be skipped
 
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.
 
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.
 
libMesh::Point _translation
 Describes a forward translation transformation from our domain to the reference frame domain.
 
bool _skip_coordinate_collapsing
 whether coordinate collapsing operations should be skipped
 

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 460 of file MooseAppCoordTransform.C.

461 : _our_app_transform(our_app_transform),
464{
465}
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation,...
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
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.

◆ 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 622 of file MooseAppCoordTransform.C.

Referenced by hasNonTranslationTransformation(), and MultiAppTransfer::mapBackWithoutCollapsing().

◆ 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 607 of file MooseAppCoordTransform.C.

608{
610 return true;
611
613 return false;
614
616 return true;
617
618 return false;
619}
bool hasScalingOrRotationTransformation() const
Returns true if the app has scaling and/or rotation transformation.

Referenced by isIdentity().

◆ 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 638 of file MooseAppCoordTransform.C.

639{
641 return false;
642
643 for (const auto i : make_range(Moose::dim))
644 if (!MooseUtils::absoluteFuzzyEqual(_translation(i), 0))
645 return false;
646
647 return true;
648}
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
unsigned int dim
libMesh::Point _translation
Describes a forward translation transformation from our domain to the reference frame domain.
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)

◆ 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 536 of file MooseAppCoordTransform.C.

537{
538 Point ret(point);
539
540 // Translation, rotation and scaling already applied, coordinate system conversion not supported
542 return ret;
543
544 // inverse translate
545 ret -= _translation;
546
547 // inverse rotate and then inverse scale
549 ret = (*_our_app_transform._rs_inverse) * ret;
550
552 return ret;
553
554 // Finally, coordinate system conversions
560 mooseError("Coordinate collapsing occurred in going to the reference space. There is no unique "
561 "return mapping");
562
563 return ret;
564}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::unique_ptr< libMesh::RealTensorValue > _rs_inverse
Represents the inverse of the product of rotation and scaling transformations.
bool _mesh_transformed
Whether the mesh has been translated and rotated.

Referenced by MultiAppTransfer::mapBackWithoutCollapsing(), and MFEMMultiAppTransfer::mapPointToActiveSourceFrame().

◆ 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 468 of file MooseAppCoordTransform.C.

469{
470 mooseAssert(_destination_app_transform, "The destination application transform must be set");
471
472 Point ret(point);
473
474 // Translation, rotation and scaling already applied, coordinate system conversion not supported
476 return ret;
477
478 // Apply scaling and then rotation
480 ret = (*_our_app_transform._rs) * ret;
481
482 // If this shows up in profiling we can make _translation a pointer
483 ret += _translation;
484
486 return ret;
487
488 // Finally, coordinate system conversions
491 {
492 Real r_squared = 0;
493 for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
495 r_squared += ret(i) * ret(i);
496
497 const auto r = std::sqrt(r_squared);
498 const auto z = ret(_destination_app_transform->_z_axis);
499 ret = 0;
502 }
505 {
506 Real r_squared = 0;
507 for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
508 r_squared += ret(i) * ret(i);
509
510 const auto r = std::sqrt(r_squared);
511 ret = 0;
513 }
516 {
517 Real r_squared = 0;
518 for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
519 {
520 mooseAssert(
522 MooseUtils::absoluteFuzzyEqual(ret(i), 0),
523 "Our point should be 0 if we are evaluating at an index that is neither our r or z-axis");
524 r_squared += ret(i) * ret(i);
525 }
526
527 const auto r = std::sqrt(r_squared);
528 ret = 0;
530 }
531
532 return ret;
533}
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.
Direction _z_axis
If we are RZ, the Cartesian axis corresponding to the axial/axis-of-symmetry coordinate.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ 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; }

◆ 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 567 of file MooseAppCoordTransform.C.

569{
570 _destination_app_transform = &destination_app_transform;
571
574 mooseError("Scaling and rotation are currently not supported for general axisymmetric "
575 "coordinate systems.");
576
577 // Don't error check mismatching coordinate system types if we've been asked to skip coordinate
578 // collapsing since in that case the mismatch doesn't matter
580 return;
581
586 "The destination coordinate system has different coordinate systems and we have coordinate "
587 "system(s) that could require coordinate collapsing when transforming from our coordinate "
588 "system to the destination coordinate system. Because our transform method only takes a "
589 "point argument, and not subdomain arguments, the transform is ambiguous");
590
594 mooseError("When the destination coordinate system is RZ or RSPHERICAL, we have to perform "
595 "coordinate collapsing based on *our* coordinate system. However, we have multiple "
596 "coordinate systems, and since when evaluating transformations, we are only "
597 "called with a Point argument, we do not know what subdomain we are on and "
598 "consequently we do not know what coordinate collapse to apply.");
599
602 mooseError("If either this app or the destination app uses general axisymmetric axes, "
603 "coordinate collapsing must be skipped.");
604}
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.

◆ 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 657 of file MooseAppCoordTransform.C.

658{
659 _translation = translation;
660}

◆ skipCoordinateCollapsing() [1/2]

bool MultiAppCoordTransform::skipCoordinateCollapsing ( ) const
inline

whether coordinate collapsing operations should be skipped

Definition at line 326 of file MooseAppCoordTransform.h.

◆ skipCoordinateCollapsing() [2/2]

void MultiAppCoordTransform::skipCoordinateCollapsing ( bool  skip_coordinate_collapsing)

set whether coordinate collapsing operations should be skipped

Definition at line 651 of file MooseAppCoordTransform.C.

652{
653 _skip_coordinate_collapsing = skip_coordinate_collapsing;
654}

Referenced by MultiApp::getBoundingBox(), and MultiAppTransfer::mapBackWithoutCollapsing().

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

◆ _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: