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. More... | |
Static Public Attributes | |
static std::string | className |
Name of class. More... | |
Protected Member Functions | |
virtual void | v_DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut) |
Transform the basis vector to low energy space. More... | |
virtual void | v_DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut) |
transform the solution coeffiicents from low energy back to the original coefficient space. More... | |
virtual void | v_DoTransformBasisFromLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Multiply by the block inverse transformation matrix This transforms the bassi from Low Energy to original basis. More... | |
virtual void | v_DoTransformCoeffsToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Multiply by the block tranposed inverse transformation matrix (R^T)^{-1} which is equivlaent to transforming coefficients to LowEnergy space. More... | |
Protected Attributes | |
DNekBlkMatSharedPtr | m_BlkMat |
DNekBlkMatSharedPtr | m_RBlk |
DNekBlkMatSharedPtr | m_InvRBlk |
Array< OneD, NekDouble > | m_variablePmask |
bool | m_signChange |
std::vector< std::pair< int, int > > | m_sameBlock |
![]() | |
const std::weak_ptr< GlobalLinSys > | m_linsys |
PreconditionerType | m_preconType |
DNekMatSharedPtr | m_preconditioner |
std::weak_ptr< AssemblyMap > | m_locToGloMap |
LibUtilities::CommSharedPtr | m_comm |
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. More... | |
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::TetGeomSharedPtr | CreateRefTetGeom (void) |
Sets up the reference tretrahedral element needed to construct a low energy basis. More... | |
SpatialDomains::PyrGeomSharedPtr | CreateRefPyrGeom (void) |
Sets up the reference prismatic element needed to construct a low energy basis mapping arrays. More... | |
SpatialDomains::PrismGeomSharedPtr | CreateRefPrismGeom (void) |
Sets up the reference prismatic element needed to construct a low energy basis. More... | |
SpatialDomains::HexGeomSharedPtr | CreateRefHexGeom (void) |
Sets up the reference hexahedral element needed to construct a low energy basis. More... | |
virtual void | v_InitObject () |
virtual void | v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
virtual void | v_BuildPreconditioner () |
Construct the low energy preconditioner from \(\mathbf{S}_{2}\). More... | |
virtual DNekScalMatSharedPtr | v_TransformedSchurCompl (int n, int offset, const std::shared_ptr< DNekScalMat > &loc_mat) |
Set up the transformed block matrix system. More... | |
Definition at line 53 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 110 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 112 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 117 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 114 of file PreconditionerLowEnergy.h.
Nektar::MultiRegions::PreconditionerLowEnergy::PreconditionerLowEnergy | ( | const std::shared_ptr< GlobalLinSys > & | plinsys, |
const AssemblyMapSharedPtr & | pLocToGloMap | ||
) |
@class PreconditionerLowEnergy This class implements low energy preconditioning for the conjugate
gradient matrix solver.
Definition at line 67 of file PreconditionerLowEnergy.cpp.
|
inlinevirtual |
Definition at line 74 of file PreconditionerLowEnergy.h.
|
inlinestatic |
Creates an instance of this class.
Definition at line 57 of file PreconditionerLowEnergy.h.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.
|
private |
Sets up the reference hexahedral element needed to construct a low energy basis.
Definition at line 1554 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
Referenced by SetUpReferenceElements().
|
private |
Sets up the reference prismatic element needed to construct a low energy basis.
Definition at line 1304 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), 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 1386 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and tinysimd::sqrt().
Referenced by SetUpReferenceElements().
|
private |
Sets up the reference tretrahedral element needed to construct a low energy basis.
Definition at line 1470 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and tinysimd::sqrt().
Referenced by SetUpReferenceElements().
Create the inverse multiplicity map.
Definition at line 1274 of file PreconditionerLowEnergy.cpp.
References Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_signChange, m_variablePmask, and sign.
Referenced by v_InitObject().
|
private |
Definition at line 2244 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, and Nektar::eFULL.
Referenced by SetupBlockTransformationMatrix().
|
private |
Definition at line 2040 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 1981 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 946 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 1845 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 1632 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), CreateRefHexGeom(), CreateRefPrismGeom(), CreateRefPyrGeom(), CreateRefTetGeom(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGaussRadauMAlpha1Beta0, Nektar::LibUtilities::eGaussRadauMAlpha2Beta0, 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::MultiRegions::Preconditioner::m_comm, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::LibUtilities::ReduceMax, ReSetPrismMaxRMat(), ReSetTetMaxRMat(), SetUpPyrMaxRMat(), and Nektar::LibUtilities::SIZE_ShapeType.
Referenced by SetupBlockTransformationMatrix().
|
privatevirtual |
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 121 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL1, Vmath::Assmb(), Nektar::MultiRegions::DeterminePeriodicFaceOrient(), Nektar::eDIAGONAL, Nektar::SpatialDomains::eDirichlet, Nektar::eFULL, Gs::Gather(), Nektar::StdRegions::StdExpansion3D::GetEdgeNcoeffs(), Nektar::LocalRegions::Expansion::GetGeom(), Nektar::StdRegions::StdExpansion3D::GetNedges(), Gs::gs_add, Gs::gs_min, Gs::Init(), CG_Iterations::loc, m_BlkMat, Nektar::MultiRegions::Preconditioner::m_comm, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_variablePmask, Nektar::StdRegions::StdExpansion::NumBndryCoeffs(), Nektar::LibUtilities::ReduceMax, and Nektar::Transpose().
|
privatevirtual |
Apply the low energy preconditioner during the conjugate gradient routine
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 925 of file PreconditionerLowEnergy.cpp.
References Nektar::eWrapper, and Nektar::MultiRegions::Preconditioner::m_locToGloMap.
|
protectedvirtual |
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 1145 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and m_sameBlock.
|
protectedvirtual |
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 1066 of file PreconditionerLowEnergy.cpp.
References Blas::Dgemm(), Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_sameBlock, m_variablePmask, and Vmath::Vmul().
|
protectedvirtual |
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 1105 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_RBlk, m_sameBlock, m_variablePmask, and Vmath::Vmul().
|
protectedvirtual |
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 1184 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and m_sameBlock.
|
privatevirtual |
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 74 of file PreconditionerLowEnergy.cpp.
References ASSERTL0, CreateVariablePMask(), Nektar::MultiRegions::eIterativeStaticCond, Nektar::MultiRegions::ePETScStaticCond, Nektar::MultiRegions::Preconditioner::m_comm, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and SetupBlockTransformationMatrix().
|
privatevirtual |
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 1223 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 78 of file PreconditionerLowEnergy.h.
Referenced by v_BuildPreconditioner().
|
protected |
Definition at line 80 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoTransformBasisFromLowEnergy(), and v_DoTransformCoeffsToLowEnergy().
|
protected |
Definition at line 79 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_BuildPreconditioner(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_TransformedSchurCompl().
|
protected |
Definition at line 89 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoTransformBasisFromLowEnergy(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_DoTransformCoeffsToLowEnergy().
|
protected |
Definition at line 85 of file PreconditionerLowEnergy.h.
Referenced by CreateVariablePMask().
Definition at line 83 of file PreconditionerLowEnergy.h.
Referenced by CreateVariablePMask(), v_BuildPreconditioner(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_TransformedSchurCompl().