Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | List of all members
Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData > Class Template Reference

#include <ReynoldsStressOpImpl.hpp>

Inheritance diagram for Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >:
[legend]

Public Member Functions

 ReynoldsStressOpImpl (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
 
- Public Member Functions inherited from Nektar::ReynoldsStressOp< TData >
void Configure (const std::vector< unsigned int > &velocityComponents)
 velocityComponents are the indices of the velocity components in the velocity field, which may hold further components.
 
void SetScale (const TData scale)
 Set the factor applied to the products before they are added.
 
void Apply (LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &products)
 Add the scaled products of velocity to products, which leave at the interleave width of velocity.
 
void operator() (LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &products)
 As 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::unique_ptr< MultiRegions::Operator< TData > > Instantiate (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
 
- Static Public Member Functions inherited from Nektar::ReynoldsStressOp< TData >
static std::shared_ptr< ReynoldsStressOp< TData > > Create (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
 
static std::vector< std::string > ProductNames (const std::vector< std::string > &velocityNames)
 Names of the product components, e.g. uu, uv, uw, vv, vw, ww, formed from the names of the selected velocity components.
 
- 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 std::string className
 
- Static Public Attributes inherited from Nektar::ReynoldsStressOp< TData >
static const std::string name = "ReynoldsStress"
 

Protected Member Functions

void v_Configure (const std::vector< unsigned int > &velocityComponents) override
 
void v_Apply (LibUtilities::Field< TData, FieldState::Phys > &velocity, LibUtilities::Field< TData, FieldState::Phys > &products) override
 
- Protected Member Functions inherited from Nektar::ReynoldsStressOp< TData >
 ReynoldsStressOp (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
 
 ~ReynoldsStressOp () override=default
 

Protected Attributes

std::array< unsigned int, 3 > m_velocityComponents {}
 
unsigned int m_dimension = 0
 
unsigned int m_nProducts = 0
 
unsigned int m_numPlanes = 1
 Number of local planes, or 1 without a homogeneous direction.
 
- Protected Attributes inherited from Nektar::ReynoldsStressOp< TData >
TData m_scale = TData{1}
 Factor applied to the products before they are added.
 
- 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.
 

Private Types

using MemSpace = typename ExecSpace::memory_space
 

Detailed Description

template<typename ExecSpace, typename TData>
class Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >

Definition at line 50 of file ReynoldsStressOpImpl.hpp.

Member Typedef Documentation

◆ MemSpace

template<typename ExecSpace , typename TData >
using Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::MemSpace = typename ExecSpace::memory_space
private

Definition at line 52 of file ReynoldsStressOpImpl.hpp.

Constructor & Destructor Documentation

◆ ReynoldsStressOpImpl()

template<typename ExecSpace , typename TData >
Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::ReynoldsStressOpImpl ( const MultiRegions::ExpListSharedPtr &  expansionList,
const std::vector< std::string > &  components 
)
inline

Definition at line 55 of file ReynoldsStressOpImpl.hpp.

57 : ReynoldsStressOp<TData>(expansionList, components)
58 {
59 // A 3DH1 expansion is a 2D mesh extended by the homogeneous direction.
60 const bool homogeneous =
61 expansionList->GetExpType() == MultiRegions::e3DH1D;
62 const unsigned int shapeDimension = expansionList->GetShapeDimension();
63 m_dimension = shapeDimension + (homogeneous ? 1 : 0);
64 ASSERTL0(m_dimension == 2 || m_dimension == 3,
65 "ReynoldsStress supports only 2D, 3D and 3DH1 expansions.");
66 ASSERTL0(expansionList->GetCoordim(0) == shapeDimension,
67 "ReynoldsStress does not support embedded-manifold "
68 "expansions.");
69 ASSERTL0(components.size() >= m_dimension,
70 "ReynoldsStress requires one velocity component per "
71 "dimension.");
73 m_numPlanes = homogeneous ? expansionList->GetZIDs().size() : 1;
74 }
#define ASSERTL0(condition, msg)
unsigned int m_numPlanes
Number of local planes, or 1 without a homogeneous direction.

References ASSERTL0, Nektar::MultiRegions::e3DH1D, Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_dimension, Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_nProducts, and Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_numPlanes.

Member Function Documentation

◆ Instantiate()

template<typename ExecSpace , typename TData >
static std::unique_ptr< MultiRegions::Operator< TData > > Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::Instantiate ( const MultiRegions::ExpListSharedPtr &  expansionList,
const std::vector< std::string > &  components 
)
inlinestatic

Definition at line 78 of file ReynoldsStressOpImpl.hpp.

81 {
82 return std::make_unique<ReynoldsStressOpImpl<ExecSpace, TData>>(
83 expansionList, components);
84 }

◆ v_Apply()

template<typename ExecSpace , typename TData >
void Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::v_Apply ( LibUtilities::Field< TData, FieldState::Phys > &  velocity,
LibUtilities::Field< TData, FieldState::Phys > &  products 
)
inlineoverrideprotectedvirtual

Implements Nektar::ReynoldsStressOp< TData >.

Definition at line 103 of file ReynoldsStressOpImpl.hpp.

106 {
107 ASSERTL1(velocity.GetNumHomoModes() == m_numPlanes &&
108 products.GetNumHomoModes() == m_numPlanes,
109 "ReynoldsStress velocity or product plane count mismatch.");
110 ASSERTL1(velocity.GetNumComponents() >= m_dimension &&
111 products.GetNumComponents() == m_nProducts,
112 "ReynoldsStress velocity or product component count "
113 "mismatch.");
114 ASSERTL1(velocity.GetBlocks().size() == products.GetBlocks().size(),
115 "ReynoldsStress velocity-product block count mismatch.");
116
117 // The products are laid out like the velocity, so that one storage
118 // index addresses the same point in both; a block at another
119 // interleave width is reshaped, keeping its content.
120 products.ReshapeStorage(velocity.GetInterleaveWidth(), ExecSpace::name);
121
122 for (unsigned int block_idx = 0;
123 block_idx < velocity.GetBlocks().size(); ++block_idx)
124 {
125 const unsigned int streamID = block_idx + 1;
126
127 auto &velocityBlock = velocity.GetBlocks()[block_idx];
128 auto &productBlock = products.GetBlocks()[block_idx];
129
130 ASSERTL1(productBlock.CompSize() == velocityBlock.CompSize(),
131 "ReynoldsStress velocity-product block layout "
132 "mismatch.");
133
134 const auto velocityPtr =
135 velocityBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
136 auto productPtr =
137 productBlock.template GetPtr<MemSpace, ReadWrite>(streamID);
138
139 switch (m_dimension)
140 {
141 case 2:
142 ReynoldsStressKernelLauncher<ExecSpace, 2>(
143 velocityBlock.CompSize(), m_numPlanes,
145 m_velocityComponents[2], this->m_scale, velocityPtr,
146 productPtr, streamID);
147 break;
148 case 3:
149 ReynoldsStressKernelLauncher<ExecSpace, 3>(
150 velocityBlock.CompSize(), m_numPlanes,
152 m_velocityComponents[2], this->m_scale, velocityPtr,
153 productPtr, streamID);
154 break;
155 default:
156 NEKERROR(
158 "ReynoldsStress supports only dimensions 2 and 3.");
159 }
160 }
161 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
std::array< unsigned int, 3 > m_velocityComponents

References ASSERTL1, Nektar::ErrorUtil::efatal, Nektar::LibUtilities::Field< TData, TState >::GetBlocks(), Nektar::LibUtilities::Field< TData, TState >::GetInterleaveWidth(), Nektar::LibUtilities::Field< TData, TState >::GetNumComponents(), Nektar::LibUtilities::Field< TData, TState >::GetNumHomoModes(), Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_dimension, Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_nProducts, Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_numPlanes, Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_velocityComponents, NEKERROR, and Nektar::LibUtilities::Field< TData, TState >::ReshapeStorage().

◆ v_Configure()

template<typename ExecSpace , typename TData >
void Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::v_Configure ( const std::vector< unsigned int > &  velocityComponents)
inlineoverrideprotectedvirtual

Implements Nektar::ReynoldsStressOp< TData >.

Definition at line 93 of file ReynoldsStressOpImpl.hpp.

95 {
96 ASSERTL0(velocityComponents.size() == m_dimension,
97 "ReynoldsStress velocity selection must match the "
98 "dimension.");
99 std::copy(velocityComponents.begin(), velocityComponents.end(),
100 m_velocityComponents.begin());
101 }

References ASSERTL0, Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_dimension, and Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_velocityComponents.

Member Data Documentation

◆ className

template<typename ExecSpace , typename TData >
std::string Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::className
static

Definition at line 76 of file ReynoldsStressOpImpl.hpp.

◆ m_dimension

template<typename ExecSpace , typename TData >
unsigned int Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_dimension = 0
protected

◆ m_nProducts

template<typename ExecSpace , typename TData >
unsigned int Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_nProducts = 0
protected

◆ m_numPlanes

template<typename ExecSpace , typename TData >
unsigned int Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_numPlanes = 1
protected

◆ m_velocityComponents

template<typename ExecSpace , typename TData >
std::array<unsigned int, 3> Nektar::detail::ReynoldsStressOpImpl< ExecSpace, TData >::m_velocityComponents {}
protected