Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Nektar::AeroForcesOp< TData > Class Template Referenceabstract

Integrate pressure and viscous forces over selected boundaries. More...

#include <AeroForcesOp.hpp>

Inheritance diagram for Nektar::AeroForcesOp< TData >:
[legend]

Public Member Functions

void Configure (const std::vector< unsigned int > &velocityComponents, const MultiRegions::ExpListSharedPtr &pressureExpansion, const unsigned int pressureComponent, const std::vector< bool > &selectedBoundaryRegions, const TData rho, const TData mu, const std::array< TData, 3 > &pivot)
 velocityComponents and pressureComponent are the indices of the velocity and pressure in the fields whose gradient and values Apply() receives, which may hold further components.
 
void Apply (LibUtilities::Field< TData, FieldState::Phys > &pressure, LibUtilities::Field< TData, FieldState::Phys > &velocityGradient)
 Collective: every rank must call it.
 
void operator() (LibUtilities::Field< TData, FieldState::Phys > &pressure, LibUtilities::Field< TData, FieldState::Phys > &velocityGradient)
 Collective: as Apply().
 
void SetRootOnly (const bool rootOnly)
 Reduce the results of the next Apply() to rank zero alone if rootOnly, else to every rank.
 
std::array< TData, 3 > GetPressureForce ()
 Pressure force from the last Apply().
 
std::array< TData, 3 > GetViscousForce ()
 Viscous force from the last Apply().
 
std::array< TData, 3 > GetPressureMoment ()
 Moment of the pressure traction about the pivot from the last Apply().
 
std::array< TData, 3 > GetViscousMoment ()
 Moment of the viscous traction about the pivot from the last Apply().
 
- Public Member Functions inherited from Nektar::MultiRegions::Operator< TData >
virtual ~Operator ()=default
 
 Operator (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > components)
 Construct the interface part of a concrete operator; called by the factory-registered creator functions.
 

Static Public Member Functions

