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::MultiRegions::BndCondPhysOp< TData > Class Template Referenceabstract

#include <BndCondPhysOp.hpp>

Inheritance diagram for Nektar::MultiRegions::BndCondPhysOp< TData >:
[legend]

Public Member Functions

void SetStreamID (const unsigned int streamID)
 Refill the storage on stream streamID, the default stream unless set. The trace flux operator sets the one it reads the storage on.
 
void ResetStreamID ()
 Refill on the default stream again, undoing SetStreamID().
 
size_t GetNumBlocks () const
 Number of blocks the boundary data is stored in.
 
size_t GetNumComponents () const
 Components held per block, i.e. the range valid for GetBndCondType().
 
void UpdateBndPhys (const TData &time=0.0)
 Bring the stored values up to date for time time.
 
void GetTraceLocation (const size_t tid, unsigned &blk, size_t &offset, size_t &compOffset)
 Where the data for global trace tid lives.
 
bool HasTrace (const size_t tid) const
 Does this operator hold boundary data for global trace tid?
 
const TData * GetBlockPtr (const unsigned blk, const unsigned int streamID=0)
 Base pointer for block blk, fetched through the memory manager on stream streamID.
 
TData * UpdateBlockPtr (const unsigned blk, const unsigned int streamID=0)
 Writable base pointer for block blk.
 
size_t GetBlockCompStride (const unsigned blk) const
 Phys points in block blk, i.e. the stride between its components and equally the number of points to walk when transforming the whole block.
 
const TData * GetBlockNormals (const unsigned blk)
 Outward normals of block blk, in the same layout as its values: component major, GetBlockCompStride() apart, one component per coordinate direction.
 
SpatialDomains::BoundaryConditionType GetBndCondType (const unsigned blk, const unsigned comp) const
 Condition type component comp of block blk carries.
 
const std::string & GetBndUserDefined (const unsigned blk, const unsigned comp) const
 USERDEFINEDTYPE of component comp of block blk.
 
bool GetBndUserDefinedParam (const unsigned blk, const unsigned comp, const std::string &name, TData &value) const
 A named parameter carried on the boundary tag.
 
