Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Nektar::MultiRegions::PreconditionerLOR Class Reference

Low-order representation (LOR) preconditioner. More...

#include <PreconditionerLOR.h>

Inheritance diagram for Nektar::MultiRegions::PreconditionerLOR:
[legend]

Public Member Functions

 PreconditionerLOR (const std::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
 Constructor.
 
 ~PreconditionerLOR () override
 
- Public Member Functions inherited from Nektar::MultiRegions::Preconditioner
 Preconditioner (const std::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
 
virtual ~Preconditioner ()
 
void DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &IsLocal=false)
 
void DoAssembleLoc (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &ZeroDir)
 Apply an assembly and scatter back to lcoal array.
 
void DoPreconditionerWithNonVertOutput (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const Array< OneD, NekDouble > &pNonVertOutput, Array< OneD, NekDouble > &pVertForce=NullNekDouble1DArray)
 
void DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut)
 
void DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut)
 
void DoTransformCoeffsToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 
void DoTransformBasisFromLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 
void BuildPreconditioner ()
 
void InitObject ()
 
Array< OneD, NekDoubleAssembleStaticCondGlobalDiagonals ()
 Performs global assembly of diagonal entries to global Schur complement matrix.
 
const DNekScalBlkMatSharedPtrGetBlockTransformedSchurCompl () const
 
const DNekScalBlkMatSharedPtrGetBlockCMatrix () const
 
const DNekScalBlkMatSharedPtrGetBlockInvDMatrix () const
 
const DNekScalBlkMatSharedPtrGetBlockSchurCompl () const
 
const DNekScalBlkMatSharedPtrGetBlockTransformationMatrix () const
 
const DNekScalBlkMatSharedPtrGetBlockTransposedTransformationMatrix () const
 
DNekScalMatSharedPtr TransformedSchurCompl (int offset, int bndoffset, const std::shared_ptr< DNekScalMat > &loc_mat)
 

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.
 

Static Public Attributes

static std::string className
 Name of class.
 

Protected Member Functions

void v_InitObject () override
 
void v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) override
 Apply a preconditioner to the conjugate gradient method.
 
void v_BuildPreconditioner () override
 
- 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}\).
 
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.
 
virtual void v_DoTransformBasisToLowEnergy (Array< OneD, NekDouble > &pInOut)
 Transform from original basis to low energy basis.
 
virtual void v_DoTransformCoeffsFromLowEnergy (Array< OneD, NekDouble > &pInOut)
 Transform from low energy coeffs to orignal basis.
 
virtual void v_DoTransformCoeffsToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 Multiply by the block inverse transformation matrix.
 
virtual void v_DoTransformBasisFromLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 Multiply by the block transposed inverse transformation matrix.
 

Private Member Functions

void CreateInvMultiplicity (void)
 

Private Attributes

GlobalLinSysSharedPtr m_LORLinSys
 Linear solver for LOR system.
 
std::string m_slvType
 Solution type for LOR space, DirectFull, IterativeFull, PETScFull.
 
bool m_equiSpaced = false
 Flag that determines whether to use equispaced point distributions or GLL.
 
bool m_useSimplex = false
 Use a simplex distribution in the LOR system so that e.g. quadrilaterals are split into triangles.
 
unsigned int m_nsplit
 
SpatialDomains::MeshGraphSharedPtr m_lor_graph
 MeshGraph for the LOR system.
 
MultiRegions::ContFieldSharedPtr m_lor_field
 Field object for the LOR system.
 
unsigned int m_nDir
 Number of Dirichlet values on original mesh.
 
Array< OneD, int > m_ho2lor
 Map from high-order node numbers to LOR representation.
 
Array< OneD, NekDoublem_invMultiplicity
 Inverse of multiplicity of each global DOF in the high-order mesh.
 
Array< OneD, NekDoublem_invLinMeshMultiplicity
 Inverse of multiplicity of each global DOF in the LOR mesh.
 
bool m_verboseIter
 Whether to be verbose.
 

