|
Nektar++
|
#include <PreconditionerLowEnergy.h>
Static Public Member Functions | |
| static PreconditionerSharedPtr | create (const std::shared_ptr< GlobalLinSys > &plinsys, const std::shared_ptr< AssemblyMap > &pLocToGloMap) |
| Creates an instance of this class. | |
Static Public Attributes | |
| static std::string | className |
| Name of class. | |
Protected Member Functions | |
| void | v_InitObject () override |
| void | v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) override |
| void | v_BuildPreconditioner () override |
| Construct the low energy preconditioner from \(\mathbf{S}_{2}\). | |
| DNekScalMatSharedPtr | v_TransformedSchurCompl (int n, int offset, const std::shared_ptr< DNekScalMat > &loc_mat) override |
| Set up the transformed block matrix system. | |
| void | v_DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut) override |
| Transform the basis vector to low energy space. | |
| void | v_DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut) override |
| transform the solution coeffiicents from low energy back to the original coefficient space. | |
| void | v_DoTransformBasisFromLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override |
| Multiply by the block inverse transformation matrix This transforms the bassi from Low Energy to original basis. | |
| void | v_DoTransformCoeffsToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override |
| Multiply by the block tranposed inverse transformation matrix (R^T)^{-1} which is equivlaent to transforming coefficients to LowEnergy space. | |
Protected Member Functions inherited from Nektar::MultiRegions::Preconditioner | |
| virtual void | v_DoPreconditionerWithNonVertOutput (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const Array< OneD, NekDouble > &pNonVertOutput, Array< OneD, NekDouble > &pVertForce) |
| Apply a preconditioner to the conjugate gradient method with an output for non-vertex degrees of freedom. | |
Protected Attributes | |
| DNekBlkMatSharedPtr | m_BlkMat |
| DNekBlkMatSharedPtr | m_RBlk |
| DNekBlkMatSharedPtr | m_InvRBlk |
| SpatialDomains::EntityHolder | m_holder |
| Array< OneD, NekDouble > | m_variablePmask |
| bool | m_signChange |
| std::vector< std::pair< int, int > > | m_sameBlock |
Protected Attributes inherited from Nektar::MultiRegions::Preconditioner | |
| const std::weak_ptr< GlobalLinSys > | m_linsys |
| std::string | m_preconType |
| DNekMatSharedPtr | m_preconditioner |
| std::weak_ptr< AssemblyMap > | m_locToGloMap |
Private Types | |
| typedef std::map< LibUtilities::ShapeType, DNekScalMatSharedPtr > | ShapeToDNekMap |
| typedef std::map< LibUtilities::ShapeType, LocalRegions::Expansion3DSharedPtr > | ShapeToExpMap |
| typedef std::map< LibUtilities::ShapeType, Array< OneD, unsigned int > > | ShapeToIntArrayMap |
| typedef std::map< LibUtilities::ShapeType, Array< OneD, Array< OneD, unsigned int > > > | ShapeToIntArrayArrayMap |
Private Member Functions | |
| void | SetupBlockTransformationMatrix (void) |
| void | SetUpReferenceElements (ShapeToDNekMap &maxRmat, ShapeToExpMap &maxElmt, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR) |
| Loop expansion and determine different variants of the transformation matrix. | |
| void | SetUpPyrMaxRMat (int nummodesmax, LocalRegions::PyrExpSharedPtr &PyrExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR) |
| void | ReSetTetMaxRMat (int nummodesmax, LocalRegions::TetExpSharedPtr &TetExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR) |
| void | ReSetPrismMaxRMat (int nummodesmax, LocalRegions::PrismExpSharedPtr &PirsmExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR, bool UseTetOnly) |
| DNekMatSharedPtr | ExtractLocMat (LocalRegions::Expansion3DSharedPtr &locExp, DNekScalMatSharedPtr &maxRmat, LocalRegions::Expansion3DSharedPtr &expMax, Array< OneD, unsigned int > &vertMapMaxR, Array< OneD, Array< OneD, unsigned int > > &edgeMapMaxR) |
| void | CreateVariablePMask (void) |
| SpatialDomains::TetGeomUniquePtr | CreateRefTetGeom (void) |
| Sets up the reference tretrahedral element needed to construct a low energy basis. | |
| SpatialDomains::PyrGeomUniquePtr | CreateRefPyrGeom (void) |
| Sets up the reference prismatic element needed to construct a low energy basis mapping arrays. | |
| SpatialDomains::PrismGeomUniquePtr | CreateRefPrismGeom (void) |
| Sets up the reference prismatic element needed to construct a low energy basis. | |
| SpatialDomains::HexGeomUniquePtr | CreateRefHexGeom (void) |
| Sets up the reference hexahedral element needed to construct a low energy basis. | |
This class implements low energy preconditioning for the conjugate gradient matrix solver.
Definition at line 51 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 121 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 124 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 129 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 126 of file PreconditionerLowEnergy.h.
| Nektar::MultiRegions::PreconditionerLowEnergy::PreconditionerLowEnergy | ( | const std::shared_ptr< GlobalLinSys > & | plinsys, |
| const AssemblyMapSharedPtr & | pLocToGloMap | ||
| ) |
Definition at line 65 of file PreconditionerLowEnergy.cpp.
|
inlineoverride |
Definition at line 74 of file PreconditionerLowEnergy.h.
|
inlinestatic |
Creates an instance of this class.
Definition at line 55 of file PreconditionerLowEnergy.h.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
|
private |
Sets up the reference hexahedral element needed to construct a low energy basis.
Definition at line 1575 of file PreconditionerLowEnergy.cpp.
References Nektar::ObjPoolManager< DataType >::AllocateUniquePtr(), m_holder, Nektar::SpatialDomains::EntityHolder::m_pointVec, Nektar::SpatialDomains::EntityHolder::m_quadVec, and Nektar::SpatialDomains::EntityHolder::m_segVec.
Referenced by SetUpReferenceElements().
|
private |
Sets up the reference prismatic element needed to construct a low energy basis.
Definition at line 1282 of file PreconditionerLowEnergy.cpp.
References Nektar::ObjPoolManager< DataType >::AllocateUniquePtr(), m_holder, Nektar::SpatialDomains::EntityHolder::m_pointVec, Nektar::SpatialDomains::EntityHolder::m_quadVec, Nektar::SpatialDomains::EntityHolder::m_segVec, Nektar::SpatialDomains::EntityHolder::m_triVec, and tinysimd::sqrt().
Referenced by SetUpReferenceElements().
|
private |
Sets up the reference prismatic element needed to construct a low energy basis mapping arrays.
Definition at line 1391 of file PreconditionerLowEnergy.cpp.
References Nektar::ObjPoolManager< DataType >::AllocateUniquePtr(), m_holder, Nektar::SpatialDomains::EntityHolder::m_quadVec, Nektar::SpatialDomains::EntityHolder::m_segVec, Nektar::SpatialDomains::EntityHolder::m_triVec, and tinysimd::sqrt().
Referenced by SetUpReferenceElements().
|
private |
Sets up the reference tretrahedral element needed to construct a low energy basis.
Definition at line 1489 of file PreconditionerLowEnergy.cpp.
References Nektar::ObjPoolManager< DataType >::AllocateUniquePtr(), m_holder, Nektar::SpatialDomains::EntityHolder::m_pointVec, Nektar::SpatialDomains::EntityHolder::m_segVec, Nektar::SpatialDomains::EntityHolder::m_triVec, and tinysimd::sqrt().
Referenced by SetUpReferenceElements().
Create the mask array
Definition at line 1255 of file PreconditionerLowEnergy.cpp.
References Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_signChange, m_variablePmask, and sign.
Referenced by v_InitObject().
|
private |
Definition at line 2317 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, and Nektar::eFULL.
Referenced by SetupBlockTransformationMatrix().
|
private |
Definition at line 2101 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eFULL, Nektar::LibUtilities::eHexahedron, Nektar::LibUtilities::ePrism, and Nektar::LibUtilities::eTetrahedron.
Referenced by SetUpReferenceElements().
|
private |
Definition at line 2043 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eFULL, Nektar::LibUtilities::eHexahedron, and Nektar::LibUtilities::eTetrahedron.
Referenced by SetUpReferenceElements().
Set a block transformation matrices for each element type. These are needed in routines that transform the schur complement matrix to and from the low energy basis.
Definition at line 939 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::StdRegions::StdExpansion::DetShapeType(), Nektar::eDIAGONAL, ExtractLocMat(), m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_sameBlock, and SetUpReferenceElements().
Referenced by v_InitObject().
|
private |
Definition at line 1878 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eFULL, Nektar::LibUtilities::eHexahedron, Nektar::LibUtilities::ePyramid, and Nektar::LibUtilities::eTetrahedron.
Referenced by SetUpReferenceElements().
|
private |
Loop expansion and determine different variants of the transformation matrix.
Sets up multiple reference elements based on the element expansion.
Definition at line 1662 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), CreateRefHexGeom(), CreateRefPrismGeom(), CreateRefPyrGeom(), CreateRefTetGeom(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eHexahedron, Nektar::StdRegions::eMass, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::LibUtilities::eModified_C, Nektar::LibUtilities::eModifiedPyr_C, Nektar::StdRegions::ePreconR, Nektar::StdRegions::ePreconRMass, Nektar::LibUtilities::ePrism, Nektar::LibUtilities::ePyramid, Nektar::LibUtilities::eTetrahedron, Nektar::MultiRegions::GlobalMatrixKey::GetConstFactors(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::SpatialDomains::EntityHolder::m_hexVec, m_holder, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::SpatialDomains::EntityHolder::m_prismVec, Nektar::SpatialDomains::EntityHolder::m_pyrVec, Nektar::SpatialDomains::EntityHolder::m_tetVec, tinysimd::max(), Nektar::LibUtilities::ReduceMax, ReSetPrismMaxRMat(), ReSetTetMaxRMat(), SetUpPyrMaxRMat(), and Nektar::LibUtilities::SIZE_ShapeType.
Referenced by SetupBlockTransformationMatrix().
|
overrideprotectedvirtual |
Construct the low energy preconditioner from \(\mathbf{S}_{2}\).
\[\mathbf{M}^{-1}=\left[\begin{array}{ccc} Diag[(\mathbf{S_{2}})_{vv}] & & \\ & (\mathbf{S}_{2})_{eb} & \\ & & (\mathbf{S}_{2})_{fb} \end{array}\right] \]
where \(\mathbf{R}\) is the transformation matrix and \(\mathbf{S}_{2}\) the Schur complement of the modified basis, given by
\[\mathbf{S}_{2}=\mathbf{R}\mathbf{S}_{1}\mathbf{R}^{T}\]
where \(\mathbf{S}_{1}\) is the local schur complement matrix for each element.
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 115 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL1, Vmath::Assmb(), Nektar::MultiRegions::DeterminePeriodicFaceOrient(), Nektar::eDIAGONAL, Nektar::SpatialDomains::eDirichlet, Nektar::eFULL, Gs::Free(), Gs::Gather(), Nektar::StdRegions::StdExpansion3D::GetEdgeNcoeffs(), Nektar::SpatialDomains::Geometry::GetEid(), Nektar::SpatialDomains::Geometry::GetFid(), Nektar::LocalRegions::Expansion::GetGeom(), Nektar::StdRegions::StdExpansion3D::GetNedges(), Gs::gs_add, Gs::gs_min, Gs::Init(), m_BlkMat, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_variablePmask, tinysimd::max(), tinysimd::min(), Nektar::StdRegions::StdExpansion::NumBndryCoeffs(), Nektar::LibUtilities::ReduceMax, and Nektar::Transpose().
|
overrideprotectedvirtual |
Apply the low energy preconditioner during the conjugate gradient routine
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 915 of file PreconditionerLowEnergy.cpp.
References ASSERTL0, Nektar::eWrapper, and Nektar::MultiRegions::Preconditioner::m_locToGloMap.
|
overrideprotectedvirtual |
Multiply by the block inverse transformation matrix This transforms the bassi from Low Energy to original basis.
Note; not typically required
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1130 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and m_sameBlock.
|
overrideprotectedvirtual |
Transform the basis vector to low energy space.
As the conjugate gradient system is solved for the low energy basis, the solution vector \(\mathbf{x}\) must be transformed to the low energy basis i.e. \(\overline{\mathbf{x}}=\mathbf{R}\mathbf{x}\).
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1054 of file PreconditionerLowEnergy.cpp.
References Blas::Dgemm(), Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_sameBlock, m_variablePmask, and Vmath::Vmul().
|
overrideprotectedvirtual |
transform the solution coeffiicents from low energy back to the original coefficient space.
After the conjugate gradient routine the output vector is in the low energy basis and must be trasnformed back to the original basis in order to get the correct solution out. the solution vector i.e. \(\mathbf{x}=\mathbf{R^{T}}\mathbf{\overline{x}}\).
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1092 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_sameBlock, m_variablePmask, and Vmath::Vmul().
|
overrideprotectedvirtual |
Multiply by the block tranposed inverse transformation matrix (R^T)^{-1} which is equivlaent to transforming coefficients to LowEnergy space.
In JCP 2001 paper on low energy this is seen as (C^T)^{-1}
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1168 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and m_sameBlock.
|
overrideprotectedvirtual |
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 72 of file PreconditionerLowEnergy.cpp.
References ASSERTL0, CreateVariablePMask(), Nektar::MultiRegions::eIterativeStaticCond, Nektar::MultiRegions::ePETScStaticCond, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and SetupBlockTransformationMatrix().
|
overrideprotectedvirtual |
Set up the transformed block matrix system.
Sets up a block elemental matrix in which each of the block matrix is the low energy equivalent i.e. \(\mathbf{S}_{2}=\mathbf{R}\mathbf{S}_{1}\mathbf{R}^{T}\)
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1206 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eFULL, Nektar::MultiRegions::Preconditioner::m_linsys, m_RBlk, m_variablePmask, and Nektar::Transpose().
|
static |
Name of class.
Registers the class with the Factory.
Definition at line 67 of file PreconditionerLowEnergy.h.
|
protected |
Definition at line 79 of file PreconditionerLowEnergy.h.
Referenced by v_BuildPreconditioner().
|
protected |
Definition at line 82 of file PreconditionerLowEnergy.h.
Referenced by CreateRefHexGeom(), CreateRefPrismGeom(), CreateRefPyrGeom(), CreateRefTetGeom(), and SetUpReferenceElements().
|
protected |
Definition at line 81 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoTransformBasisFromLowEnergy(), and v_DoTransformCoeffsToLowEnergy().
|
protected |
Definition at line 80 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_BuildPreconditioner(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_TransformedSchurCompl().
|
protected |
Definition at line 90 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoTransformBasisFromLowEnergy(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_DoTransformCoeffsToLowEnergy().
|
protected |
Definition at line 86 of file PreconditionerLowEnergy.h.
Referenced by CreateVariablePMask().
Definition at line 84 of file PreconditionerLowEnergy.h.
Referenced by CreateVariablePMask(), v_BuildPreconditioner(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_TransformedSchurCompl().