Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::SpatialDomains::ZoneRotate Struct Referencefinal

Rotating zone: Motion of every point around a given axis on an origin. More...

#include <Zones.h>

Inheritance diagram for Nektar::SpatialDomains::ZoneRotate:
[legend]

Public Member Functions

 ZoneRotate (int id, int domainID, const CompositeMap &domain, const int coordDim, const NekPoint< NekDouble > &origin, const DNekVec &axis, const LibUtilities::EquationSharedPtr &angularVelEqn)
 
 ~ZoneRotate () override=default
 Default destructor. More...
 
NekDouble GetAngularVel (NekDouble &time) const
 Return the angular velocity of the zone at. More...
 
const NekPoint< NekDouble > & GetOrigin () const
 Returns the origin the zone rotates about. More...
 
const DNekVecGetAxis () const
 Returns the axis the zone rotates about. More...
 
LibUtilities::EquationSharedPtr GetAngularVelEqn () const
 Returns the equation for the angular velocity of the rotation. More...
 
- Public Member Functions inherited from Nektar::SpatialDomains::ZoneBase
 ZoneBase (MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
 Constructor. More...
 
virtual ~ZoneBase ()=default
 Default destructor. More...
 
MovementType GetMovementType () const
 Returns the type of movement. More...
 
CompositeMap GetDomain () const
 Returns the domain the zone is on. More...
 
int & GetId ()
 Returns the zone ID. More...
 
int & GetDomainID ()
 Returns the ID of the domain making up this Zone. More...
 
bool Move (NekDouble time)
 Performs the movement of the zone at. More...
 
std::vector< GeometrySharedPtr > const & GetElements () const
 Returns all highest dimension elements in the zone. More...
 
bool & GetMoved ()
 Returns the flag which states if the zone has moved in this timestep. More...
 
void ClearBoundingBoxes ()
 Clears all bounding boxes associated with the zones elements. More...
 

Protected Member Functions

bool v_Move (NekDouble time) final
 Virtual function for movement of the zone at. More...
 
virtual bool v_Move (NekDouble time)
 Virtual function for movement of the zone at. More...
 

Protected Attributes

NekPoint< NekDoublem_origin
 Origin point rotation is performed around. More...
 
DNekVec m_axis
 Axis rotation is performed around. More...
 
LibUtilities::EquationSharedPtr m_angularVelEqn
 Equation defining angular velocity as a function of time. More...
 
DNekMat m_W = DNekMat(3, 3, 0.0)
 W matrix Rodrigues' rotation formula, cross product of axis. More...
 
DNekMat m_W2 = DNekMat(3, 3, 0.0)
 W^2 matrix Rodrigues' rotation formula, cross product of axis squared. More...
 
- Protected Attributes inherited from Nektar::SpatialDomains::ZoneBase
MovementType m_type = MovementType::eNone
 Type of zone movement. More...
 
int m_id
 Zone ID. More...
 
int m_domainID
 ID for the composite making up this zone. More...
 
CompositeMap m_domain
 Zone domain. More...
 
std::vector< GeometrySharedPtrm_elements
 Vector of highest dimension zone elements. More...
 
bool m_moved = true
 Moved flag. More...
 
int m_coordDim
 Coordinate dimension. More...
 
std::vector< PointGeomSharedPtrm_verts
 Vector of all points in the zone. More...
 
std::vector< CurveSharedPtrm_curves
 Vector of all curves in the zone. More...
 
std::vector< PointGeomm_origVerts
 Vector of all points in the zone at initialisation. More...
 

Detailed Description

Rotating zone: Motion of every point around a given axis on an origin.

Definition at line 147 of file Zones.h.

Constructor & Destructor Documentation

◆ ZoneRotate()

Nektar::SpatialDomains::ZoneRotate::ZoneRotate ( int  id,
int  domainID,
const CompositeMap domain,
const int  coordDim,
const NekPoint< NekDouble > &  origin,
const DNekVec axis,
const LibUtilities::EquationSharedPtr angularVelEqn 
)

Constructor for rotating zones

Parameters
idZone ID
domainIDID associated with the the domain making up the zone
domainDomain that the zone consists of
coordDimCoordinate dimension
originOrigin that the zone rotates about
axisAxis that the zone rotates about
angularVelEqnEquation for the angular velocity of rotation

Definition at line 140 of file Movement/Zones.cpp.

144 : ZoneBase(MovementType::eRotate, id, domainID, domain, coordDim),
145 m_origin(origin), m_axis(axis), m_angularVelEqn(angularVelEqn)
146{
147 // Construct rotation matrix
148 m_W(0, 1) = -m_axis[2];
149 m_W(0, 2) = m_axis[1];
150 m_W(1, 0) = m_axis[2];
151 m_W(1, 2) = -m_axis[0];
152 m_W(2, 0) = -m_axis[1];
153 m_W(2, 1) = m_axis[0];
154
155 m_W2 = m_W * m_W;
156}
const NekPoint< NekDouble > origin
ZoneBase(MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
Constructor.
DNekVec m_axis
Axis rotation is performed around.
Definition: Zones.h:194
DNekMat m_W
W matrix Rodrigues' rotation formula, cross product of axis.
Definition: Zones.h:198
NekPoint< NekDouble > m_origin
Origin point rotation is performed around.
Definition: Zones.h:192
LibUtilities::EquationSharedPtr m_angularVelEqn
Equation defining angular velocity as a function of time.
Definition: Zones.h:196
DNekMat m_W2
W^2 matrix Rodrigues' rotation formula, cross product of axis squared.
Definition: Zones.h:200

References m_axis, m_W, and m_W2.

◆ ~ZoneRotate()

Nektar::SpatialDomains::ZoneRotate::~ZoneRotate ( )
overridedefault

Default destructor.

Member Function Documentation

◆ GetAngularVel()

NekDouble Nektar::SpatialDomains::ZoneRotate::GetAngularVel ( NekDouble time) const

Return the angular velocity of the zone at.

Parameters
time

Definition at line 180 of file Movement/Zones.cpp.

181{
182 return m_angularVelEqn->Evaluate(0, 0, 0, time);
183}

References m_angularVelEqn.

Referenced by v_Move().

◆ GetAngularVelEqn()

LibUtilities::EquationSharedPtr Nektar::SpatialDomains::ZoneRotate::GetAngularVelEqn ( ) const
inline

Returns the equation for the angular velocity of the rotation.

Definition at line 185 of file Zones.h.

186 {
187 return m_angularVelEqn;
188 }

References m_angularVelEqn.

◆ GetAxis()

const DNekVec & Nektar::SpatialDomains::ZoneRotate::GetAxis ( ) const
inline

Returns the axis the zone rotates about.

Definition at line 179 of file Zones.h.

180 {
181 return m_axis;
182 }

References m_axis.

◆ GetOrigin()

const NekPoint< NekDouble > & Nektar::SpatialDomains::ZoneRotate::GetOrigin ( ) const
inline

Returns the origin the zone rotates about.

Definition at line 173 of file Zones.h.

174 {
175 return m_origin;
176 }

References m_origin.

◆ v_Move()

bool Nektar::SpatialDomains::ZoneRotate::v_Move ( NekDouble  time)
finalprotectedvirtual

Virtual function for movement of the zone at.

Parameters
time

Reimplemented from Nektar::SpatialDomains::ZoneBase.

Definition at line 186 of file Movement/Zones.cpp.

187{
188 // Currently only valid for constant angular velocity
189 NekDouble angle = GetAngularVel(time) * time;
190
191 // Identity matrix
192 DNekMat rot(3, 3, 0.0);
193 rot(0, 0) = 1.0;
194 rot(1, 1) = 1.0;
195 rot(2, 2) = 1.0;
196
197 // Rodrigues' rotation formula in matrix form
198 rot = rot + sin(angle) * m_W + (1 - cos(angle)) * m_W2;
199
200 int cnt = 0;
201 for (auto &vert : m_verts)
202 {
203 NekPoint<NekDouble> pnt = m_origVerts[cnt] - m_origin;
204 DNekVec pntVec = {pnt[0], pnt[1], pnt[2]};
205
206 DNekVec newLoc = rot * pntVec;
207
208 vert->UpdatePosition(newLoc(0) + m_origin[0], newLoc(1) + m_origin[1],
209 newLoc(2) + m_origin[2]);
210 cnt++;
211 }
212
213 for (auto &curve : m_curves)
214 {
215 for (auto &vert : curve->m_points)
216 {
217 NekPoint<NekDouble> pnt = m_origVerts[cnt] - m_origin;
218 DNekVec pntVec = {pnt[0], pnt[1], pnt[2]};
219
220 DNekVec newLoc = rot * pntVec;
221
222 vert->UpdatePosition(newLoc(0) + m_origin[0],
223 newLoc(1) + m_origin[1],
224 newLoc(2) + m_origin[2]);
225 cnt++;
226 }
227 }
228
230
231 return true;
232}
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:50
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:48
double NekDouble
std::vector< PointGeomSharedPtr > m_verts
Vector of all points in the zone.
Definition: Zones.h:131
void ClearBoundingBoxes()
Clears all bounding boxes associated with the zones elements.
std::vector< PointGeom > m_origVerts
Vector of all points in the zone at initialisation.
Definition: Zones.h:135
std::vector< CurveSharedPtr > m_curves
Vector of all curves in the zone.
Definition: Zones.h:133
NekDouble GetAngularVel(NekDouble &time) const
Return the angular velocity of the zone at.

References Nektar::SpatialDomains::ZoneBase::ClearBoundingBoxes(), GetAngularVel(), Nektar::SpatialDomains::ZoneBase::m_curves, m_origin, Nektar::SpatialDomains::ZoneBase::m_origVerts, Nektar::SpatialDomains::ZoneBase::m_verts, m_W, and m_W2.

Member Data Documentation

◆ m_angularVelEqn

LibUtilities::EquationSharedPtr Nektar::SpatialDomains::ZoneRotate::m_angularVelEqn
protected

Equation defining angular velocity as a function of time.

Definition at line 196 of file Zones.h.

Referenced by GetAngularVel(), and GetAngularVelEqn().

◆ m_axis

DNekVec Nektar::SpatialDomains::ZoneRotate::m_axis
protected

Axis rotation is performed around.

Definition at line 194 of file Zones.h.

Referenced by GetAxis(), and ZoneRotate().

◆ m_origin

NekPoint<NekDouble> Nektar::SpatialDomains::ZoneRotate::m_origin
protected

Origin point rotation is performed around.

Definition at line 192 of file Zones.h.

Referenced by GetOrigin(), and v_Move().

◆ m_W

DNekMat Nektar::SpatialDomains::ZoneRotate::m_W = DNekMat(3, 3, 0.0)
protected

W matrix Rodrigues' rotation formula, cross product of axis.

Definition at line 198 of file Zones.h.

Referenced by v_Move(), and ZoneRotate().

◆ m_W2

DNekMat Nektar::SpatialDomains::ZoneRotate::m_W2 = DNekMat(3, 3, 0.0)
protected

W^2 matrix Rodrigues' rotation formula, cross product of axis squared.

Definition at line 200 of file Zones.h.

Referenced by v_Move(), and ZoneRotate().