Static Private Attributes

static std::string lookupIds []
 
static std::string def
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::MultiRegions::Preconditioner
const std::weak_ptr< GlobalLinSysm_linsys
 
std::string m_preconType
 
DNekMatSharedPtr m_preconditioner
 
std::weak_ptr< AssemblyMapm_locToGloMap
 

Detailed Description

Low-order representation (LOR) preconditioner.

This preconditioner works by taking a high-order element and splitting into P1 elements that 'join the dots' of a quadrature distribution on the element.

This class implements LOR preconditioning for the conjugate gradient matrix solver.

Definition at line 55 of file PreconditionerLOR.h.

Constructor & Destructor Documentation

◆ PreconditionerLOR()

Nektar::MultiRegions::PreconditionerLOR::PreconditionerLOR ( const std::shared_ptr< GlobalLinSys > &  plinsys,
const AssemblyMapSharedPtr pLocToGloMap 
)

Constructor.

Definition at line 68 of file PreconditionerLOR.cpp.

71 : Preconditioner(plinsys, pLocToGloMap), m_verboseIter(false)
72{
73}
Preconditioner(const std::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)

◆ ~PreconditionerLOR()

Nektar::MultiRegions::PreconditionerLOR::~PreconditionerLOR ( )
inlineoverride

Definition at line 78 of file PreconditionerLOR.h.

79 {
80 }

Member Function Documentation

◆ create()

static PreconditionerSharedPtr Nektar::MultiRegions::PreconditionerLOR::create ( const std::shared_ptr< GlobalLinSys > &  plinsys,
const std::shared_ptr< AssemblyMap > &  pLocToGloMap 
)
inlinestatic

Creates an instance of this class.

Definition at line 59 of file PreconditionerLOR.h.

62 {
65 pLocToGloMap);
66 p->InitObject();
67 return p;
68 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Preconditioner > PreconditionerSharedPtr
std::vector< double > p(NPUPPER)

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ CreateInvMultiplicity()

void Nektar::MultiRegions::PreconditionerLOR::CreateInvMultiplicity ( void  )
private

Create inv multiplicity

Definition at line 427 of file PreconditionerLOR.cpp.

428{
429 auto asmMap = m_locToGloMap.lock();
430 unsigned nGlobal = asmMap->GetNumGlobalCoeffs();
431 unsigned nLocal = asmMap->GetNumLocalCoeffs();
432
433 // Construct a mask array
434 m_invMultiplicity = Array<OneD, NekDouble>(nGlobal, 0.0);
435
436 const Array<OneD, const int> &map = asmMap->GetLocalToGlobalMap();
437
438 for (unsigned i = 0; i < nLocal; ++i)
439 {
440 m_invMultiplicity[map[i]] += 1.0;
441 }
442
443 asmMap->UniversalAssemble(m_invMultiplicity);
444 Vmath::Sdiv(nGlobal, 1.0, m_invMultiplicity, 1, m_invMultiplicity, 1);
445
446 auto lor_nLocal = m_ho2lor.size();
447 m_invLinMeshMultiplicity = Array<OneD, NekDouble>(nLocal, 0.0);
448
449 for (unsigned i = 0; i < lor_nLocal; ++i)
450 {
452 }
453 for (unsigned i = 0; i < nLocal; ++i)
454 {
456 }
457}
std::weak_ptr< AssemblyMap > m_locToGloMap
Array< OneD, int > m_ho2lor
Map from high-order node numbers to LOR representation.
Array< OneD, NekDouble > m_invLinMeshMultiplicity
Inverse of multiplicity of each global DOF in the LOR mesh.
Array< OneD, NekDouble > m_invMultiplicity
Inverse of multiplicity of each global DOF in the high-order mesh.
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/x.
Definition Vmath.hpp:154

References m_ho2lor, m_invLinMeshMultiplicity, m_invMultiplicity, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and Vmath::Sdiv().

Referenced by v_BuildPreconditioner().

