Cardinal
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
NekMeshGenerator Class Reference

#include <NekMeshGenerator.h>

Inheritance diagram for NekMeshGenerator:
[legend]

Public Member Functions

 NekMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
void initializeElemData (std::unique_ptr< MeshBase > &mesh)
 
void checkElementType (std::unique_ptr< MeshBase > &mesh)
 
virtual std::pair< unsigned int, unsigned int > pairedNodesAboutMidPoint (const unsigned int &node_id) const
 
unsigned int getFaceNode (const unsigned int &primary_face) const
 
virtual bool isCornerNode (const unsigned int &node) const
 
void moveNodes (std::unique_ptr< MeshBase > &mesh, std::vector< Real > &polygon_layer_smoothing)
 
const Elem * getNextLayerElem (const Elem &elem, const unsigned int &touching_face, unsigned int &next_touching_face) const
 
unsigned int midPointNodeIndex (const unsigned int &face_id, const unsigned int &face_node) const
 
unsigned int pairedFaceNode (const unsigned int &node_id, const unsigned int &face_id) const
 
std::vector< Elem * > getBoundaryLayerElems (Elem *elem, const unsigned int &n_layers, const unsigned int &primary_face) const
 
void moveElem (Elem *elem, const unsigned int &boundary_index, const unsigned int &primary_face, const std::vector< Real > &polygon_layer_smoothing)
 
bool isNearCorner (const Point &pt) const
 
unsigned int getNodeIndex (const Elem *elem, const Point &pt) const
 
Point getClosestOrigin (const unsigned int &index, const Point &pt) const
 
void checkPointLength (const std::vector< std::vector< Real >> &points, std::string name) const
 
void adjustMidPointNode (const unsigned int &node_id, Elem *elem) const
 
BoundaryID getBoundaryID (const BoundaryName &name, const MeshBase &mesh) const
 
Point projectPoint (const Point &origin, const Point &pt) const
 
Point adjustPointToCircle (const unsigned int &node_id, Elem *elem, const Real &radius, const Point &origin) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

std::unique_ptr< MeshBase > & _input
 Mesh to modify. More...
 
const MooseEnum & _geometry_type
 Geometry type to curve boundaries to. More...
 
const MooseEnum & _axis
 Axis of the mesh about which to build the circular surface. More...
 
const bool & _curve_corners
 Whether to move corner nodes to fit curved radii of a regular polygon. More...
 
const Real & _rotation_angle
 
const bool & _retain_original_elem_type
 Whether to skip the optional output conversion to Quad8 or Hex20 elements. More...
 
const bool _has_moving_boundary
 Whether sidesets will be moved to match circular surfaces. More...
 
unsigned int _n_start_nodes
 Number of nodes per element in original mesh. More...
 
unsigned int _n_end_nodes
 Number of nodes per element in resulting mesh. More...
 
unsigned int _n_start_nodes_per_side
 Number of nodes per side of the starting element. More...
 
unsigned int _n_sides
 Number of sides per element (faces in 3-D, edges in 2-D) More...
 
unsigned int _n_corner_nodes
 Number of corner nodes. More...
 
std::vector< BoundaryID > _moving_boundary
 Sideset IDs to move to fit the circular surface. More...
 
std::vector< Real > _radius
 Radii of the circular surface(s) More...
 
std::vector< std::vector< Real > > _origin
 Origins of the circular surface(s) More...
 
std::vector< unsigned int > _layers
 Number of layers to sweep on each boundary. More...
 
Real _corner_radius
 If curving corners, the radius of curvature of the corner. More...
 
std::vector< Point > _polygon_corners
 If curving corners, the corner coordinates of the polygon. More...
 
Real _max_corner_distance
 Maximum distance a point can be from a corner and still require movement to the curved corners. More...
 
unsigned int _n_noncorner_boundaries
 Number of boundaries to be moved that do not include the corners. More...
 
std::set< BoundaryID > _boundaries_to_rebuild
 Boundaries to rebuild in the new mesh. More...
 
