46 namespace MultiRegions
 
   58 string GlobalLinSysIterativeStaticCond::className =
 
   60         "IterativeStaticCond", GlobalLinSysIterativeStaticCond::create,
 
   61         "Iterative static condensation.");
 
   63 string GlobalLinSysIterativeStaticCond::className2 =
 
   65         "IterativeMultiLevelStaticCond",
 
   66         GlobalLinSysIterativeStaticCond::create,
 
   67         "Iterative multi-level static condensation.");
 
   69 std::string GlobalLinSysIterativeStaticCond::storagedef =
 
   70     LibUtilities::SessionReader::RegisterDefaultSolverInfo(
 
   71         "LocalMatrixStorageStrategy", 
"Sparse");
 
   72 std::string GlobalLinSysIterativeStaticCond::storagelookupIds[3] = {
 
   73     LibUtilities::SessionReader::RegisterEnumValue(
 
   75     LibUtilities::SessionReader::RegisterEnumValue(
 
   76         "LocalMatrixStorageStrategy", 
"Non-contiguous",
 
   78     LibUtilities::SessionReader::RegisterEnumValue(
 
  101 GlobalLinSysIterativeStaticCond::GlobalLinSysIterativeStaticCond(
 
  103     const std::shared_ptr<AssemblyMap> &pLocToGloMap)
 
  111         "This constructor is only valid when using static " 
  114                  pLocToGloMap->GetGlobalSysSolnType(),
 
  115              "The local to global map is not set up for the requested " 
  127     const std::shared_ptr<AssemblyMap> &pLocToGloMap,
 
  150     int n, n_exp = 
m_expList.lock()->GetNumElmts();
 
  157     for (n = 0; n < n_exp; ++n)
 
  163                 m_precon->TransformedSchurCompl(n, cnt, mat);
 
  165             cnt += mat->GetRows();
 
  185     unsigned int nbdry            = localMat->GetRows();
 
  186     unsigned int nblks            = 1;
 
  187     unsigned int esize[1]         = {nbdry};
 
  190         nblks, nblks, esize, esize);
 
  191     schurComplBlock->SetBlock(0, 0, localMat);
 
  193     return schurComplBlock;
 
  204     boost::ignore_unused(pLocToGloMap);
 
  229                 "LocalMatrixStorageStrategy");
 
  231     switch (storageStrategy)
 
  236             size_t storageSize = 0;
 
  243             for (
int i = 0; i < nBlk; ++i)
 
  261             for (
unsigned int n = 0; n < nBlk; ++n)
 
  267                     int loc_lda      = loc_mat->GetRows();
 
  268                     int blockSize    = loc_lda * loc_lda;
 
  270                     for (
int i = 0; i < loc_lda; ++i)
 
  272                         for (
int j = 0; j < loc_lda; ++j)
 
  274                             ptr[j * loc_lda + i] = (*loc_mat)(i, j);
 
  296             std::vector<std::pair<int, int>> partitions;
 
  297             for (
int n = 0; n < 
m_schurCompl->GetNumberOfBlockRows(); ++n)
 
  300                 loc_lda = loc_mat->GetRows();
 
  303                          boost::lexical_cast<std::string>(n) +
 
  305                              "matrix block in Schur complement has " 
  308                 if (blockSize == loc_lda)
 
  310                     partitions[partitions.size() - 1].first++;
 
  315                     partitions.push_back(make_pair(1, loc_lda));
 
  325             for (
int part = 0, n = 0; part < partitions.size(); ++part)
 
  329                 for (
int k = 0; k < partitions[part].first; ++k, ++n)
 
  332                     loc_lda = loc_mat->GetRows();
 
  334                     ASSERTL1(loc_lda == partitions[part].second,
 
  335                              boost::lexical_cast<std::string>(n) +
 
  337                                  " matrix block in Schur complement has " 
  345                                     loc_mat->GetRawPtr(), 1, &matarray[0], 1);
 
  351                             loc_lda * loc_lda, loc_mat->GetRawPtr());
 
  357                 sparseStorage[part] =
 
  360                             partitions[part].first, partitions[part].first,
 
  361                             partitions[part].second, partMat, matStorage);
 
  373                         LocalMatrixStorageStrategy takes values \ 
  374                         Contiguous, Non-contiguous and Sparse");
 
  392         asmMap->GlobalToLocalBnd(pInput, 
m_wsp);
 
  394         asmMap->AssembleBnd(tmp, pOutput);
 
  399         asmMap->GlobalToLocalBnd(pInput, 
m_wsp);
 
  404             const int rows = 
m_rows[i];
 
  406                         m_wsp.get() + cnt, 1, 0.0, tmpout.get() + cnt, 1);
 
  408         asmMap->AssembleBnd(tmpout, pOutput);
 
  432         int nGloBndDofs = 
m_locToGloMap.lock()->GetNumGlobalBndCoeffs();
 
  440         int nLocBndDofs = 