◆ v_BuildPreconditioner()

void Nektar::MultiRegions::PreconditionerLOR::v_BuildPreconditioner ( )
overrideprotectedvirtual

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 79 of file PreconditionerLOR.cpp.

80{
81 GlobalSysSolnType solvertype = m_locToGloMap.lock()->GetGlobalSysSolnType();
82
83 ASSERTL0(solvertype == eIterativeFull, "Only works for full iterative");
84
85 // Grab explist
86 auto expList = ((m_linsys.lock())->GetLocMat()).lock();
87
88 std::shared_ptr<LibUtilities::SessionReader> session =
89 expList->GetSession();
90
91 m_nsplit = expList->GetExp(0)->GetBasisNumModes(0) - 1;
92
93 std::string var = m_locToGloMap.lock()->GetVariable();
94
95 m_equiSpaced = false;
96 if (session->DefinesGlobalSysSolnInfo(var, "LORPointDistribution"))
97 {
98 if (boost::iequals("GLL", session->GetGlobalSysSolnInfo(
99 var, "LORPointDistribution")))
100 {
101 m_equiSpaced = false;
102 }
103 else if (boost::iequals("Equispaced", session->GetGlobalSysSolnInfo(
104 var, "LORPointDistribution")))
105 {
106 m_equiSpaced = true;
107 }
108 }
109
110 m_useSimplex = false;
111 if (session->DefinesGlobalSysSolnInfo(var, "LORSimplex"))
112 {
113 if (boost::iequals("True",
114 session->GetGlobalSysSolnInfo(var, "LORSimplex")))
115 {
116 m_useSimplex = true;
117 }
118 }
119
120 // Setup session !m_equispaced since true means GLL distribution
121 std::map<int, std::pair<int, std::vector<int>>> coeffmap;
122 SpatialDomains::LinearMeshGraph linear(expList->GetGraph());
123 linear.CreateLinearGraph(m_nsplit, coeffmap, !m_equiSpaced, m_useSimplex);
124 m_lor_graph = linear.GetLinearGraph();
125
126 std::string preconType;
127
128 if (session->DefinesGlobalSysSolnInfo(var, "LORSolverType"))
129 {
130 m_slvType = session->GetGlobalSysSolnInfo(var, "LORSolverType");
131 }
132 else
133 {
134 NEKERROR(
136 "Need to define LORSolverType "
137 "(DirectFull, IterativeFull, Preconditioner, PETScFull, XxtFull)"
138 "with LOR Preconditioner");
139 }
140
141 if (session->GetComm()->GetRank() == 0)
142 {
143 std::cout << "LOR Solve Type: " << m_slvType << std::endl;
144 }
145
146 std::string LinSysIterSolver;
147 if (session->DefinesGlobalSysSolnInfo(var, "LORLinSysIterSolver"))
148 {
150 session->GetGlobalSysSolnInfo(var, "LORLinSysIterSolver");
151 }
152 else
153 {
154 LinSysIterSolver = "ConjugateGradient";
155 }
156
157 if (session->DefinesGlobalSysSolnInfo(var, "LORPreconditioner"))
158 {
159 preconType = session->GetGlobalSysSolnInfo(var, "LORPreconditioner");
160 }
161 else
162 {
163 preconType = "Diagonal";
164 }
165
166 if (boost::iequals(m_slvType, "Preconditioner"))
167 {
168 session->SetGlobalSysSolnInfo(var, "GlobalSysSoln", "IterativeFull");
169 }
170 else
171 {
172 session->SetGlobalSysSolnInfo(var, "GlobalSysSoln", m_slvType.c_str());
173
174 if (boost::iequals(m_slvType, "IterativeFull"))
175 {
177 expList->GetSession()->DefinesCmdLineArgument("verbose");
178 }
179 }
180
181 session->SetGlobalSysSolnInfo(var, "Preconditioner", preconType.c_str());
182
183 // setup Fixed iteration if difined in GlobalSysSoln section
184 std::string prevFixedIter;
185 if (session->DefinesGlobalSysSolnInfo(var, "LORFixedIterations"))
186 {
187
188 if (session->DefinesGlobalSysSolnInfo(var, "NekLinSysFixedIterations"))
189 {
190 prevFixedIter =
191 session->GetGlobalSysSolnInfo(var, "NekLinSysFixedIterations");
192 }
193
194 session->SetGlobalSysSolnInfo(
195 var, "NekLinSysFixedIterations",
196 session->GetGlobalSysSolnInfo(var, "LORFixedIterations"));
197 }
198
199 std::string prevIterTol;
200 if (session->DefinesGlobalSysSolnInfo(var, "LORIterativeTolerance"))
201 {
202
203 if (session->DefinesGlobalSysSolnInfo(var, "IterativeSolverTolerance"))
204 {
205 prevIterTol =
206 session->GetGlobalSysSolnInfo(var, "IterativeSolverTolerance");
207 }
208
209 session->SetGlobalSysSolnInfo(
210 var, "IterativeSolverTolerance",
211 session->GetGlobalSysSolnInfo(var, "LORIterativeTolerance"));
212 }
213
214 session->SetGlobalSysSolnInfo(var, "LinSysIterSolver",
215 LinSysIterSolver.c_str());
216
217 // Create contfield
219 session, m_lor_graph, var);
220
221 // Set up high-order to LOR map
222 m_ho2lor = Array<OneD, int>(m_lor_field->GetNcoeffs());
223 std::map<int, int> offset;
224
225 // check if the coeffmap has been setup correctly in the LOR space
226 for (int e = 0; e < expList->GetNumElmts(); ++e)
227 {
228 offset[expList->GetExp(e)->GetGeom()->GetGlobalID()] =
229 expList->GetCoeff_Offset(e);
230 }
231
232 int cnt = 0;
233 for (int e = 0; e < m_lor_field->GetNumElmts(); ++e)
234 {
235 int gid = m_lor_field->GetExp(e)->GetGeom()->GetGlobalID();
236 int id = coeffmap[gid].first;
237
238 for (int i = 0; i < coeffmap[gid].second.size(); ++i)
239 {
240 m_ho2lor[cnt++] = offset[id] + coeffmap[gid].second[i];
241 }
242 }
243 ASSERTL1(cnt == m_lor_field->GetNcoeffs(),
244 "Error in setting up high order to lower order map");
245
246 // for preconditioner have a homogeneous system so need to set boundary
247 // conditions to homogeneous too
248 m_lor_field->SetBCsToHomogeneous();
249
250 GlobalLinSysKey preconKey(m_linsys.lock()->GetKey().GetMatrixType(),
251 m_lor_field->GetLocalToGlobalMap(),
252 m_linsys.lock()->GetKey().GetConstFactors());
253
254 if (boost::iequals(m_slvType, "DirectFull"))
255 {
257 preconKey, m_lor_field, m_lor_field->GetLocalToGlobalMap());
258 }
259 else if (boost::iequals(m_slvType, "XxtFull"))
260 {
261#ifdef NEKTAR_USE_MPI
263 preconKey, m_lor_field, m_lor_field->GetLocalToGlobalMap());
264#else
265 ASSERTL0(false, "Nektar++ has not been compiled with MPI support.");
266#endif
267 }
268 else if (boost::iequals(m_slvType, "IterativeFull"))
269 {
272 preconKey, m_lor_field, m_lor_field->GetLocalToGlobalMap());
273 }
274 else if (boost::iequals(m_slvType, "PETScFull"))
275 {
276#ifdef NEKTAR_USING_PETSC
278 preconKey, m_lor_field, m_lor_field->GetLocalToGlobalMap());
279#else
280 ASSERTL0(false, "Nektar++ has not been compiled with PETSc support.");
281#endif
282 }
283 else if (boost::iequals(m_slvType, "Preconditioner"))
284 {
285 AssemblyMapSharedPtr l2gmap = m_lor_field->GetLocalToGlobalMap();
286
289 preconKey, m_lor_field, l2gmap);
290
291 std::dynamic_pointer_cast<GlobalLinSysIterativeFull>(m_LORLinSys)
292 ->Initialise(l2gmap->GetNumGlobalCoeffs(), l2gmap,
293 l2gmap->GetNumGlobalDirBndCoeffs());
294 }
295 else
296 {
298 "LORSlvType must be specified as one of "
299 "DirectFull, IterativeFull, Preconditioner, PETScFull");
300 }
301
302 // reset GlobalSysSolnType
303 session->SetGlobalSysSolnInfo(var, "GlobalSysSoln",
304 GlobalSysSolnTypeMap[solvertype]);
305
306 // set fixed iterations if required;
307 if (prevFixedIter.size())
308 {
309 session->SetGlobalSysSolnInfo(var, "NekLinSysFixedIterations",
310 prevFixedIter);
311 }
312
313 // reset iterative tolerance
314 if (prevIterTol.size())
315 {
316 session->SetGlobalSysSolnInfo(var, "IterativeSolverTolerance",
317 prevIterTol);
318 }
319
321
322 // store ndir for easy access in DoPreconditioner
323 m_nDir = m_locToGloMap.lock()->GetNumGlobalDirBndCoeffs();
324}
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
const std::weak_ptr< GlobalLinSys > m_linsys
MultiRegions::ContFieldSharedPtr m_lor_field
Field object for the LOR system.
bool m_useSimplex
Use a simplex distribution in the LOR system so that e.g. quadrilaterals are split into triangles.
GlobalLinSysSharedPtr m_LORLinSys
Linear solver for LOR system.
std::string m_slvType
Solution type for LOR space, DirectFull, IterativeFull, PETScFull.
unsigned int m_nDir
Number of Dirichlet values on original mesh.
SpatialDomains::MeshGraphSharedPtr m_lor_graph
MeshGraph for the LOR system.
bool m_equiSpaced
Flag that determines whether to use equispaced point distributions or GLL.
const char *const GlobalSysSolnTypeMap[]
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition AssemblyMap.h:50

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ASSERTL1, CreateInvMultiplicity(), Nektar::SpatialDomains::LinearMeshGraph::CreateLinearGraph(), Nektar::ErrorUtil::efatal, Nektar::MultiRegions::eIterativeFull, Nektar::SpatialDomains::LinearMeshGraph::GetLinearGraph(), Nektar::MultiRegions::GlobalSysSolnTypeMap, m_equiSpaced, m_ho2lor, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_lor_field, m_lor_graph, m_LORLinSys, m_nDir, m_nsplit, m_slvType, m_useSimplex, m_verboseIter, and NEKERROR.