- 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< BndCondPhysOp< TData > > Create (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
 
- 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 = "BndCondPhys"
 

Protected Member Functions

 BndCondPhysOp (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
 
 ~BndCondPhysOp () override=default
 
virtual size_t v_GetNumBlocks () const =0
 
virtual void v_GetTraceLocation (const size_t tid, unsigned &blk, size_t &offset, size_t &compOffset)=0
 
virtual bool v_HasTrace (const size_t tid) const =0
 
virtual const TData * v_GetBlockPtr (const unsigned blk, const unsigned int streamID)=0
 
virtual TData * v_UpdateBlockPtr (const unsigned blk, const unsigned int streamID)=0
 
virtual size_t v_GetBlockCompStride (const unsigned blk) const =0
 
virtual const TData * v_GetBlockNormals (const unsigned blk)=0
 
virtual SpatialDomains::BoundaryConditionType v_GetBndCondType (const unsigned blk, const unsigned comp) const =0
 
virtual bool v_GetBndUserDefinedParam (const unsigned blk, const unsigned comp, const std::string &name, TData &value) const =0
 
virtual const std::string & v_GetBndUserDefined (const unsigned blk, const unsigned comp) const =0
 
virtual void v_UpdateBndPhys (const TData &time)=0
 

Protected Attributes

unsigned int m_opStreamID = m_defaultStreamID
 Stream the storage is refilled on. See SetStreamID().
 
bool m_bndPhysInitialised = false
 Set once the constructor's initial evaluation has happened, so that UpdateBndPhys() can skip regions that will never change.
 
bool m_hasTimeDependentBndPhys = false
 
- 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 m_defaultStreamID = 0
 Stream the storage is refilled on unless SetStreamID() says otherwise.
 

Detailed Description

template<typename TData>
class Nektar::MultiRegions::BndCondPhysOp< TData >

Definition at line 48 of file BndCondPhysOp.hpp.

Constructor & Destructor Documentation

◆ BndCondPhysOp()

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

Definition at line 268 of file BndCondPhysOp.hpp.

270 : Operator<TData>(expansionList, components)
271 {
272 }

◆ ~BndCondPhysOp()

template<typename TData >
Nektar::MultiRegions::BndCondPhysOp< TData >::~BndCondPhysOp ( )
overrideprotecteddefault

Member Function Documentation

◆ Create()

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

Definition at line 52 of file BndCondPhysOp.hpp.

56 {
57 return Operator<TData>::template Create<BndCondPhysOp>(
58 expansionList, components, execStr);
59 }

Referenced by TestBndCondPhys< TData >::RunTestCase().

◆ GetBlockCompStride()

template<typename TData >
size_t Nektar::MultiRegions::BndCondPhysOp< TData >::GetBlockCompStride ( const unsigned  blk) const
inline

Phys points in block blk, i.e. the stride between its components and equally the number of points to walk when transforming the whole block.

Definition at line 169 of file BndCondPhysOp.hpp.

170 {
171 return v_GetBlockCompStride(blk);
172 }
virtual size_t v_GetBlockCompStride(const unsigned blk) const =0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBlockCompStride().

◆ GetBlockNormals()

template<typename TData >
const TData * Nektar::MultiRegions::BndCondPhysOp< TData >::GetBlockNormals ( const unsigned  blk)
inline

Outward normals of block blk, in the same layout as its values: component major, GetBlockCompStride() apart, one component per coordinate direction.

Cached in the data warehouse, so repeated calls are free and every boundary condition that needs a normal direction - a symmetry plane, a characteristic inflow, an outflow deciding whether it is subsonic - draws on one copy.

Definition at line 184 of file BndCondPhysOp.hpp.

185 {
186 return v_GetBlockNormals(blk);
187 }
virtual const TData * v_GetBlockNormals(const unsigned blk)=0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBlockNormals().

◆ GetBlockPtr()

template<typename TData >
const TData * Nektar::MultiRegions::BndCondPhysOp< TData >::GetBlockPtr ( const unsigned  blk,
const unsigned int  streamID = 0 
)
inline

Base pointer for block blk, fetched through the memory manager on stream streamID.

Definition at line 144 of file BndCondPhysOp.hpp.

146 {
147 return v_GetBlockPtr(blk, streamID);
148 }
virtual const TData * v_GetBlockPtr(const unsigned blk, const unsigned int streamID)=0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBlockPtr().

◆ GetBndCondType()

template<typename TData >
SpatialDomains::BoundaryConditionType Nektar::MultiRegions::BndCondPhysOp< TData >::GetBndCondType ( const unsigned  blk,
const unsigned  comp 
) const
inline

Condition type component comp of block blk carries.

Values of every type are stored identically; what differs is how they must be interpreted, so a consumer that treats a Neumann or Robin boundary differently from a Dirichlet one asks here. Never SpatialDomains::ePeriodic - those regions hold no values and are not given a block.

Definition at line 198 of file BndCondPhysOp.hpp.

200 {
201 return v_GetBndCondType(blk, comp);
202 }
virtual SpatialDomains::BoundaryConditionType v_GetBndCondType(const unsigned blk, const unsigned comp) const =0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBndCondType().

◆ GetBndUserDefined()

template<typename TData >
const std::string & Nektar::MultiRegions::BndCondPhysOp< TData >::GetBndUserDefined ( const unsigned  blk,
const unsigned  comp 
) const
inline

USERDEFINEDTYPE of component comp of block blk.

Empty when the session gives none. The tags are solver specific, so this hands back the session's own string rather than a code: a compressible flow solver knows what "WallAdiabatic" means and this operator does not. A condition so tagged is still an ordinary condition of its GetBndCondType() as far as the storage here goes.

Host side only - the string is not something a kernel can read. A caller that needs the distinction on device should resolve these once into its own per-block table of codes, as it must do for its own enum anyway.

Definition at line 217 of file BndCondPhysOp.hpp.

219 {
220 return v_GetBndUserDefined(blk, comp);
221 }
virtual const std::string & v_GetBndUserDefined(const unsigned blk, const unsigned comp) const =0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBndUserDefined().

◆ GetBndUserDefinedParam()

template<typename TData >
bool Nektar::MultiRegions::BndCondPhysOp< TData >::GetBndUserDefinedParam ( const unsigned  blk,
const unsigned  comp,
const std::string &  name,
TData &  value 
) const
inline

A named parameter carried on the boundary tag.

A USERDEFINEDTYPE may carry parameters after the condition itself,

USERDEFINEDTYPE="WallViscous:twall=300.15"
USERDEFINEDTYPE="WallViscous:twall=TInf"

so that a quantity belonging to one region is written on that region rather than as a session-wide parameter. Two regions may then hold different values, which a session parameter cannot express.

The value is evaluated as an expression against the session, as the Rotated: periodic tag does, so it may name session parameters and use arithmetic rather than having to be a literal.

GetBndUserDefined() returns the condition with any such parameters stripped, so a condition that takes none - and the check that every tag is claimed by some operator - are unaffected by their presence.

Parameters
blk- Storage block.
comp- Component; a region carries one tag for all of them.
name- Parameter name, matched without regard to case.
value- Set only when the parameter is present, so a caller may seed it with a default and ignore the return.
Returns
Whether the parameter was present.

Definition at line 251 of file BndCondPhysOp.hpp.

253 {
254 return v_GetBndUserDefinedParam(blk, comp, name, value);
255 }
virtual bool v_GetBndUserDefinedParam(const unsigned blk, const unsigned comp, const std::string &name, TData &value) const =0

References Nektar::MultiRegions::BndCondPhysOp< TData >::name, and Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBndUserDefinedParam().

◆ GetNumBlocks()

template<typename TData >
size_t Nektar::MultiRegions::BndCondPhysOp< TData >::GetNumBlocks ( ) const
inline

Number of blocks the boundary data is stored in.

Definition at line 77 of file BndCondPhysOp.hpp.

78 {
79 return v_GetNumBlocks();
80 }
virtual size_t v_GetNumBlocks() const =0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetNumBlocks().

◆ GetNumComponents()

template<typename TData >
size_t Nektar::MultiRegions::BndCondPhysOp< TData >::GetNumComponents ( ) const
inline

Components held per block, i.e. the range valid for GetBndCondType().

Definition at line 83 of file BndCondPhysOp.hpp.

84 {
85 return this->m_components.size();
86 }
std::vector< std::string > m_components
Names of the field components the operator was built for.
Definition Operator.hpp:351

References Nektar::MultiRegions::Operator< TData >::m_components.

◆ GetTraceLocation()

template<typename TData >
void Nektar::MultiRegions::BndCondPhysOp< TData >::GetTraceLocation ( const size_t  tid,
unsigned &  blk,
size_t &  offset,
size_t &  compOffset 
)
inline

Where the data for global trace tid lives.

The mapping is fixed once the operator is constructed, so a caller that gathers many traces can resolve it up front and keep only the integers, rather than paying a virtual call and two map lookups per trace. The base pointer is deliberately not returned: it must come from GetBlockPtr() at the point of use, so that the memory manager still sees every access.

Definition at line 121 of file BndCondPhysOp.hpp.

123 {
124 v_GetTraceLocation(tid, blk, offset, compOffset);
125 }
virtual void v_GetTraceLocation(const size_t tid, unsigned &blk, size_t &offset, size_t &compOffset)=0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetTraceLocation().

◆ HasTrace()

template<typename TData >
bool Nektar::MultiRegions::BndCondPhysOp< TData >::HasTrace ( const size_t  tid) const
inline

Does this operator hold boundary data for global trace tid?

GetTraceLocation() assumes it does and asserts otherwise, which only reports in a debug build. This is the question asked before that, by a caller holding a trace it cannot pair locally: a trace on no boundary region of this rank is one whose neighbour lives on another, and it is the answer here rather than an out-of-range read that must decide which.

Definition at line 137 of file BndCondPhysOp.hpp.

138 {
139 return v_HasTrace(tid);
140 }
virtual bool v_HasTrace(const size_t tid) const =0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_HasTrace().

◆ ResetStreamID()

template<typename TData >
void Nektar::MultiRegions::BndCondPhysOp< TData >::ResetStreamID ( )
inline

Refill on the default stream again, undoing SetStreamID().

Definition at line 71 of file BndCondPhysOp.hpp.

72 {
74 }
static constexpr unsigned int m_defaultStreamID
Stream the storage is refilled on unless SetStreamID() says otherwise.
unsigned int m_opStreamID
Stream the storage is refilled on. See SetStreamID().

References Nektar::MultiRegions::BndCondPhysOp< TData >::m_defaultStreamID, and Nektar::MultiRegions::BndCondPhysOp< TData >::m_opStreamID.

◆ SetStreamID()

template<typename TData >
void Nektar::MultiRegions::BndCondPhysOp< TData >::SetStreamID ( const unsigned int  streamID)
inline

Refill the storage on stream streamID, the default stream unless set. The trace flux operator sets the one it reads the storage on.

Definition at line 65 of file BndCondPhysOp.hpp.

66 {
67 m_opStreamID = streamID;
68 }

References Nektar::MultiRegions::BndCondPhysOp< TData >::m_opStreamID.

◆ UpdateBlockPtr()

template<typename TData >
TData * Nektar::MultiRegions::BndCondPhysOp< TData >::UpdateBlockPtr ( const unsigned  blk,
const unsigned int  streamID = 0 
)
inline

Writable base pointer for block blk.

For an operator that computes boundary values rather than evaluating them from the session - a wall state derived from the interior trace, say. Writing here rather than intercepting the gather keeps the flux path unchanged: consumers refetch through GetBlockPtr() on every apply and so pick the new values up without knowing where they came from.

The layout is the region's own component-major phys layout, the same one GetTraceLocation() resolves into.

Definition at line 162 of file BndCondPhysOp.hpp.

163 {
164 return v_UpdateBlockPtr(blk, streamID);
165 }
virtual TData * v_UpdateBlockPtr(const unsigned blk, const unsigned int streamID)=0

References Nektar::MultiRegions::BndCondPhysOp< TData >::v_UpdateBlockPtr().

◆ UpdateBndPhys()

template<typename TData >
void Nektar::MultiRegions::BndCondPhysOp< TData >::UpdateBndPhys ( const TData &  time = 0.0)
inline

Bring the stored values up to date for time time.

The constructor evaluates every region once, so this is only needed where a condition actually depends on time; it returns immediately otherwise. Callers on the DG path should invoke it once per step, as LinearSystemOp does with the corresponding CG operators - without it a time-dependent condition stays pinned at the value it had when the operator was built.

Consumers need do nothing to see the new values: they reach the data through GetBlockPtr(), which is refetched per apply.

Definition at line 101 of file BndCondPhysOp.hpp.

102 {
104 {
105 return;
106 }
107 v_UpdateBndPhys(time);
109 }
virtual void v_UpdateBndPhys(const TData &time)=0
bool m_bndPhysInitialised
Set once the constructor's initial evaluation has happened, so that UpdateBndPhys() can skip regions ...

References Nektar::MultiRegions::BndCondPhysOp< TData >::m_bndPhysInitialised, Nektar::MultiRegions::BndCondPhysOp< TData >::m_hasTimeDependentBndPhys, and Nektar::MultiRegions::BndCondPhysOp< TData >::v_UpdateBndPhys().

Referenced by Nektar::MultiRegions::detail::BndCondPhysOpImpl< ExecSpace, TData >::BndCondPhysOpImpl().

◆ v_GetBlockCompStride()

template<typename TData >
virtual size_t Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBlockCompStride ( const unsigned  blk) const
protectedpure virtual

◆ v_GetBlockNormals()

template<typename TData >
virtual const TData * Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBlockNormals ( const unsigned  blk)
protectedpure virtual

◆ v_GetBlockPtr()

template<typename TData >
virtual const TData * Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBlockPtr ( const unsigned  blk,
const unsigned int  streamID 
)
protectedpure virtual

◆ v_GetBndCondType()

template<typename TData >
virtual SpatialDomains::BoundaryConditionType Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBndCondType ( const unsigned  blk,
const unsigned  comp 
) const
protectedpure virtual

◆ v_GetBndUserDefined()

template<typename TData >
virtual const std::string & Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBndUserDefined ( const unsigned  blk,
const unsigned  comp 
) const
protectedpure virtual

◆ v_GetBndUserDefinedParam()

template<typename TData >
virtual bool Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetBndUserDefinedParam ( const unsigned  blk,
const unsigned  comp,
const std::string &  name,
TData &  value 
) const
protectedpure virtual

◆ v_GetNumBlocks()

template<typename TData >
virtual size_t Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetNumBlocks ( ) const
protectedpure virtual

◆ v_GetTraceLocation()

template<typename TData >
virtual void Nektar::MultiRegions::BndCondPhysOp< TData >::v_GetTraceLocation ( const size_t  tid,
unsigned &  blk,
size_t &  offset,
size_t &  compOffset 
)
protectedpure virtual

◆ v_HasTrace()

template<typename TData >
virtual bool Nektar::MultiRegions::BndCondPhysOp< TData >::v_HasTrace ( const size_t  tid) const
protectedpure virtual

◆ v_UpdateBlockPtr()

template<typename TData >
virtual TData * Nektar::MultiRegions::BndCondPhysOp< TData >::v_UpdateBlockPtr ( const unsigned  blk,
const unsigned int  streamID 
)
protectedpure virtual

◆ v_UpdateBndPhys()

template<typename TData >
virtual void Nektar::MultiRegions::BndCondPhysOp< TData >::v_UpdateBndPhys ( const TData &  time)
protectedpure virtual

Member Data Documentation

◆ m_bndPhysInitialised

template<typename TData >
bool Nektar::MultiRegions::BndCondPhysOp< TData >::m_bndPhysInitialised = false
protected

Set once the constructor's initial evaluation has happened, so that UpdateBndPhys() can skip regions that will never change.

Definition at line 265 of file BndCondPhysOp.hpp.

Referenced by Nektar::MultiRegions::BndCondPhysOp< TData >::UpdateBndPhys(), and Nektar::MultiRegions::detail::BndCondPhysOpImpl< ExecSpace, TData >::v_UpdateBndPhys().

◆ m_defaultStreamID

template<typename TData >
constexpr unsigned int Nektar::MultiRegions::BndCondPhysOp< TData >::m_defaultStreamID = 0
staticconstexprprotected

Stream the storage is refilled on unless SetStreamID() says otherwise.

Definition at line 259 of file BndCondPhysOp.hpp.

Referenced by Nektar::MultiRegions::BndCondPhysOp< TData >::ResetStreamID().

◆ m_hasTimeDependentBndPhys

template<typename TData >
bool Nektar::MultiRegions::BndCondPhysOp< TData >::m_hasTimeDependentBndPhys = false
protected

◆ m_opStreamID

template<typename TData >
unsigned int Nektar::MultiRegions::BndCondPhysOp< TData >::m_opStreamID = m_defaultStreamID
protected

◆ name

template<typename TData >
const std::string Nektar::MultiRegions::BndCondPhysOp< TData >::name = "BndCondPhys"
inlinestatic