std::map< BoundaryID, BoundaryName > _boundary_id_to_name
 Original boundary names and IDs. More...
 
std::vector< std::vector< unsigned int > > _side_ids
 For each face, the mid-side nodes to be adjusted. More...
 
std::vector< std::vector< unsigned int > > _corner_nodes
 For each face, the corner node indices. More...
 
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > _across_pair
 For each face, the node pairing "across" that face to the other side of the original elem type. More...
 
std::vector< unsigned int > _across_face
 For each face, the paired face "across" to the other side of the original elem type. More...
 
ElemType _etype
 Element type in the original mesh. More...
 
std::vector< std::vector< unsigned int > > _side_nodes_map
 Side nodes map. More...
 
std::vector< std::vector< unsigned int > > _face_nodes_map
 Face nodes map. More...
 

Detailed Description

Converts a MOOSE high-order 2-D or 3-D mesh to optionally preserve circular boundaries by moving mid-face nodes, as well as optionally converting the element type into the types supported by Nek (Quad8 and Hex20).

Constructor & Destructor Documentation

◆ NekMeshGenerator()

NekMeshGenerator::NekMeshGenerator ( const InputParameters &  parameters)

Member Function Documentation

◆ adjustMidPointNode()

void NekMeshGenerator::adjustMidPointNode ( const unsigned int &  node_id,
Elem *  elem 
) const

Adjust the mid-point side node to the average of the corners

Parameters
[in]node_idindex for the node on the side mid-point
[in]elemelement of interest
Returns
average of the two corner nodes corresponding to the node_id mid-side node

◆ adjustPointToCircle()

Point NekMeshGenerator::adjustPointToCircle ( const unsigned int &  node_id,
Elem *  elem,
const Real &  radius,
const Point &  origin 
) const

Adjust the point to which a face node should move to fit onto the circle

Parameters
[in]node_idnode ID
[in]elemelement of interest
[in]radiusradius of circle
[in]originorigin of circle
Returns
adjustment made to point, for use when shifting other boundary layers

◆ checkElementType()

void NekMeshGenerator::checkElementType ( std::unique_ptr< MeshBase > &  mesh)

Check for correct element type in input mesh; the input mesh must be either entirely Quad9 or Hex27 elements

◆ checkPointLength()

void NekMeshGenerator::checkPointLength ( const std::vector< std::vector< Real >> &  points,
std::string  name 
) const

Check that points have 3 components to represent x, y, z

Parameters
[in]pointspoints
[in]namename of input parameter for error messages

◆ generate()

std::unique_ptr< MeshBase > NekMeshGenerator::generate ( )
override

◆ getBoundaryID()

BoundaryID NekMeshGenerator::getBoundaryID ( const BoundaryName &  name,
const MeshBase &  mesh 
) const

Get the boundary ID pertaining to a boundary name, and check for validity

Parameters
[in]nameboundary to check
[in]meshmesh
Returns
boundary ID corresponding to name

◆ getBoundaryLayerElems()

std::vector< Elem * > NekMeshGenerator::getBoundaryLayerElems ( Elem *  elem,
const unsigned int &  n_layers,
const unsigned int &  primary_face 
) const

Given an element with a face on the boundary of interest, get pointers to all the elements nested into the geometry

Parameters
[in]eleminput element
[in]n_layersnumber of layers to sweep inwards
[in]primary_faceface of the input element that is on the boundary
Returns
vector of elements attached to input element

◆ getClosestOrigin()

Point NekMeshGenerator::getClosestOrigin ( const unsigned int &  index,
const Point &  pt 
) const

Find the origin closest to the given point

Parameters
[in]indexboundary index to look for origins
[in]ptpoint of interest
Returns
closest origin

◆ getFaceNode()

unsigned int NekMeshGenerator::getFaceNode ( const unsigned int &  primary_face) const

Get a node on the given face that is unique to that side of the element

Parameters
[in]primary_faceface ID
Returns
node index on that face

◆ getNextLayerElem()