◆ v_DoPreconditioner()

void Nektar::MultiRegions::PreconditionerLOR::v_DoPreconditioner ( const Array< OneD, NekDouble > &  pInput,
Array< OneD, NekDouble > &  pOutput,
const bool &  isLocal = false 
)
overrideprotectedvirtual

Apply a preconditioner to the conjugate gradient method.

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 329 of file PreconditionerLOR.cpp.

332{
333 auto expList = ((m_linsys.lock())->GetLocMat()).lock();
334
335 int nLocal = expList->GetNcoeffs();
336 int lor_nLocal = m_lor_field->GetNcoeffs();
337
338 Array<OneD, NekDouble> tmp, solve(std::max(nLocal, lor_nLocal), 0.0);
339 Array<OneD, NekDouble> Local(nLocal);
340
341 if (isLocal)
342 {
343 // Input array is in local (non-assembled format) and to reproduce the
344 // globally assembled problem the LOR preconditioner works best if we
345 // take the averaged value so assemble and then divide by the
346 // multiplicity.
347 //
348 // Note: Not entirely clear to me why we cannot take the input value
349 m_locToGloMap.lock()->Assemble(pInput, solve);
351 m_invMultiplicity + m_nDir, 1, solve + m_nDir, 1,
352 tmp = solve + m_nDir, 1);
353 Vmath::Zero(m_nDir, solve, 1);
354 expList->GlobalToLocal(solve, Local);
355 }
356 else // recover local forcing coefficients
357 {
359 m_invMultiplicity + m_nDir, 1, pInput, 1,
360 tmp = solve + m_nDir, 1);
361 Vmath::Zero(m_nDir, solve, 1);
362
363 expList->GlobalToLocal(solve, Local);
364 }
365
368 : StdRegions::eGLLToCoeffs;
369 GlobalMatrixKey key(mtype, m_locToGloMap.lock(),
370 m_linsys.lock()->GetKey().GetConstFactors());
371
372 // Transform inner product to equispaced polynomial with transpose multiply
373 expList->MultiplyByBlockMatrix(key, Local, solve, true);
374
375 // Get force for LOR system
376 Array<OneD, NekDouble> fce(lor_nLocal);
377 // makes inner system symmetric by dividing by linear mesh elemental
378 // multiplicity
379 Vmath::Vmul(nLocal, m_invLinMeshMultiplicity, 1, solve, 1, solve, 1);
380 Vmath::Gathr(lor_nLocal, solve, m_ho2lor, fce);
381
382 // solve linear sys solve for low order system
383 AssemblyMapSharedPtr l2gmap = m_lor_field->GetLocalToGlobalMap();
384 Vmath::Zero(lor_nLocal, solve, 1);
385
386 if (boost::iequals(m_slvType, "DirectFull") ||
387 boost::iequals(m_slvType, "IterativeFull") ||
388 boost::iequals(m_slvType, "XxtFull") ||
389 boost::iequals(m_slvType, "PETScFull"))
390 {
391 m_LORLinSys->SolveLinearSystem(l2gmap->GetNumGlobalCoeffs(), fce, solve,
392 l2gmap,
393 l2gmap->GetNumGlobalDirBndCoeffs());
394 }
395 else
396 {
397 std::dynamic_pointer_cast<GlobalLinSysIterativeFull>(m_LORLinSys)
398 ->DoPreconditionerFlag(fce, solve, true);
399 }
400
401 // Project solution back to p-expansion and in Lagrange space
402 Vmath::Scatr(lor_nLocal, solve, m_ho2lor, Local);
403
404 if (isLocal)
405 {
406 // Transform residual to polynomial
407
408 expList->MultiplyByBlockMatrix(key, Local, pOutput);
409
410 // enforce zero Bcs - should be done with a mask on local variables.
411 expList->LocalToGlobal(pOutput, solve);
412 Vmath::Zero(m_nDir, solve, 1);
413 expList->GlobalToLocal(solve, pOutput);
414 }
415 else
416 {
417 // Transform residual to polynomial
418 expList->MultiplyByBlockMatrix(key, Local, solve);
419 expList->LocalToGlobal(solve, Local);
420 Vmath::Vcopy(pOutput.size(), Local + m_nDir, 1, pOutput, 1);
421 }
422}
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition Vmath.hpp:72
void Gathr(I n, const T *x, const I *y, T *z)
Gather vector z[i] = x[y[i]].
Definition Vmath.hpp:507
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
Definition Vmath.hpp:539
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:273
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:825

