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 Attributes | |
DNekBlkMatSharedPtr | m_BlkMat |
DNekBlkMatSharedPtr | m_RBlk |
DNekBlkMatSharedPtr | m_InvRBlk |
Array< OneD, NekDouble > | m_locToGloSignMult |
Array< OneD, NekDouble > | m_multiplicity |
Array< OneD, int > | m_map |
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::ExpansionSharedPtr > | 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 (StdRegions::StdExpansionSharedPtr &locExp, DNekScalMatSharedPtr &maxRmat, LocalRegions::ExpansionSharedPtr &expMax, Array< OneD, unsigned int > &vertMapMaxR, Array< OneD, Array< OneD, unsigned int > > &edgeMapMaxR) |
void | CreateMultiplicityMap (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_DoTransformToLowEnergy (Array< OneD, NekDouble > &pInOut, int offset) |
Transform the solution vector vector to low energy. More... | |
virtual void | v_DoTransformToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Transform the solution vector to low energy form. More... | |
virtual void | v_DoTransformFromLowEnergy (Array< OneD, NekDouble > &pInOut) |
transform the solution vector from low energy back to the original basis. More... | |
virtual void | v_DoMultiplybyInverseTransformationMatrix (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Multiply by the block inverse transformation matrix. More... | |
virtual void | v_DoMultiplybyInverseTransposedTransformationMatrix (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Multiply by the block tranposed inverse transformation matrix. More... | |
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... | |
Additional Inherited Members |
This class implements low energy preconditioning for the conjugate gradient matrix solver.
Definition at line 53 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 98 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 100 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 105 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 102 of file PreconditionerLowEnergy.h.
Nektar::MultiRegions::PreconditionerLowEnergy::PreconditionerLowEnergy | ( | const std::shared_ptr< GlobalLinSys > & | plinsys, |
const AssemblyMapSharedPtr & | pLocToGloMap | ||
) |
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.
Create the inverse multiplicity map.
Definition at line 1441 of file PreconditionerLowEnergy.cpp.
References CG_Iterations::loc, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_locToGloSignMult, m_multiplicity, m_signChange, Vmath::Sdiv(), and sign.
Referenced by v_InitObject().
|
private |
Sets up the reference hexahedral element needed to construct a low energy basis.
Definition at line 1767 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 1517 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 mapping arrays.
Definition at line 1599 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
Referenced by SetUpReferenceElements().
|
private |
Sets up the reference tretrahedral element needed to construct a low energy basis.
Definition at line 1683 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr().
Referenced by SetUpReferenceElements().
|
private |
Definition at line 2458 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, and Nektar::eFULL.
Referenced by ReSetPrismMaxRMat(), and SetupBlockTransformationMatrix().
|
private |
Definition at line 2253 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eFULL, Nektar::LibUtilities::eHexahedron, Nektar::LibUtilities::ePrism, Nektar::LibUtilities::eTetrahedron, and ExtractLocMat().
Referenced by SetUpReferenceElements().
|
private |
Definition at line 2194 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 957 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), 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 2058 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 1845 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(), Nektar::StdRegions::StdExpansion::as(), ASSERTL1, Vmath::Assmb(), Nektar::MultiRegions::DeterminePeriodicFaceOrient(), Nektar::eDIAGONAL, Nektar::SpatialDomains::eDirichlet, Nektar::eFULL, Gs::Gather(), 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_locToGloSignMult, m_RBlk, m_signChange, Nektar::LibUtilities::ReduceMax, and Nektar::Transpose().
|
privatevirtual |
Multiply by the block inverse transformation matrix.
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1258 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), Nektar::eWrapper, Vmath::Gathr(), m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_locToGloSignMult, m_map, m_sameBlock, and Vmath::Vcopy().
|
privatevirtual |
Multiply by the block tranposed inverse transformation matrix.
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 1321 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), Nektar::eWrapper, m_InvRBlk, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_map, m_multiplicity, m_sameBlock, v_TransformedSchurCompl(), and Vmath::Vmul().
|
privatevirtual |
Apply the low energy preconditioner during the conjugate gradient routine
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 936 of file PreconditionerLowEnergy.cpp.
References Nektar::eWrapper, and Nektar::MultiRegions::Preconditioner::m_locToGloMap.
|
privatevirtual |
transform the solution vector from low energy back to the original basis.
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 1202 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Vmath::Assmb(), Blas::Dgemm(), Nektar::eWrapper, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_locToGloSignMult, m_map, m_RBlk, m_sameBlock, and Vmath::Vcopy().
|
privatevirtual |
Transform the solution vector vector to low energy.
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 1076 of file PreconditionerLowEnergy.cpp.
References Blas::Dgemm(), Nektar::eWrapper, Vmath::Gathr(), Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_locToGloSignMult, m_map, m_RBlk, m_sameBlock, and Vmath::Vcopy().
|
privatevirtual |
Transform the solution vector to low energy form.
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 1134 of file PreconditionerLowEnergy.cpp.
References ASSERTL1, Blas::Dgemm(), Nektar::eWrapper, Vmath::Gathr(), Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_locToGloSignMult, m_map, m_RBlk, m_sameBlock, and Vmath::Vcopy().
|
privatevirtual |
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 74 of file PreconditionerLowEnergy.cpp.
References ASSERTL0, CreateMultiplicityMap(), 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 1382 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::eFULL, Nektar::MultiRegions::Preconditioner::m_linsys, m_locToGloSignMult, m_RBlk, m_signChange, and Nektar::Transpose().
Referenced by v_DoMultiplybyInverseTransposedTransformationMatrix().
|
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_DoMultiplybyInverseTransformationMatrix(), and v_DoMultiplybyInverseTransposedTransformationMatrix().
Definition at line 83 of file PreconditionerLowEnergy.h.
Referenced by CreateMultiplicityMap(), v_BuildPreconditioner(), v_DoMultiplybyInverseTransformationMatrix(), v_DoTransformFromLowEnergy(), v_DoTransformToLowEnergy(), and v_TransformedSchurCompl().
Definition at line 85 of file PreconditionerLowEnergy.h.
Referenced by v_DoMultiplybyInverseTransformationMatrix(), v_DoMultiplybyInverseTransposedTransformationMatrix(), v_DoTransformFromLowEnergy(), and v_DoTransformToLowEnergy().
Definition at line 84 of file PreconditionerLowEnergy.h.
Referenced by CreateMultiplicityMap(), and v_DoMultiplybyInverseTransposedTransformationMatrix().
|
protected |
Definition at line 79 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_BuildPreconditioner(), v_DoTransformFromLowEnergy(), v_DoTransformToLowEnergy(), and v_TransformedSchurCompl().
|
protected |
Definition at line 91 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoMultiplybyInverseTransformationMatrix(), v_DoMultiplybyInverseTransposedTransformationMatrix(), v_DoTransformFromLowEnergy(), and v_DoTransformToLowEnergy().
|
protected |
Definition at line 87 of file PreconditionerLowEnergy.h.
Referenced by CreateMultiplicityMap(), v_BuildPreconditioner(), and v_TransformedSchurCompl().