|
Nektar++
|
A fused element-local operator against the separate operators it replaces, for the flux policy Policy, on the mesh of the derived fixture with its expansions replaced: every element of the given expansion type, number of modes and number of points per direction.
More...
#include <TestFusedElmt.hpp>
Public Types | |
| using | TData = double |
| using | PhysField = Field< TData, FieldState::Phys > |
| using | FusedElmtOp = std::conditional_t< VISCOUS, SolverCore::AdvDiffFusedElmtOp< TData >, SolverCore::AdvectionFusedElmtOp< TData > > |
Public Member Functions | |
| TestFusedElmt ()=default | |
| bool | RunExpansion (const SpatialDomains::ExpansionType type, const int nmodes, const int npts, const TData tol) |
Run one expansion: type with nmodes modes and, when positive, npts points per direction (the type's own otherwise). | |
Public Member Functions inherited from TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField > | |
| TestOp ()=default | |
| virtual | ~TestOp () |
| void | Configure (void) |
| void | Configure3DH1 (const unsigned int nhomo=1) |
| void | Configure3DH2 (const unsigned int nhomoY=1, const unsigned int nhomoZ=1) |
| void | SetSession (void) |
| void | SetExpList (void) |
| void | SetExpList3DH1 (const unsigned int nhomo=1) |
| void | SetExpList3DH2 (const unsigned int nhomoY=1, const unsigned int nhomoZ=1) |
| virtual void | SetFixture (const unsigned int nhomo) |
| virtual bool | Compare (double tol) |
| Compare this field to another field, with absolute tolerance tol. The two must have the same blocks and components; their interleave widths may differ. | |
Static Public Attributes | |
| static constexpr unsigned int | NDIM = Policy::NDIM |
| static constexpr unsigned int | NVAR = Policy::NVAR |
| static constexpr unsigned int | NAUX = Policy::NAUX |
Protected Types | |
| enum class | GradTraceList { None , EveryOther , All } |
| Which elements of each block a variant writes the gradient trace of. More... | |
Protected Member Functions | |
| bool | HasDeformedQuad () |
| Whether the mesh has a deformed quadrilateral element. | |
| bool | DefaultImplementation (const SpatialDomains::ExpansionType type, const int nmodes) |
| Whether the operator, created on a session that names no implementation, takes the default of each block (MultiRegions::ElmtOp::GetOpImpl()): it exists exactly where the default of every block, read from the default implementation table, has a block operator of this family, which is SumFac on Serial and AVX and SumFacTOP on Device. | |
| bool | FitsDeviceBlock (const std::string &exec) const |
Whether every element has no more points than a fused thread block may have threads on exec (SolverCore::fusedElmtMaxBlockSize). | |
| void | SetExpansions (const SpatialDomains::ExpansionType type, const int nmodes, const int npts) |
Read the mesh and give every element type with nmodes modes and npts points, then build the expansion list. | |
| void | StateValues (const size_t npts) |
The state and the auxiliary fields, every entry different: a positive density and pressure, a velocity of order one and an auxiliary field near one, so that the fluxes are those of a physical state. npts entries per component. | |
| void | Reference () |
| The separate chain, in the execution space under test, from the inputs StateValues() makes. | |
| std::vector< std::vector< unsigned int > > | GradTraceElements (const GradTraceList list) const |
The listed elements of each block for list. | |
| bool | RunVariant (FusedElmtOp &op, const bool interleaved, const GradTraceList list, const TData tol) |
| One variant: the fused operator from the inputs the chain took. | |
| std::vector< TData > | GradTraceExpected (const std::vector< std::vector< unsigned int > > &elements, const std::vector< BlockAttributes< FieldState::Phys > > &traceAttr, PhysField &gradTrace) const |
| The chain's gradient trace of the listed elements, laid out as the compact gradient trace field's ToVector() returns it. | |
Static Protected Member Functions | |
| static std::vector< std::string > | Components () |
| static bool | Matches (const std::string &what, const std::vector< TData > &out, const std::vector< TData > &expected, const TData tol) |
Whether out matches expected within tol times the largest entry of expected, or times machine epsilon when that is smaller: the inputs are of order one, so an output below epsilon is zero up to round-off (the gradient of a one-mode expansion on a collapsed shape). | |
Protected Attributes | |
| std::vector< TData > | m_stateValues |
| The inputs, laid out as Field::ToVector() returns them. | |
| std::vector< TData > | m_auxValues |
| std::vector< TData > | m_traceRef |
| The chain's outputs, laid out likewise. | |
| std::vector< TData > | m_normViscRef |
| std::vector< TData > | m_outRef |
| std::vector< TData > | m_gradTraceRef |
Protected Attributes inherited from TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField > | |
| std::string | meshName |
| Field< double, stateIn > * | fixt_in |
| Field< double, stateOut > * | fixt_out |
| Field< double, stateIn > * | fixt_out_2 |
| Field< double, stateOut > * | fixt_expected |
| std::shared_ptr< MultiRegions::ExpList > | fixt_explist |
| LibUtilities::SessionReaderSharedPtr | session |
Additional Inherited Members | |
Static Public Member Functions inherited from TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField > | |
| static void | MixInterleaveWidths (TField &field) |
Put the blocks of field at alternating interleave widths, the execution space's vector width on even blocks and 1 on odd ones, reshaping the data in place: a field whose blocks differ in width, for an operator that must read any mix, such as the trace flux, which addresses each trace at the width of the element block it lies in. On Serial every width is 1 and nothing changes. | |
A fused element-local operator against the separate operators it replaces, for the flux policy Policy, on the mesh of the derived fixture with its expansions replaced: every element of the given expansion type, number of modes and number of points per direction.
The operator is the advection one (SolverCore::AdvectionFusedElmtOp) or, for VISCOUS, the advection-diffusion one (SolverCore::AdvDiffFusedElmtOp). The separate chain is PhysTraceExtract for the state trace; for the advection-diffusion operator PhysDeriv for the gradient; the policy evaluated point by point for the fluxes; IProductWRTDerivBase with scale -1 for the derivative inner products; and for the advection-diffusion operator PhysTraceExtract::ApplyNormalComponent() of the viscous flux for the normal viscous flux on the traces, and PhysTraceExtract of the gradient for the gradient trace. Each case is run with the fields at width 1 and, where the execution space interleaves, at its vector width, and for the advection-diffusion operator with a gradient trace on every other element and on every element.
| Policy | The flux policy (TestFusedElmtPolicies.hpp). |
| VISCOUS | Test the advection-diffusion operator rather than the advection one. |
Definition at line 81 of file TestFusedElmt.hpp.
| using TestFusedElmt< Policy, VISCOUS >::FusedElmtOp = std::conditional_t<VISCOUS, SolverCore::AdvDiffFusedElmtOp<TData>, SolverCore::AdvectionFusedElmtOp<TData> > |
Definition at line 92 of file TestFusedElmt.hpp.
| using TestFusedElmt< Policy, VISCOUS >::PhysField = Field<TData, FieldState::Phys> |
Definition at line 86 of file TestFusedElmt.hpp.
| using TestFusedElmt< Policy, VISCOUS >::TData = double |
Definition at line 85 of file TestFusedElmt.hpp.
|
strongprotected |
Which elements of each block a variant writes the gradient trace of.
| Enumerator | |
|---|---|
| None | |
| EveryOther | |
| All | |
Definition at line 148 of file TestFusedElmt.hpp.
|
default |
|
inlinestaticprotected |
Definition at line 160 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::NVAR.
Referenced by TestFusedElmt< Policy, VISCOUS >::DefaultImplementation(), TestFusedElmt< Policy, VISCOUS >::Reference(), and TestFusedElmt< Policy, VISCOUS >::RunExpansion().
|
inlineprotected |
Whether the operator, created on a session that names no implementation, takes the default of each block (MultiRegions::ElmtOp::GetOpImpl()): it exists exactly where the default of every block, read from the default implementation table, has a block operator of this family, which is SumFac on Serial and AVX and SumFacTOP on Device.
| type | The expansion type of every element. |
| nmodes | The number of modes of every element. |
Definition at line 208 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::Components(), Nektar::LibUtilities::SessionReader::CreateInstance(), TestFusedElmt< Policy, VISCOUS >::FitsDeviceBlock(), TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist, Nektar::MultiRegions::GetCollections(), Nektar::MultiRegions::Operator< TData >::GetDefaultOpImpl(), TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::meshName, TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::session, and TestFusedElmt< Policy, VISCOUS >::SetExpansions().
|
inlineprotected |
Whether every element has no more points than a fused thread block may have threads on exec (SolverCore::fusedElmtMaxBlockSize).
Definition at line 254 of file TestFusedElmt.hpp.
References TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist.
Referenced by TestFusedElmt< Policy, VISCOUS >::DefaultImplementation(), and TestFusedElmt< Policy, VISCOUS >::RunExpansion().
|
inlineprotected |
The listed elements of each block for list.
Definition at line 447 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::All, and TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist.
Referenced by TestFusedElmt< Policy, VISCOUS >::RunVariant().
|
inlineprotected |
The chain's gradient trace of the listed elements, laid out as the compact gradient trace field's ToVector() returns it.
Definition at line 590 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::m_gradTraceRef, TestFusedElmt< Policy, VISCOUS >::NDIM, TestFusedElmt< Policy, VISCOUS >::NVAR, and Nektar::LibUtilities::Field< TData, TState >::size().
Referenced by TestFusedElmt< Policy, VISCOUS >::RunVariant().
|
inlineprotected |
Whether the mesh has a deformed quadrilateral element.
Order 0 skips such meshes: with one Gauss point per direction the trace normals of a deformed quadrilateral are wrong in LocalRegions::QuadExp::v_ComputeTraceNormal, which reads past its edge array.
Definition at line 178 of file TestFusedElmt.hpp.
References Nektar::SpatialDomains::eDeformed, graph, Nektar::SpatialDomains::MeshGraphIO::Read(), TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::session, and TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::SetSession().
|
inlinestaticprotected |
Whether out matches expected within tol times the largest entry of expected, or times machine epsilon when that is smaller: the inputs are of order one, so an output below epsilon is zero up to round-off (the gradient of a one-mode expansion on a collapsed shape).
Definition at line 632 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::RunVariant().
|
inlineprotected |
The separate chain, in the execution space under test, from the inputs StateValues() makes.
Definition at line 327 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::Components(), Nektar::MultiRegions::IProductWRTDerivBaseOp< TFieldOut, TData >::Create(), Nektar::MultiRegions::PhysDerivOp< TData >::Create(), Nektar::MultiRegions::PhysTraceExtractOp< TData >::Create(), TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist, grad, TestFusedElmt< Policy, VISCOUS >::m_auxValues, TestFusedElmt< Policy, VISCOUS >::m_gradTraceRef, TestFusedElmt< Policy, VISCOUS >::m_normViscRef, TestFusedElmt< Policy, VISCOUS >::m_outRef, TestFusedElmt< Policy, VISCOUS >::m_stateValues, TestFusedElmt< Policy, VISCOUS >::m_traceRef, TestFusedElmt< Policy, VISCOUS >::NAUX, TestFusedElmt< Policy, VISCOUS >::NDIM, TestFusedElmt< Policy, VISCOUS >::NVAR, TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::session, and TestFusedElmt< Policy, VISCOUS >::StateValues().
Referenced by TestFusedElmt< Policy, VISCOUS >::RunExpansion().
|
inline |
Run one expansion: type with nmodes modes and, when positive, npts points per direction (the type's own otherwise).
tol, relative to the largest entry of each reference. Definition at line 105 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::All, TestFusedElmt< Policy, VISCOUS >::Components(), TestFusedElmt< Policy, VISCOUS >::EveryOther, TestFusedElmt< Policy, VISCOUS >::FitsDeviceBlock(), TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist, TestFusedElmt< Policy, VISCOUS >::None, TestFusedElmt< Policy, VISCOUS >::Reference(), TestFusedElmt< Policy, VISCOUS >::RunVariant(), TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::session, TestFusedElmt< Policy, VISCOUS >::SetExpansions(), and TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::SetSession().
|
inlineprotected |
One variant: the fused operator from the inputs the chain took.
Definition at line 467 of file TestFusedElmt.hpp.
References TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist, TestFusedElmt< Policy, VISCOUS >::GradTraceElements(), TestFusedElmt< Policy, VISCOUS >::GradTraceExpected(), TestFusedElmt< Policy, VISCOUS >::m_auxValues, TestFusedElmt< Policy, VISCOUS >::m_normViscRef, TestFusedElmt< Policy, VISCOUS >::m_outRef, TestFusedElmt< Policy, VISCOUS >::m_stateValues, TestFusedElmt< Policy, VISCOUS >::m_traceRef, TestFusedElmt< Policy, VISCOUS >::Matches(), TestFusedElmt< Policy, VISCOUS >::NAUX, TestFusedElmt< Policy, VISCOUS >::NDIM, TestFusedElmt< Policy, VISCOUS >::None, TestFusedElmt< Policy, VISCOUS >::NVAR, and Nektar::LibUtilities::Field< TData, TState >::ReshapeStorage().
Referenced by TestFusedElmt< Policy, VISCOUS >::RunExpansion().
|
inlineprotected |
Read the mesh and give every element type with nmodes modes and npts points, then build the expansion list.
Definition at line 272 of file TestFusedElmt.hpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::MeshGraph::DefineBasisKeyFromExpansionType(), Nektar::Collections::eNoCollection, TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::fixt_explist, graph, Nektar::SpatialDomains::MeshGraphIO::Read(), and TestOp< double, FieldState::Phys, FieldState::Phys, MultiRegions::DisContField >::session.
Referenced by TestFusedElmt< Policy, VISCOUS >::DefaultImplementation(), and TestFusedElmt< Policy, VISCOUS >::RunExpansion().
|
inlineprotected |
The state and the auxiliary fields, every entry different: a positive density and pressure, a velocity of order one and an auxiliary field near one, so that the fluxes are those of a physical state. npts entries per component.
Definition at line 298 of file TestFusedElmt.hpp.
References TestFusedElmt< Policy, VISCOUS >::m_auxValues, TestFusedElmt< Policy, VISCOUS >::m_stateValues, TestFusedElmt< Policy, VISCOUS >::NAUX, TestFusedElmt< Policy, VISCOUS >::NDIM, and TestFusedElmt< Policy, VISCOUS >::NVAR.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference().
|
protected |
Definition at line 156 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference(), TestFusedElmt< Policy, VISCOUS >::RunVariant(), and TestFusedElmt< Policy, VISCOUS >::StateValues().
|
protected |
Definition at line 158 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::GradTraceExpected(), and TestFusedElmt< Policy, VISCOUS >::Reference().
|
protected |
Definition at line 158 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference(), and TestFusedElmt< Policy, VISCOUS >::RunVariant().
|
protected |
Definition at line 158 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference(), and TestFusedElmt< Policy, VISCOUS >::RunVariant().
|
protected |
The inputs, laid out as Field::ToVector() returns them.
Definition at line 156 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference(), TestFusedElmt< Policy, VISCOUS >::RunVariant(), and TestFusedElmt< Policy, VISCOUS >::StateValues().
|
protected |
The chain's outputs, laid out likewise.
Definition at line 158 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference(), and TestFusedElmt< Policy, VISCOUS >::RunVariant().
|
staticconstexpr |
Definition at line 90 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Reference(), TestFusedElmt< Policy, VISCOUS >::RunVariant(), and TestFusedElmt< Policy, VISCOUS >::StateValues().
|
staticconstexpr |
Definition at line 88 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::GradTraceExpected(), TestFusedElmt< Policy, VISCOUS >::Reference(), TestFusedElmt< Policy, VISCOUS >::RunVariant(), and TestFusedElmt< Policy, VISCOUS >::StateValues().
|
staticconstexpr |
Definition at line 89 of file TestFusedElmt.hpp.
Referenced by TestFusedElmt< Policy, VISCOUS >::Components(), TestFusedElmt< Policy, VISCOUS >::GradTraceExpected(), TestFusedElmt< Policy, VISCOUS >::Reference(), TestFusedElmt< Policy, VISCOUS >::RunVariant(), and TestFusedElmt< Policy, VISCOUS >::StateValues().