References Nektar::StdRegions::eEquiSpacedToCoeffs, Nektar::StdRegions::eGLLToCoeffs, Vmath::Gathr(), m_equiSpaced, m_ho2lor, m_invLinMeshMultiplicity, m_invMultiplicity, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, m_lor_field, m_LORLinSys, m_nDir, m_slvType, Vmath::Scatr(), Vmath::Vcopy(), Vmath::Vmul(), and Vmath::Zero().

◆ v_InitObject()

void Nektar::MultiRegions::PreconditionerLOR::v_InitObject ( )
overrideprotectedvirtual

Reimplemented from Nektar::MultiRegions::Preconditioner.

Definition at line 75 of file PreconditionerLOR.cpp.

76{
77}

Member Data Documentation

◆ className

std::string Nektar::MultiRegions::PreconditionerLOR::className
static
Initial value:
=
"LOR Preconditioning")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static PreconditionerSharedPtr create(const std::shared_ptr< GlobalLinSys > &plinsys, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
PreconFactory & GetPreconFactory()

Name of class.

Registers the class with the Factory.

Definition at line 71 of file PreconditionerLOR.h.

◆ def

std::string Nektar::MultiRegions::PreconditionerLOR::def
staticprivate

Definition at line 93 of file PreconditionerLOR.h.

◆ lookupIds

std::string Nektar::MultiRegions::PreconditionerLOR::lookupIds[]
staticprivate

Definition at line 92 of file PreconditionerLOR.h.

◆ m_equiSpaced

bool Nektar::MultiRegions::PreconditionerLOR::m_equiSpaced = false
private

Flag that determines whether to use equispaced point distributions or GLL.

Definition at line 101 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner(), and v_DoPreconditioner().

◆ m_ho2lor

Array<OneD, int> Nektar::MultiRegions::PreconditionerLOR::m_ho2lor
private

Map from high-order node numbers to LOR representation.

Definition at line 115 of file PreconditionerLOR.h.

Referenced by CreateInvMultiplicity(), v_BuildPreconditioner(), and v_DoPreconditioner().

◆ m_invLinMeshMultiplicity

Array<OneD, NekDouble> Nektar::MultiRegions::PreconditionerLOR::m_invLinMeshMultiplicity
private

Inverse of multiplicity of each global DOF in the LOR mesh.

Definition at line 119 of file PreconditionerLOR.h.

Referenced by CreateInvMultiplicity(), and v_DoPreconditioner().

◆ m_invMultiplicity

Array<OneD, NekDouble> Nektar::MultiRegions::PreconditionerLOR::m_invMultiplicity
private

Inverse of multiplicity of each global DOF in the high-order mesh.

Definition at line 117 of file PreconditionerLOR.h.

Referenced by CreateInvMultiplicity(), and v_DoPreconditioner().

◆ m_lor_field

MultiRegions::ContFieldSharedPtr Nektar::MultiRegions::PreconditionerLOR::m_lor_field
private

Field object for the LOR system.

Definition at line 111 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner(), and v_DoPreconditioner().

◆ m_lor_graph

SpatialDomains::MeshGraphSharedPtr Nektar::MultiRegions::PreconditionerLOR::m_lor_graph
private

MeshGraph for the LOR system.

Definition at line 109 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner().

◆ m_LORLinSys

GlobalLinSysSharedPtr Nektar::MultiRegions::PreconditionerLOR::m_LORLinSys
private

Linear solver for LOR system.

Definition at line 96 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner(), and v_DoPreconditioner().

◆ m_nDir

unsigned int Nektar::MultiRegions::PreconditionerLOR::m_nDir
private

Number of Dirichlet values on original mesh.

Definition at line 113 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner(), and v_DoPreconditioner().

◆ m_nsplit

unsigned int Nektar::MultiRegions::PreconditionerLOR::m_nsplit
private

Definition at line 107 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner().

◆ m_slvType

std::string Nektar::MultiRegions::PreconditionerLOR::m_slvType
private

Solution type for LOR space, DirectFull, IterativeFull, PETScFull.

Definition at line 98 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner(), and v_DoPreconditioner().

◆ m_useSimplex

bool Nektar::MultiRegions::PreconditionerLOR::m_useSimplex = false
private

Use a simplex distribution in the LOR system so that e.g. quadrilaterals are split into triangles.

Definition at line 104 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner().

◆ m_verboseIter

bool Nektar::MultiRegions::PreconditionerLOR::m_verboseIter
private

Whether to be verbose.

Definition at line 121 of file PreconditionerLOR.h.

Referenced by v_BuildPreconditioner().