43 namespace MultiRegions
88 ContField::ContField():
92 m_globalLinSysManager(
93 std::bind(&
ContField::GenGlobalLinSys, this,
94 std::placeholders::_1),
95 std::string(
"GlobalLinSys"))
124 const std::string &variable,
125 const bool DeclareCoeffPhysArrays,
126 const bool CheckIfSingularSystem,
129 DeclareCoeffPhysArrays,ImpType),
131 m_globalLinSysManager(
132 std::bind(&
ContField::GenGlobalLinSys, this,
133 std::placeholders::_1),
134 std::string(
"GlobalLinSys"))
140 CheckIfSingularSystem,
146 if (
m_session->DefinesCmdLineArgument(
"verbose"))
178 const std::string &variable,
179 bool DeclareCoeffPhysArrays,
180 const bool CheckIfSingularSystem):
181 DisContField(In,graph,variable,false,DeclareCoeffPhysArrays),
183 m_globalLinSysManager(
184 std::bind(&
ContField::GenGlobalLinSys, this, std::placeholders::_1),
185 std::string(
"GlobalLinSys"))
193 CheckIfSingularSystem,
199 if (
m_session->DefinesCmdLineArgument(
"verbose"))
219 m_locToGloMap(In.m_locToGloMap),
220 m_globalMat(In.m_globalMat),
221 m_globalLinSysManager(In.m_globalLinSysManager)
236 m_globalLinSysManager
238 this, std::placeholders::_1),
239 std::string(
"GlobalLinSys"))
383 GetBndCondCoeffsToLocalCoeffsSign();
385 GetBndCondCoeffsToLocalCoeffsMap();
402 wsp[map[bndcnt + j]] +=
sign[bndcnt + j] * bndcoeff[j];
409 wsp[map[bndcnt+j]] += bndcoeff[bndcnt + j];
465 Gmat->EigenSolve(Real,Imag,Evecs);
531 if(contNcoeffs - NumDirBcs > 0)
551 "To use method must have a AssemblyMap "
560 (*m_globalMat)[mkey] = glo_matrix;
564 glo_matrix = matrixIter->second;
589 "To use method must have a AssemblyMap "
623 GetBndCondCoeffsToLocalCoeffsSign();
625 GetBndCondCoeffsToLocalCoeffsMap();
639 outarray[map[bndcnt + j]] =
sign[bndcnt + j] * bndcoeff[j];
646 outarray[map[bndcnt+j]] = bndcoeff[j];
655 set<int> &ParallelDirBndSign =
m_locToGloMap->GetParallelDirBndSign();
657 for (
auto &it : ParallelDirBndSign)
664 for (
auto &it : ParallelDirBndSign)
669 set<ExtraDirDof> ©LocalDirDofs =
m_locToGloMap->GetCopyLocalDirDofs();
670 for (
auto &it : copyLocalDirDofs)
672 outarray[std::get<0>(it)] =
673 outarray[std::get<1>(it)]*std::get<2>(it);
683 GetBndCondCoeffsToLocalCoeffsSign();
685 GetBndCondCoeffsToLocalCoeffsMap();
695 coeffs[j] =
sign[bndcnt+j] *
m_coeffs[bndmap[bndcnt+j]];
702 coeffs[j] =
m_coeffs[bndmap[bndcnt+j]];
716 "nreg is out or range since this many boundary "
717 "regions to not exist");
720 GetBndCondCoeffsToLocalCoeffsSign();
722 GetBndCondCoeffsToLocalCoeffsMap();
727 for(
int j = 0; j < nreg; ++j)
736 coeffs[j] =
sign[bndcnt + j] *
m_coeffs[bndmap[bndcnt + j]];
743 coeffs[j] =
m_coeffs[bndmap[bndcnt + j]];
874 const bool PhysSpaceForcing)
898 GetBndCondCoeffsToLocalCoeffsSign();
900 GetBndCondCoeffsToLocalCoeffsMap();
916 wsp[map[bndcnt + j]] +=
sign[bndcnt + j] * bndcoeff[j];
923 wsp[map[bndcnt+j]] += bndcoeff[j];
931 varcoeff,varfactors);
991 GetBndCondCoeffsToLocalCoeffsSign();
993 GetBndCondCoeffsToLocalCoeffsMap();
1009 wsp[map[bndcnt + j]] +=
sign[bndcnt + j] * bndcoeff[j];
1016 wsp[map[bndcnt+j]] += bndcoeff[bndcnt + j];
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define sign(a, b)
return the sign(b)*a
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
virtual void v_MultiplyByInvMassMatrix(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Template method virtual forwarder for MultiplyByInvMassMatrix().
virtual ~ContField()
The default destructor.
LibUtilities::NekManager< GlobalLinSysKey, GlobalLinSys > m_globalLinSysManager
A manager which collects all the global linear systems being assembled, such that they should be cons...
void LaplaceSolve(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray, const Array< OneD, Array< OneD, NekDouble > > &variablecoeffs=NullNekDoubleArrayOfArray, NekDouble time=0.0)
Solves the two-dimensional Laplace equation, subject to the boundary conditions specified.
GlobalLinSysSharedPtr GenGlobalLinSys(const GlobalLinSysKey &mkey)
AssemblyMapCGSharedPtr m_locToGloMap
(A shared pointer to) the object which contains all the required information for the transformation f...
virtual void v_SmoothField(Array< OneD, NekDouble > &field)
Template method virtual forwarded for SmoothField().
virtual void v_LocalToGlobal(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool useComm)
Gathers the global coefficients from the local coefficients .
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & GetBndConditions()
Returns the boundary conditions.
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Template method virtual forwarder for FwdTrans().
void MultiplyByInvMassMatrix(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Multiply a solution by the inverse mass matrix.
virtual void v_GeneralMatrixOp(const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Calculates the result of the multiplication of a global matrix of type specified by mkey with a vecto...
virtual void v_GlobalToLocal(void)
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Calculates the inner product of a function with respect to all global expansion modes .
GlobalMatrixMapShPtr m_globalMat
(A shared pointer to) a list which collects all the global matrices being assembled,...
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Performs the backward transformation of the spectral/hp element expansion.
virtual void v_LinearAdvectionDiffusionReactionSolve(const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
virtual void v_HelmSolve(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff, const MultiRegions::VarFactorsMap &varfactors, const Array< OneD, const NekDouble > &dirForcing, const bool PhysSpaceForcing)
Solves the two-dimensional Helmholtz equation, subject to the boundary conditions specified.
virtual void v_ImposeDirichletConditions(Array< OneD, NekDouble > &outarray)
Impose the Dirichlet Boundary Conditions on outarray.
virtual void v_ClearGlobalLinSysManager(void)
GlobalLinSysSharedPtr GetGlobalLinSys(const GlobalLinSysKey &mkey)
Returns the linear system specified by the key mkey.
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Performs the global forward transformation of a function , subject to the boundary conditions specifi...
GlobalMatrixSharedPtr GetGlobalMatrix(const GlobalMatrixKey &mkey)
Returns the global matrix specified by mkey.
virtual void v_FillBndCondFromField()
ContField()
The default constructor.
virtual const Array< OneD, const SpatialDomains ::BoundaryConditionShPtr > & v_GetBndConditions()
Template method virtual forwarder for GetBndConditions().
void LinearAdvectionEigs(const NekDouble ax, const NekDouble ay, Array< OneD, NekDouble > &Real, Array< OneD, NekDouble > &Imag, Array< OneD, NekDouble > &Evecs=NullNekDouble1DArray)
Compute the eigenvalues of the linear advection operator.
void GlobalSolve(const GlobalLinSysKey &key, const Array< OneD, const NekDouble > &rhs, Array< OneD, NekDouble > &inout, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
Solves the linear system specified by the key key.
void v_LinearAdvectionReactionSolve(const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
This class is the abstractio n of a global discontinuous two- dimensional spectral/hp element expansi...
PeriodicMap m_periodicEdges
A map which identifies pairs of periodic edges.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
bool SameTypeOfBoundaryConditions(const DisContField &In)
Check to see if expansion has the same BCs as In.
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
Base class for all multi-elemental spectral/hp expansions.
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
std::shared_ptr< GlobalMatrix > GenGlobalMatrix(const GlobalMatrixKey &mkey, const std::shared_ptr< AssemblyMapCG > &locToGloMap)
Generates a global matrix from the given key and map.
const Array< OneD, const NekDouble > & GetCoeffs() const
This function returns (a reference to) the array (implemented as m_coeffs) containing all local expa...
std::shared_ptr< GlobalLinSys > GenGlobalLinSys(const GlobalLinSysKey &mkey, const std::shared_ptr< AssemblyMapCG > &locToGloMap)
This operation constructs the global linear system of type mkey.
int m_ncoeffs
The total number of local degrees of freedom. m_ncoeffs .
std::shared_ptr< DNekMat > GenGlobalMatrixFull(const GlobalLinSysKey &mkey, const std::shared_ptr< AssemblyMapCG > &locToGloMap)
void GeneralMatrixOp_IterPerExp(const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::SessionReaderSharedPtr m_session
Session.
ExpansionType m_expType
Exapnsion type.
Describe a linear system.
Describes a matrix with ordering defined by a local to global map.
bool LocToGloMapIsDefined() const
Returns true if a local to global map is defined.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
std::shared_ptr< GlobalMatrix > GlobalMatrixSharedPtr
Shared pointer to a GlobalMatrix object.
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
std::map< GlobalMatrixKey, GlobalMatrixSharedPtr > GlobalMatrixMap
Mapping from global matrix keys to global matrices.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
@ eLinearAdvectionReaction
@ eLinearAdvectionDiffusionReaction
std::map< ConstFactorType, NekDouble > ConstFactorMap
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Neg(int n, T *x, const int incx)
Negate x = -x.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.