const Elem * NekMeshGenerator::getNextLayerElem ( const Elem &  elem,
const unsigned int &  touching_face,
unsigned int &  next_touching_face 
) const

Get a pointer to the next element in the boundary layer

Parameters
[in]elemcurrent element in the boundary layer
[in]touching_faceface of the element that touches the "next" element
[out]next_touching_faceface ID of the "next" element

◆ getNodeIndex()

unsigned int NekMeshGenerator::getNodeIndex ( const Elem *  elem,
const Point &  pt 
) const

Get the node index pertaining to a given point

Parameters
[in]elemelement
[in]ptpoint of interest
Returns
node index corresponding to the point

◆ initializeElemData()

void NekMeshGenerator::initializeElemData ( std::unique_ptr< MeshBase > &  mesh)

◆ isCornerNode()

bool NekMeshGenerator::isCornerNode ( const unsigned int &  node) const
virtual

Whether a node on a face is a corner node

Parameters
[in]nodenode index
Returns
whether node is a corner node

◆ isNearCorner()

bool NekMeshGenerator::isNearCorner ( const Point &  pt) const

Whether a point is close enough to a corner to require moving to fit the curved radii of curvature

Parameters
[in]ptpoint
Returns
whether point needs to be moved

◆ midPointNodeIndex()

unsigned int NekMeshGenerator::midPointNodeIndex ( const unsigned int &  face_id,
const unsigned int &  face_node 
) const

Get the node index corresponding to the mid-point side for a given corner node and face

Parameters
[in]face_idface ID of the element
[in]face_nodenode on given face
Returns
index of the mid-point node for that corner node "perpendicular" from the face

◆ moveElem()

void NekMeshGenerator::moveElem ( Elem *  elem,
const unsigned int &  boundary_index,
const unsigned int &  primary_face,
const std::vector< Real > &  polygon_layer_smoothing 
)

For an element on the 'boundary' of interest, move its nodes, as well as those of any boundary layers

Parameters
[in]elemelement on the primary 'boundary'
[in]boundary_indexindex of the 'boundary'
[in]primary_faceface ID of the element on the 'boundary'
[in]polygon_layer_smoothingmultiplicate values to apply to boundary layer widths

◆ moveNodes()

void NekMeshGenerator::moveNodes ( std::unique_ptr< MeshBase > &  mesh,
std::vector< Real > &  polygon_layer_smoothing 
)

Move any elements for circular adjusting

◆ pairedFaceNode()

unsigned int NekMeshGenerator::pairedFaceNode ( const unsigned int &  node_id,
const unsigned int &  face_id 
) const

Get the node "paired" to the present node "across" the face

Parameters
[in]node_idnode ID on primary face
[in]face_idID of primary face
Returns
node ID "across" that face to the other side of the Hex27

◆ pairedNodesAboutMidPoint()

std::pair< unsigned int, unsigned int > NekMeshGenerator::pairedNodesAboutMidPoint ( const unsigned int &  node_id) const
virtual

Get the two nodes to average coordinates for given a side-node id

Parameters
[in]node_idmid-point side node ID
Returns
two nodes on the corners to average to get new coordinates

◆ projectPoint()

Point NekMeshGenerator::projectPoint ( const Point &  origin,
const Point &  pt 
) const

Project a point onto the (x,y) plane (perpendicular to the 'axis'), relative to the origin

Parameters
[in]originorigin
[in]ptpoint to project
Returns
projected point

◆ validParams()

InputParameters NekMeshGenerator::validParams ( )
static

Member Data Documentation

◆ _across_face

std::vector<unsigned int> NekMeshGenerator::_across_face
protected

For each face, the paired face "across" to the other side of the original elem type.

◆ _across_pair

std::vector<std::vector<std::pair<unsigned int, unsigned int> > > NekMeshGenerator::_across_pair
protected

For each face, the node pairing "across" that face to the other side of the original elem type.

◆ _axis

const MooseEnum& NekMeshGenerator::_axis
protected

Axis of the mesh about which to build the circular surface.

◆ _boundaries_to_rebuild

std::set<BoundaryID> NekMeshGenerator::_boundaries_to_rebuild
protected

