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_InitObject () override |
virtual void | v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override |
virtual void | v_BuildPreconditioner () override |
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) override |
Set up the transformed block matrix system. More... | |
virtual void | v_DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut) override |
Transform the basis vector to low energy space. More... | |
virtual void | v_DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut) override |
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) override |
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) override |
Multiply by the block tranposed inverse transformation matrix (R^T)^{-1} which is equivlaent to transforming coefficients to LowEnergy space. More... | |
![]() | |
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. 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 |
This class implements low energy preconditioning for the conjugate gradient matrix solver.
Definition at line 53 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 122 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 125 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 130 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 127 of file PreconditionerLowEnergy.h.
Nektar::MultiRegions::PreconditionerLowEnergy::PreconditionerLowEnergy | ( | const std::shared_ptr< GlobalLinSys > & | plinsys, |
const AssemblyMapSharedPtr & | pLocToGloMap | ||
) |
Definition at line 66 of file PreconditionerLowEnergy.cpp.
|
inlinevirtual |
Definition at line 76 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 1545 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 1282 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 1379 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 1469 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and tinysimd::sqrt().
Referenced by SetUpReferenceElements().
Create the inverse multiplicity map.
Definition at line 1252 of file PreconditionerLowEnergy.cpp.
References Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_signChange, m_variablePmask, and sign.
Referenced by v_InitObject().
|
private |
Definition at line 2271 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, and Nektar::eFULL.
Referenced by SetupBlockTransformationMatrix().
|
private |
Definition at line 2054 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 1995 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 936 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 1830 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 1622 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::MultiRegions::Preconditioner::m_comm, Nektar::MultiRegions::Preconditioner::m_linsys, 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 118 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().
|
overrideprotectedvirtual |
Apply the low energy preconditioner during the conjugate gradient routine
Reimplemented from Nektar::MultiRegions::Preconditioner.
Definition at line 917 of file PreconditionerLowEnergy.cpp.
References 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 1127 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 1051 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 1089 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 1165 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 73 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().
|
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 1203 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 69 of file PreconditionerLowEnergy.h.
|
protected |
Definition at line 81 of file PreconditionerLowEnergy.h.
Referenced by v_BuildPreconditioner().
|
protected |
Definition at line 83 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoTransformBasisFromLowEnergy(), and v_DoTransformCoeffsToLowEnergy().
|
protected |
Definition at line 82 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_BuildPreconditioner(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_TransformedSchurCompl().
|
protected |
Definition at line 91 of file PreconditionerLowEnergy.h.
Referenced by SetupBlockTransformationMatrix(), v_DoTransformBasisFromLowEnergy(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_DoTransformCoeffsToLowEnergy().
|
protected |
Definition at line 87 of file PreconditionerLowEnergy.h.
Referenced by CreateVariablePMask().
Definition at line 85 of file PreconditionerLowEnergy.h.
Referenced by CreateVariablePMask(), v_BuildPreconditioner(), v_DoTransformBasisToLowEnergy(), v_DoTransformCoeffsFromLowEnergy(), and v_TransformedSchurCompl().