|
Nektar++
|
Advective trace flux for scalar transport, evaluated with a pluggable Riemann solver. More...
#include <ScalarTraceFluxOpImpl.hpp>
Public Member Functions | |
| ScalarTraceFluxOpImpl (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components) | |
| Construct the operator and size its advection-velocity storage. | |
Static Public Member Functions | |
| static std::unique_ptr< MultiRegions::Operator< TData > > | Instantiate (const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components) |
| Factory creator function. | |
Static Public Attributes | |
| static std::string | className |
| Key this operator is registered under in the OperatorFactory. Defined by the generated factory boilerplate, not in this header. | |
Protected Member Functions | |
| template<typename MemAccess , typename TField > | |
| NEK_FORCE_INLINE void | SyncTrailingBlocks (TField &field) |
Synchronise every block of field after the first. | |
| void | v_Apply (LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Phys > &flux) override |
| Evaluate the advective trace flux on the interior and boundary traces. | |
| void | v_ApplyParallel (LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Phys > &flux) override |
| Evaluate the advective trace flux on the partition-cut traces. | |
| template<unsigned TRACEDIM> | |
| NEK_FORCE_INLINE void | InteriorOp (LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Phys > &flux) |
| Evaluate the flux on every interior trace. | |
| template<unsigned TRACEDIM> | |
| NEK_FORCE_INLINE void | ParallelOp (LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Phys > &flux) |
| Evaluate the flux on every trace cut by the partitioner. | |
| template<unsigned TRACEDIM> | |
| NEK_FORCE_INLINE void | BoundaryOp (LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Phys > &flux) |
| Evaluate the flux on every Dirichlet boundary trace. | |
| template<unsigned TRACEDIM> | |
| NEK_FORCE_INLINE void | SetTraceAdvVel (LibUtilities::Field< TData, FieldState::Phys > &AdvVel) |
| Sample a volume advection velocity onto the global trace. | |
| void | v_SetTraceAdvVel (LibUtilities::Field< TData, FieldState::Phys > &AdvVel) override |
| Keep a pointer to the caller's advection velocity. | |
| void | v_BeginParallelExchange (LibUtilities::Field< TData, FieldState::Phys > &trace, const unsigned chan) override |
| Sample the advection velocity before any exchange is in flight. | |
| void | CheckTraceAdvVel () |
| Sample m_traceAdvVel onto the global trace if it has changed since the last sample, dispatching on the trace dimension. Cheap and does nothing when it has not. Called from v_BeginParallelExchange(), and from the applies for a caller that never starts an exchange. | |
Protected Attributes | |
| LibUtilities::Field< TData, FieldState::Phys > * | m_traceAdvVel = nullptr |
| The caller's advection velocity on the local trace, not owned here. Set by v_SetTraceAdvVel(); the caller keeps it alive. | |
| bool | m_gloTraceAdvVelStale = false |
| m_traceAdvVel has changed since m_gloTraceAdvVel was last sampled. | |
| LibUtilities::Field< TData, FieldState::Phys > | m_gloTraceAdvVel |
| Advection velocity sampled on the global trace, one component per coordinate direction. Filled from m_traceAdvVel by CheckTraceAdvVel(). | |
| LibUtilities::MemoryRegion< TData > | m_wsploc |
| Backing allocation for m_advVel. | |
| TData * | m_advVel |
Scratch holding the advection velocity for the block currently being processed, in the same packed layout as SolverCore::detail::TraceFluxOpImpl::m_norms. | |
Private Types | |
| using | MemSpace = typename ExecSpace::memory_space |
Advective trace flux for scalar transport, evaluated with a pluggable Riemann solver.
Supplies the flux evaluation that SolverCore::detail::TraceFluxOpImpl leaves abstract. The base class owns the trace numbering and the gather/scatter between element-local and global-trace layouts; this class walks the resulting blocks and, for each one, assembles the advection velocity and normals the Riemann solver needs before handing the two trace states to FluxKernel.
Both InteriorOp() and BoundaryOp() follow the same three steps, marked in the code: gather both sides of the trace, evaluate the flux, scatter the result back. Whether the scatter overwrites or accumulates is controlled by SolverCore::TraceFluxOp::SetAppend.
The advection velocity is supplied through SolverCore::TraceFluxOp::SetTraceAdvVel before the operator is applied. The operator keeps a non-owning pointer to the caller's field, as the other operators do for the fields they are handed, and samples it onto the global trace in m_gloTraceAdvVel the first time it is applied after the pointer is set; the sample is reused until SetTraceAdvVel() is called again.
| FluxKernel | Riemann solver, as a class template on the execution space. It must provide operator()(blksize, velComps, fluxComps, vel, norm, fwd,
bwd, flux); see UpwindSolverKernel. |
| ExecSpace | Execution space the operator runs in. |
| TData | Floating-point representation used by the field data. |
FluxKernel over a padded block. Definition at line 82 of file ScalarTraceFluxOpImpl.hpp.
|
private |
Definition at line 86 of file ScalarTraceFluxOpImpl.hpp.
|
inline |
Construct the operator and size its advection-velocity storage.
Delegates all trace numbering to SolverCore::detail::TraceFluxOpImpl, then allocates m_gloTraceAdvVel over the global trace and a scratch buffer large enough for the widest padded trace block found in either the interior or the Dirichlet boundary blocks.
| expansionList | - Expansion list the operator acts on. |
| components | - Names of the field components. |
Definition at line 100 of file ScalarTraceFluxOpImpl.hpp.
References Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_advVel, Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVel, and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_wsploc.
|
inlineprotected |
Evaluate the flux on every Dirichlet boundary trace.
As InteriorOp(), but the exterior state comes from the boundary condition operator rather than a neighbouring element, and the result is scattered to the interior element only.
| TRACEDIM | Trace dimension; must equal m_traceDim. |
| in | Physical-space scalar field. |
| flux | Trace-space output. |
Definition at line 494 of file ScalarTraceFluxOpImpl.hpp.
References ASSERTL1, Nektar::LibUtilities::Field< TData, TState >::GetBlocks(), Nektar::LibUtilities::Field< TData, TState >::GetNumComponents(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVel.
|
inlineprotected |
Sample m_traceAdvVel onto the global trace if it has changed since the last sample, dispatching on the trace dimension. Cheap and does nothing when it has not. Called from v_BeginParallelExchange(), and from the applies for a caller that never starts an exchange.
Definition at line 721 of file ScalarTraceFluxOpImpl.hpp.
References ASSERTL0, Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVelStale, and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_traceAdvVel.
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_Apply(), Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_ApplyParallel(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_BeginParallelExchange().
|
inlinestatic |
Factory creator function.
| expansionList | - Expansion list the operator acts on. |
| components | - Names of the field components. |
Definition at line 153 of file ScalarTraceFluxOpImpl.hpp.
|
inlineprotected |
Evaluate the flux on every interior trace.
For each interior block: gather the forward and backward trace states, gather the advection velocity and trace normals for the same points into m_advVel and SolverCore::detail::TraceFluxOpImpl::m_norms, apply FluxKernel, and scatter the single-valued result back to both elements.
| TRACEDIM | Trace dimension; must equal m_traceDim. |
| in | Physical-space scalar field. |
| flux | Trace-space output. |
in. Definition at line 311 of file ScalarTraceFluxOpImpl.hpp.
References ASSERTL1, Nektar::LibUtilities::Field< TData, TState >::GetBlocks(), Nektar::LibUtilities::Field< TData, TState >::GetNumComponents(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVel.
|
inlineprotected |
Evaluate the flux on every trace cut by the partitioner.
InteriorOp() for traces whose backward element is on another rank. The flux is the interior one throughout - the neighbouring state is a real state, not a boundary condition - and the only differences are that the backward side is read from the receive buffer, which SolverCore::detail::TraceFluxOpImpl::GetParallelTraces() handles, and that the result is scattered to the local element alone. The neighbour computes the same flux from the same two states and scatters it to the other element itself.
Returns immediately when there are no such traces, which is every case in serial.
| TRACEDIM | Trace dimension; must equal m_traceDim. |
| in | Physical-space scalar field. |
| flux | Trace-space output. |
Definition at line 406 of file ScalarTraceFluxOpImpl.hpp.
References ASSERTL1, Nektar::LibUtilities::Field< TData, TState >::GetBlocks(), Nektar::LibUtilities::Field< TData, TState >::GetNumComponents(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVel.
|
inlineprotected |
Sample a volume advection velocity onto the global trace.
Populates m_gloTraceAdvVel, which InteriorOp() and BoundaryOp() then read. On interior traces the two sides are averaged, so that both elements see the same velocity and the flux stays single-valued. On boundary traces the interior value is taken unchanged, since the boundary condition operator does not generally carry advection velocity data.
| TRACEDIM | Trace dimension; must equal m_traceDim. |
| AdvVel | Physical-space advection velocity, one component per coordinate direction. |
Definition at line 582 of file ScalarTraceFluxOpImpl.hpp.
References Nektar::LibUtilities::Field< TData, TState >::GetBlocks(), Nektar::LibUtilities::Field< TData, TState >::GetNumComponents(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVel.
|
inlineprotected |
Synchronise every block of field after the first.
Memory is synchronised a block at a time, while the kernels below walk a field from its first block's pointer; taking that pointer therefore leaves every later block unsynchronised. Each field is walked to its own length, since they do not share a block count: the trace normals are built as a single block.
Definition at line 189 of file ScalarTraceFluxOpImpl.hpp.
|
inlineoverrideprotected |
Evaluate the advective trace flux on the interior and boundary traces.
Zeroes flux, then dispatches to InteriorOp() and BoundaryOp() for the trace dimension determined at construction. Neither needs anything from another rank, so a caller may run this between BeginParallelExchange() and EndParallelExchange(); the partition traces are v_ApplyParallel()'s, afterwards.
| in | - Physical-space scalar field to take trace values from. |
| flux | - Trace-space output. |
Definition at line 215 of file ScalarTraceFluxOpImpl.hpp.
References Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::CheckTraceAdvVel(), Nektar::ErrorUtil::efatal, NEKERROR, and Nektar::LibUtilities::Field< TData, TState >::SetInterleaveWidth().
|
inlineoverrideprotected |
Evaluate the advective trace flux on the partition-cut traces.
Reads what BeginParallelExchange() / EndParallelExchange() delivered, so it must follow the wait; flux must be the field v_Apply() wrote, whose partition slots this fills. Does nothing at all in serial.
Definition at line 261 of file ScalarTraceFluxOpImpl.hpp.
References Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::CheckTraceAdvVel(), Nektar::ErrorUtil::efatal, and NEKERROR.
|
inlineoverrideprotected |
Sample the advection velocity before any exchange is in flight.
The sampling averages each interior trace, so a trace the partitioner cut needs its neighbour's half and performs an exchange of its own on the same channel. Doing that from Apply() would resize a channel the caller had already started an exchange on - the solution carries a different number of components - so it happens here instead, at the one entry point that runs before anything is in flight.
Definition at line 706 of file ScalarTraceFluxOpImpl.hpp.
References Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::CheckTraceAdvVel(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_BeginParallelExchange().
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_BeginParallelExchange().
|
inlineoverrideprotected |
Keep a pointer to the caller's advection velocity.
Nothing is read here: the field is sampled onto the global trace by CheckTraceAdvVel() on the next apply, so the caller must keep it alive for as long as this operator may be applied.
| AdvVel | - Physical-space advection velocity on the local trace. |
Definition at line 689 of file ScalarTraceFluxOpImpl.hpp.
References Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_gloTraceAdvVelStale, and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::m_traceAdvVel.
|
static |
Key this operator is registered under in the OperatorFactory. Defined by the generated factory boilerplate, not in this header.
Definition at line 142 of file ScalarTraceFluxOpImpl.hpp.
|
protected |
Scratch holding the advection velocity for the block currently being processed, in the same packed layout as SolverCore::detail::TraceFluxOpImpl::m_norms.
Definition at line 177 of file ScalarTraceFluxOpImpl.hpp.
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::ScalarTraceFluxOpImpl().
|
protected |
Advection velocity sampled on the global trace, one component per coordinate direction. Filled from m_traceAdvVel by CheckTraceAdvVel().
Definition at line 171 of file ScalarTraceFluxOpImpl.hpp.
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::BoundaryOp(), Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::InteriorOp(), Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::ParallelOp(), Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::ScalarTraceFluxOpImpl(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::SetTraceAdvVel().
|
protected |
m_traceAdvVel has changed since m_gloTraceAdvVel was last sampled.
Definition at line 167 of file ScalarTraceFluxOpImpl.hpp.
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::CheckTraceAdvVel(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_SetTraceAdvVel().
|
protected |
The caller's advection velocity on the local trace, not owned here. Set by v_SetTraceAdvVel(); the caller keeps it alive.
Definition at line 165 of file ScalarTraceFluxOpImpl.hpp.
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::CheckTraceAdvVel(), and Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::v_SetTraceAdvVel().
|
protected |
Backing allocation for m_advVel.
Definition at line 173 of file ScalarTraceFluxOpImpl.hpp.
Referenced by Nektar::detail::ScalarTraceFluxOpImpl< FluxKernel, ExecSpace, TData >::ScalarTraceFluxOpImpl().