Boundaries to rebuild in the new mesh.

◆ _boundary_id_to_name

std::map<BoundaryID, BoundaryName> NekMeshGenerator::_boundary_id_to_name
protected

Original boundary names and IDs.

◆ _corner_nodes

std::vector<std::vector<unsigned int> > NekMeshGenerator::_corner_nodes
protected

For each face, the corner node indices.

◆ _corner_radius

Real NekMeshGenerator::_corner_radius
protected

If curving corners, the radius of curvature of the corner.

◆ _curve_corners

const bool& NekMeshGenerator::_curve_corners
protected

Whether to move corner nodes to fit curved radii of a regular polygon.

◆ _etype

ElemType NekMeshGenerator::_etype
protected

Element type in the original mesh.

◆ _face_nodes_map

std::vector<std::vector<unsigned int> > NekMeshGenerator::_face_nodes_map
protected

Face nodes map.

◆ _geometry_type

const MooseEnum& NekMeshGenerator::_geometry_type
protected

Geometry type to curve boundaries to.

◆ _has_moving_boundary

const bool NekMeshGenerator::_has_moving_boundary
protected

Whether sidesets will be moved to match circular surfaces.

◆ _input

std::unique_ptr<MeshBase>& NekMeshGenerator::_input
protected

Mesh to modify.

◆ _layers

std::vector<unsigned int> NekMeshGenerator::_layers
protected

Number of layers to sweep on each boundary.

◆ _max_corner_distance

Real NekMeshGenerator::_max_corner_distance
protected

Maximum distance a point can be from a corner and still require movement to the curved corners.

◆ _moving_boundary

std::vector<BoundaryID> NekMeshGenerator::_moving_boundary
protected

Sideset IDs to move to fit the circular surface.

◆ _n_corner_nodes

unsigned int NekMeshGenerator::_n_corner_nodes
protected

Number of corner nodes.

◆ _n_end_nodes

unsigned int NekMeshGenerator::_n_end_nodes
protected

Number of nodes per element in resulting mesh.

◆ _n_noncorner_boundaries

unsigned int NekMeshGenerator::_n_noncorner_boundaries
protected

Number of boundaries to be moved that do not include the corners.

◆ _n_sides

unsigned int NekMeshGenerator::_n_sides
protected

Number of sides per element (faces in 3-D, edges in 2-D)

◆ _n_start_nodes

unsigned int NekMeshGenerator::_n_start_nodes
protected

Number of nodes per element in original mesh.

◆ _n_start_nodes_per_side

unsigned int NekMeshGenerator::_n_start_nodes_per_side
protected

Number of nodes per side of the starting element.

◆ _origin

std::vector<std::vector<Real> > NekMeshGenerator::_origin
protected

Origins of the circular surface(s)

◆ _polygon_corners

std::vector<Point> NekMeshGenerator::_polygon_corners
protected

If curving corners, the corner coordinates of the polygon.

◆ _radius

std::vector<Real> NekMeshGenerator::_radius
protected

Radii of the circular surface(s)

◆ _retain_original_elem_type

const bool& NekMeshGenerator::_retain_original_elem_type
protected

Whether to skip the optional output conversion to Quad8 or Hex20 elements.

◆ _rotation_angle

const Real& NekMeshGenerator::_rotation_angle
protected

When curving corners, this mesh generator assumes that the polygon boundary is oriented so that it has a flat side "horizontal." For instance, if the polygon has 3 sides, this would look like:

o ----- o
 \     /
  \   /
   \o/

This is only used for identifying the points "at the corners" that need to be modified. If the input mesh therefore does not match the above, this rotation angle can be used to specify a different polygon orientation for the sake of curving corners.

◆ _side_ids

std::vector<std::vector<unsigned int> > NekMeshGenerator::_side_ids
protected

For each face, the mid-side nodes to be adjusted.

◆ _side_nodes_map

std::vector<std::vector<unsigned int> > NekMeshGenerator::_side_nodes_map
protected

Side nodes map.


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