static std::shared_ptr< AeroForcesOp< TData > > Create (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
 expansionList and components are those of the velocity.
 
- Static Public Member Functions inherited from Nektar::MultiRegions::Operator< TData >
template<template< typename > typename TOperator>
static std::shared_ptr< TOperator< TData > > Create (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > components, const std::string &execStr)
 Create a concrete operator instance through the operator factory.
 
static std::string GetOpExecSpace (std::shared_ptr< LibUtilities::SessionReader > session, const bool warn=true)
 Return the execution space name ("opExecSpace") for an operator.
 
static const DefaultOpImplRule * GetDefaultOpImplRule (const StdRegions::StdExpansionSharedPtr &exp, const std::string &execSpace)
 Return the row of the default implementation table (DefaultOpImplTable.hpp) that a block of elements takes, or null if none does.
 
static std::string GetDefaultOpImpl (const StdRegions::StdExpansionSharedPtr &exp, const std::string &execSpace)
 Return the implementation a block of elements takes when neither the command line nor the session names one for its operator.
 
static std::vector< unsigned int > GetDefaultInterleaveWidths (const MultiRegions::ExpListSharedPtr &expansionList)
 Return the default interleave widths, one per block of expansionList, that persistent Fields (e.g. solution storage, time-integration and linear-solver workspace) built on it should be constructed with.
 
static bool IsDiscontinuousProjection (std::shared_ptr< LibUtilities::SessionReader > session)
 Return true if the session uses a Discontinuous (DG) projection.
 

Static Public Attributes

static const std::string name = "AeroForces"
 

Protected Member Functions

 AeroForcesOp (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
 
 ~AeroForcesOp () override=default
 
virtual void v_Configure (const std::vector< unsigned int > &velocityComponents, const MultiRegions::ExpListSharedPtr &pressureExpansion, const unsigned int pressureComponent, const std::vector< bool > &selectedBoundaryRegions, const TData rho, const TData mu, const std::array< TData, 3 > &pivot)=0
 
virtual void v_Apply (LibUtilities::Field< TData, FieldState::Phys > &pressure, LibUtilities::Field< TData, FieldState::Phys > &velocityGradient)=0
 
std::array< TData, 3 > GetResultVector (const unsigned int offset)
 The 3-vector at offset of the reduced result, read on the host.
 

Protected Attributes

bool m_rootOnly = false
 Whether Apply() reduces the results to rank zero alone.
 
LibUtilities::MemoryRegion< TData > m_result
 Reduced result of Apply(), of size resultSize, allocated by Configure().
 
- Protected Attributes inherited from Nektar::MultiRegions::Operator< TData >
MultiRegions::ExpListSharedPtr m_expansionList
 Expansion list the operator acts on.
 
std::vector< std::string > m_components
 Names of the field components the operator was built for.
 
LibUtilities::NekDataWarehouseSharedPtr m_dataWarehouse
 Data warehouse shared with the other operators on the expansion list, used to build and cache shared tables (basis matrices, mode indices, geometric factors) once.
 

Static Protected Attributes

static constexpr unsigned int pressureForce = 0
 Offsets of the 3-vectors in m_result.
 
static constexpr unsigned int viscousForce = 3
 
static constexpr unsigned int pressureMoment = 6
 
static constexpr unsigned int viscousMoment = 9
 
static constexpr unsigned int resultSize = 12
 Number of entries in m_result.
 

Detailed Description

template<typename TData>
class Nektar::AeroForcesOp< TData >

Integrate pressure and viscous forces over selected boundaries.

Volume-to-boundary restriction, traction evaluation, quadrature and the local reduction execute in the selected operator execution space, and the forces and moments are reduced across the ranks in one packed buffer.

After Apply(), the getters return Cartesian 3-vectors, with component d (0 = x, 1 = y, 2 = z) at index d:

A 3DH1 expansion is integrated as its 2D planes are: each local plane gives the forces and moments per unit span, as in 2D, from the in-plane velocity gradient, and the result is their average over all the planes.

Apply() is collective: every rank must call it. The getters read the reduced values on the host, on every rank, or on rank zero only after SetRootOnly(true), which reduces them to rank zero alone. Internally the four 3-vectors are packed in m_result, starting at the offsets pressureForce, viscousForce, pressureMoment and viscousMoment.

Definition at line 84 of file AeroForcesOp.hpp.

Constructor & Destructor Documentation

◆ AeroForcesOp()

template<typename TData >
Nektar::AeroForcesOp< TData >::AeroForcesOp ( const MultiRegions::ExpListSharedPtr &  expansionList,
const std::vector< std::string > &  components 
)
inlineprotected

Definition at line 175 of file AeroForcesOp.hpp.

177 : MultiRegions::Operator<TData>(expansionList, components)
178 {
179 }

◆ ~AeroForcesOp()

template<typename TData >
Nektar::AeroForcesOp< TData >::~AeroForcesOp ( )
overrideprotecteddefault

Member Function Documentation

◆ Apply()

template<typename TData >
void Nektar::AeroForcesOp< TData >::Apply ( LibUtilities::Field< TData, FieldState::Phys > &  pressure,
LibUtilities::Field< TData, FieldState::Phys > &  velocityGradient 
)
inline

Collective: every rank must call it.

Definition at line 114 of file AeroForcesOp.hpp.

116 {
117 v_Apply(pressure, velocityGradient);
118 }
virtual void v_Apply(LibUtilities::Field< TData, FieldState::Phys > &pressure, LibUtilities::Field< TData, FieldState::Phys > &velocityGradient)=0

References Nektar::AeroForcesOp< TData >::v_Apply().

◆ Configure()

template<typename TData >
void Nektar::AeroForcesOp< TData >::Configure ( const std::vector< unsigned int > &  velocityComponents,
const MultiRegions::ExpListSharedPtr &  pressureExpansion,
const unsigned int  pressureComponent,
const std::vector< bool > &  selectedBoundaryRegions,
const TData  rho,
const TData  mu,
const std::array< TData, 3 > &  pivot 
)
inline

velocityComponents and pressureComponent are the indices of the velocity and pressure in the fields whose gradient and values Apply() receives, which may hold further components.

Definition at line 102 of file AeroForcesOp.hpp.

108 {
109 v_Configure(velocityComponents, pressureExpansion, pressureComponent,
110 selectedBoundaryRegions, rho, mu, pivot);
111 }
virtual void v_Configure(const std::vector< unsigned int > &velocityComponents, const MultiRegions::ExpListSharedPtr &pressureExpansion, const unsigned int pressureComponent, const std::vector< bool > &selectedBoundaryRegions, const TData rho, const TData mu, const std::array< TData, 3 > &pivot)=0

References Nektar::AeroForcesOp< TData >::v_Configure().

◆ Create()

template<typename TData >
static std::shared_ptr< AeroForcesOp< TData > > Nektar::AeroForcesOp< TData >::Create ( const MultiRegions::ExpListSharedPtr &  expansionList,
const std::vector< std::string > &  components,
const std::string &  execStr = "" 
)
inlinestatic

expansionList and components are those of the velocity.

Definition at line 88 of file AeroForcesOp.hpp.

92 {
93 return MultiRegions::Operator<TData>::template Create<AeroForcesOp>(
94 expansionList, components, execStr);
95 }

Referenced by Nektar::FilterAeroForces::v_Initialise().

◆ GetPressureForce()

template<typename TData >
std::array< TData, 3 > Nektar::AeroForcesOp< TData >::GetPressureForce ( )
inline

Pressure force from the last Apply().

Definition at line 136 of file AeroForcesOp.hpp.

137 {
139 }
static constexpr unsigned int pressureForce
Offsets of the 3-vectors in m_result.
std::array< TData, 3 > GetResultVector(const unsigned int offset)
The 3-vector at offset of the reduced result, read on the host.

References Nektar::AeroForcesOp< TData >::GetResultVector(), and Nektar::AeroForcesOp< TData >::pressureForce.

◆ GetPressureMoment()

template<typename TData >
std::array< TData, 3 > Nektar::AeroForcesOp< TData >::GetPressureMoment ( )
inline

Moment of the pressure traction about the pivot from the last Apply().

Definition at line 149 of file AeroForcesOp.hpp.

150 {
152 }
static constexpr unsigned int pressureMoment

References Nektar::AeroForcesOp< TData >::GetResultVector(), and Nektar::AeroForcesOp< TData >::pressureMoment.

◆ GetResultVector()

template<typename TData >
std::array< TData, 3 > Nektar::AeroForcesOp< TData >::GetResultVector ( const unsigned int  offset)
inlineprotected

The 3-vector at offset of the reduced result, read on the host.

Definition at line 195 of file AeroForcesOp.hpp.

196 {
197 ASSERTL0(!m_rootOnly || this->m_expansionList->GetComm()
198 ->GetSpaceComm()
199 ->TreatAsRankZero(),
200 "AeroForcesOp reduced its results to rank zero only.");
201 const auto result =
202 m_result.template GetPtr<NektarSpaces::HostSpace, ReadOnly>();
203 return {result[offset], result[offset + 1], result[offset + 2]};
204 }
#define ASSERTL0(condition, msg)
LibUtilities::MemoryRegion< TData > m_result
Reduced result of Apply(), of size resultSize, allocated by Configure().
bool m_rootOnly
Whether Apply() reduces the results to rank zero alone.
MultiRegions::ExpListSharedPtr m_expansionList
Expansion list the operator acts on.
Definition Operator.hpp:349

References ASSERTL0, Nektar::MultiRegions::Operator< TData >::m_expansionList, Nektar::AeroForcesOp< TData >::m_result, and Nektar::AeroForcesOp< TData >::m_rootOnly.

Referenced by Nektar::AeroForcesOp< TData >::GetPressureForce(), Nektar::AeroForcesOp< TData >::GetPressureMoment(), Nektar::AeroForcesOp< TData >::GetViscousForce(), and Nektar::AeroForcesOp< TData >::GetViscousMoment().

◆ GetViscousForce()

template<typename TData >
std::array< TData, 3 > Nektar::AeroForcesOp< TData >::GetViscousForce ( )
inline

Viscous force from the last Apply().

Definition at line 142 of file AeroForcesOp.hpp.

143 {
145 }
static constexpr unsigned int viscousForce

References Nektar::AeroForcesOp< TData >::GetResultVector(), and Nektar::AeroForcesOp< TData >::viscousForce.

◆ GetViscousMoment()

template<typename TData >
std::array< TData, 3 > Nektar::AeroForcesOp< TData >::GetViscousMoment ( )
inline

Moment of the viscous traction about the pivot from the last Apply().

Definition at line 155 of file AeroForcesOp.hpp.

156 {
158 }
static constexpr unsigned int viscousMoment

References Nektar::AeroForcesOp< TData >::GetResultVector(), and Nektar::AeroForcesOp< TData >::viscousMoment.

◆ operator()()

template<typename TData >
void Nektar::AeroForcesOp< TData >::operator() ( LibUtilities::Field< TData, FieldState::Phys > &  pressure,
LibUtilities::Field< TData, FieldState::Phys > &  velocityGradient 
)
inline

Collective: as Apply().

Definition at line 121 of file AeroForcesOp.hpp.

124 {
125 v_Apply(pressure, velocityGradient);
126 }

References Nektar::AeroForcesOp< TData >::v_Apply().

◆ SetRootOnly()

template<typename TData >
void Nektar::AeroForcesOp< TData >::SetRootOnly ( const bool  rootOnly)
inline

Reduce the results of the next Apply() to rank zero alone if rootOnly, else to every rank.

Definition at line 130 of file AeroForcesOp.hpp.

131 {
132 m_rootOnly = rootOnly;
133 }

References Nektar::AeroForcesOp< TData >::m_rootOnly.

◆ v_Apply()

template<typename TData >
virtual void Nektar::AeroForcesOp< TData >::v_Apply ( LibUtilities::Field< TData, FieldState::Phys > &  pressure,
LibUtilities::Field< TData, FieldState::Phys > &  velocityGradient 
)
protectedpure virtual

◆ v_Configure()

template<typename TData >
virtual void Nektar::AeroForcesOp< TData >::v_Configure ( const std::vector< unsigned int > &  velocityComponents,
const MultiRegions::ExpListSharedPtr &  pressureExpansion,
const unsigned int  pressureComponent,
const std::vector< bool > &  selectedBoundaryRegions,
const TData  rho,
const TData  mu,
const std::array< TData, 3 > &  pivot 
)
protectedpure virtual

Member Data Documentation

◆ m_result

template<typename TData >
LibUtilities::MemoryRegion<TData> Nektar::AeroForcesOp< TData >::m_result
protected

◆ m_rootOnly

template<typename TData >
bool Nektar::AeroForcesOp< TData >::m_rootOnly = false
protected

◆ name

template<typename TData >
const std::string Nektar::AeroForcesOp< TData >::name = "AeroForces"
inlinestatic

Definition at line 97 of file AeroForcesOp.hpp.

◆ pressureForce

template<typename TData >
constexpr unsigned int Nektar::AeroForcesOp< TData >::pressureForce = 0
staticconstexprprotected

Offsets of the 3-vectors in m_result.

Definition at line 162 of file AeroForcesOp.hpp.

Referenced by Nektar::AeroForcesOp< TData >::GetPressureForce().

◆ pressureMoment

template<typename TData >
constexpr unsigned int Nektar::AeroForcesOp< TData >::pressureMoment = 6
staticconstexprprotected

Definition at line 164 of file AeroForcesOp.hpp.

Referenced by Nektar::AeroForcesOp< TData >::GetPressureMoment().

◆ resultSize

template<typename TData >
constexpr unsigned int Nektar::AeroForcesOp< TData >::resultSize = 12
staticconstexprprotected

Number of entries in m_result.

Definition at line 167 of file AeroForcesOp.hpp.

◆ viscousForce

template<typename TData >
constexpr unsigned int Nektar::AeroForcesOp< TData >::viscousForce = 3
staticconstexprprotected

Definition at line 163 of file AeroForcesOp.hpp.

Referenced by Nektar::AeroForcesOp< TData >::GetViscousForce().

◆ viscousMoment

template<typename TData >
constexpr unsigned int Nektar::AeroForcesOp< TData >::viscousMoment = 9
staticconstexprprotected

Definition at line 165 of file AeroForcesOp.hpp.

Referenced by Nektar::AeroForcesOp< TData >::GetViscousMoment().