m_locToGloMap.lock()->GetNumLocalBndCoeffs();
 
  446         vExchange[0] += 
Blas::Ddot(nLocBndDofs, F_bnd, 1, F_bnd, 1);
 
  447         m_expList.lock()->GetComm()->GetRowComm()->AllReduce(
 
  454         NekDouble new_rhs_mag = (vExchange[0] > 1e-6) ? vExchange[0] : 1.0;
 
  478     m_precon->DoTransformBasisToLowEnergy(pInOut);
 
  484     m_precon->DoTransformCoeffsFromLowEnergy(pInOut);
 
  490     m_precon->DoTransformCoeffsToLowEnergy(pInput, pOutput);
 
  498     const std::shared_ptr<AssemblyMap> &l2gMap)
 
  502             mkey, pExpList, pSchurCompl, pBinvD, pC, pInvD, l2gMap, 
m_precon);
 
  503     sys->Initialise(l2gMap);
 
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Nektar::ErrorUtil::NekError NekError
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
const std::weak_ptr< ExpList > m_expList
Local Matrix System.
const GlobalLinSysKey m_linSysKey
Key associated with this linear system.
PreconditionerSharedPtr CreatePrecon(AssemblyMapSharedPtr asmMap)
Create a preconditioner object from the parameters defined in the supplied assembly map.
virtual void v_DropStaticCondBlock(unsigned int n)
Releases the static condensation block matrices from NekManager of n-th expansion using the matrix ke...
void Initialise(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
PreconditionerSharedPtr m_precon
Array< OneD, int > m_map
Global to universal unique map.
NekDouble m_rhs_magnitude
dot product of rhs to normalise stopping criterion
void Set_Rhs_Magnitude(const NekVector< NekDouble > &pIn)
NekDouble m_rhs_mag_sm
cnt to how many times rhs_magnitude is called
std::vector< const double * > m_denseBlocks
Vector of pointers to local matrix data.
virtual DNekScalBlkMatSharedPtr v_GetStaticCondBlock(unsigned int n) override
Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided ...
virtual void v_CoeffsBwdTransform(Array< OneD, NekDouble > &pInOut) override
std::vector< double > m_storage
Dense storage for block Schur complement matrix.
GlobalLinSysIterativeStaticCond(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
void PrepareLocalSchurComplement()
Prepares local representation of Schur complement stored as a sparse block-diagonal matrix.
virtual ~GlobalLinSysIterativeStaticCond()
Array< OneD, unsigned int > m_rows
Ranks of local matrices.
virtual void v_InitObject() override
virtual GlobalLinSysStaticCondSharedPtr v_Recurse(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const std::shared_ptr< AssemblyMap > &locToGloMap) override
virtual void v_BasisFwdTransform(Array< OneD, NekDouble > &pInOut) override
virtual void v_AssembleSchurComplement(const std::shared_ptr< AssemblyMap > locToGloMap) override
Assemble the Schur complement matrix.
Array< OneD, NekDouble > m_scale
Scaling factors for local matrices.
DNekSmvBsrDiagBlkMatSharedPtr m_sparseSchurCompl
Sparse representation of Schur complement matrix at this level.
virtual void v_UniqueMap() override
virtual void v_PreSolve(int scLevel, Array< OneD, NekDouble > &F_bnd) override
virtual void v_CoeffsFwdTransform(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override
virtual void v_DoMatrixMultiply(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override
Perform a Shur-complement matrix multiply operation.
Describe a linear system.
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
std::weak_ptr< AssemblyMap > m_locToGloMap
Local to global map.
void SetupTopLevel(const std::shared_ptr< AssemblyMap > &locToGloMap)
Set up the storage for the Schur complement or the top level of the multi-level Schur complement.
Array< OneD, NekDouble > m_wsp
Workspace array for matrix multiplication.
DNekScalBlkMatSharedPtr m_BinvD
Block  matrix.
DNekScalBlkMatSharedPtr m_C
Block  matrix.
DNekScalBlkMatSharedPtr m_invD
Block  matrix.
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
static void Dgemv(const char &trans, const int &m, const int &n, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = A x where A[m x n].
static double Ddot(const int &n, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: output = .
@ eIterativeMultiLevelStaticCond
LocalMatrixStorageStrategy
std::shared_ptr< GlobalLinSysStaticCond > GlobalLinSysStaticCondSharedPtr
GlobalLinSysFactory & GetGlobalLinSysFactory()
std::shared_ptr< GlobalLinSysIterativeStaticCond > GlobalLinSysIterativeStaticCondSharedPtr
std::shared_ptr< Preconditioner > PreconditionerSharedPtr
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
static const NekDouble kNekUnsetDouble
static const NekDouble kNekZeroTol
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::map< CoordType, BCOEntryType > BCOMatType
Array< OneD, NekDouble > BCOEntryType
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.