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 | |
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}\). More... | |
DNekScalMatSharedPtr | v_TransformedSchurCompl (int n, int offset, const std::shared_ptr< DNekScalMat > &loc_mat) override |
Set up the transformed block matrix system. More... | |
void | v_DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut) override |
Transform the basis vector to low energy space. More... | |
void | v_DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut) override |
transform the solution coeffiicents from low energy back to the original coefficient space. More... | |
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... | |
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... | |
Protected Member Functions inherited from Nektar::MultiRegions::Preconditioner | |
virtual DNekScalMatSharedPtr | v_TransformedSchurCompl (int offset, int bndoffset, const std::shared_ptr< DNekScalMat > &loc_mat) |
Get block elemental transposed transformation matrix \(\mathbf{R}^{T}\). More... | |
virtual void | v_InitObject () |
virtual void | v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) |
Apply a preconditioner to the conjugate gradient method. 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... | |
virtual void | v_DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut) |
Transform from original basis to low energy basis. More... | |
virtual void | v_DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut) |
Transform from low energy coeffs to orignal basis. More... | |
virtual void | v_DoTransformCoeffsToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Multiply by the block inverse transformation matrix. More... | |
virtual void | v_DoTransformBasisFromLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
Multiply by the block transposed inverse transformation matrix. More... | |
virtual void | v_BuildPreconditioner () |
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 |
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 |
This class implements low energy preconditioning for the conjugate gradient matrix solver.
Definition at line 51 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 120 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 123 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 128 of file PreconditionerLowEnergy.h.
|
private |
Definition at line 125 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(), 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 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 2273 of file PreconditionerLowEnergy.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, and Nektar::eFULL.
Referenced by SetupBlockTransformationMatrix().
|
private |
Definition at line 2057 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 1999 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 1834 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_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 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::LocalRegions::Expansion::GetGeom(), Nektar::StdRegions::StdExpansion3D::GetNedges(), Gs::gs_add, Gs::gs_min, Gs::Init(), CG_Iterations::loc, m_BlkMat, 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 915 of file PreconditionerLowEnergy.cpp.
References ASSERTL0, Nektar::eWrapper, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and Nektar::UnitTests::z().
|
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 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 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().