Nektar++
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Nektar::LocalRegions::Expansion3D Class Reference

#include <Expansion3D.h>

Inheritance diagram for Nektar::LocalRegions::Expansion3D:
[legend]

Public Member Functions

 Expansion3D (SpatialDomains::Geometry3DSharedPtr pGeom)
 
virtual ~Expansion3D ()
 
void SetFaceExp (const int face, Expansion2DSharedPtr &f)
 
Expansion2DSharedPtr GetFaceExp (const int face)
 
void SetTraceToGeomOrientation (Array< OneD, NekDouble > &inout)
 Align trace orientation with the geometry orientation. More...
 
void SetFaceToGeomOrientation (const int face, Array< OneD, NekDouble > &inout)
 Align face orientation with the geometry orientation. More...
 
void AddHDGHelmholtzFaceTerms (const NekDouble tau, const int edge, Array< OneD, NekDouble > &facePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
 
void AddNormTraceInt (const int dir, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &outarray)
 
void AddNormTraceInt (const int dir, Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs)
 
void AddFaceBoundaryInt (const int face, ExpansionSharedPtr &FaceExp, Array< OneD, NekDouble > &facePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
 
SpatialDomains::Geometry3DSharedPtr GetGeom3D () const
 
void ReOrientFacePhysMap (const int nvert, const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
 
void v_NormVectorIProductWRTBase (const Array< OneD, const Array< OneD, NekDouble > > &Fvec, Array< OneD, NekDouble > &outarray)
 
- Public Member Functions inherited from Nektar::LocalRegions::Expansion
 Expansion (SpatialDomains::GeometrySharedPtr pGeom)
 
 Expansion (const Expansion &pSrc)
 
virtual ~Expansion ()
 
DNekScalMatSharedPtr GetLocMatrix (const LocalRegions::MatrixKey &mkey)
 
DNekScalMatSharedPtr GetLocMatrix (const StdRegions::MatrixType mtype, const StdRegions::ConstFactorMap &factors=StdRegions::NullConstFactorMap, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
 
SpatialDomains::GeometrySharedPtr GetGeom () const
 
void Reset ()
 
const SpatialDomains::GeomFactorsSharedPtrGetMetricInfo () const
 
DNekMatSharedPtr BuildTransformationMatrix (const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
 
DNekMatSharedPtr BuildVertexMatrix (const DNekScalMatSharedPtr &r_bnd)
 
void ExtractDataToCoeffs (const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
 
void AddEdgeNormBoundaryInt (const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
void AddEdgeNormBoundaryInt (const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
void AddFaceNormBoundaryInt (const int face, const std::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
void DGDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &coeffs, Array< OneD, NekDouble > &outarray)
 
NekDouble VectorFlux (const Array< OneD, Array< OneD, NekDouble > > &vec)
 
- Public Member Functions inherited from Nektar::StdRegions::StdExpansion
 StdExpansion ()
 Default Constructor. More...
 
 StdExpansion (const int numcoeffs, const int numbases, const LibUtilities::BasisKey &Ba=LibUtilities::NullBasisKey, const LibUtilities::BasisKey &Bb=LibUtilities::NullBasisKey, const LibUtilities::BasisKey &Bc=LibUtilities::NullBasisKey)
 Constructor. More...
 
 StdExpansion (const StdExpansion &T)
 Copy Constructor. More...
 
virtual ~StdExpansion ()
 Destructor. More...
 
int GetNumBases () const
 This function returns the number of 1D bases used in the expansion. More...
 
const Array< OneD, const LibUtilities::BasisSharedPtr > & GetBase () const
 This function gets the shared point to basis. More...
 
const LibUtilities::BasisSharedPtrGetBasis (int dir) const
 This function gets the shared point to basis in the dir direction. More...
 
int GetNcoeffs (void) const
 This function returns the total number of coefficients used in the expansion. More...
 
int GetTotPoints () const
 This function returns the total number of quadrature points used in the element. More...
 
LibUtilities::BasisType GetBasisType (const int dir) const
 This function returns the type of basis used in the dir direction. More...
 
int GetBasisNumModes (const int dir) const
 This function returns the number of expansion modes in the dir direction. More...
 
int EvalBasisNumModesMax (void) const
 This function returns the maximum number of expansion modes over all local directions. More...
 
LibUtilities::PointsType GetPointsType (const int dir) const
 This function returns the type of quadrature points used in the dir direction. More...
 
int GetNumPoints (const int dir) const
 This function returns the number of quadrature points in the dir direction. More...
 
const Array< OneD, const NekDouble > & GetPoints (const int dir) const
 This function returns a pointer to the array containing the quadrature points in dir direction. More...
 
int GetNverts () const
 This function returns the number of vertices of the expansion domain. More...
 
int GetNedges () const
 This function returns the number of edges of the expansion domain. More...
 
int GetEdgeNcoeffs (const int i) const
 This function returns the number of expansion coefficients belonging to the i-th edge. More...
 
int GetTotalEdgeIntNcoeffs () const
 
int GetEdgeNumPoints (const int i) const
 This function returns the number of quadrature points belonging to the i-th edge. More...
 
int DetCartesianDirOfEdge (const int edge)
 
const LibUtilities::BasisKey DetEdgeBasisKey (const int i) const
 
const LibUtilities::BasisKey DetFaceBasisKey (const int i, const int k) const
 
int GetFaceNumPoints (const int i) const
 This function returns the number of quadrature points belonging to the i-th face. More...
 
int GetFaceNcoeffs (const int i) const
 This function returns the number of expansion coefficients belonging to the i-th face. More...
 
int GetFaceIntNcoeffs (const int i) const
 
int GetTotalFaceIntNcoeffs () const
 
int GetTraceNcoeffs (const int i) const
 This function returns the number of expansion coefficients belonging to the i-th edge/face. More...
 
LibUtilities::PointsKey GetFacePointsKey (const int i, const int j) const
 
int NumBndryCoeffs (void) const
 
int NumDGBndryCoeffs (void) const
 
LibUtilities::BasisType GetEdgeBasisType (const int i) const
 This function returns the type of expansion basis on the i-th edge. More...
 
const LibUtilities::PointsKey GetNodalPointsKey () const
 This function returns the type of expansion Nodal point type if defined. More...
 
int GetNfaces () const
 This function returns the number of faces of the expansion domain. More...
 
int GetNtrace () const
 Returns the number of trace elements connected to this element. More...
 
LibUtilities::ShapeType DetShapeType () const
 This function returns the shape of the expansion domain. More...
 
std::shared_ptr< StdExpansionGetStdExp (void) const
 
std::shared_ptr< StdExpansionGetLinStdExp (void) const
 
int GetShapeDimension () const
 
bool IsBoundaryInteriorExpansion ()
 
bool IsNodalNonTensorialExp ()
 
void BwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function performs the Backward transformation from coefficient space to physical space. More...
 
void FwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function performs the Forward transformation from physical space to coefficient space. More...
 
void FwdTrans_BndConstrained (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
NekDouble Integral (const Array< OneD, const NekDouble > &inarray)
 This function integrates the specified function over the domain. More...
 
void FillMode (const int mode, Array< OneD, NekDouble > &outarray)
 This function fills the array outarray with the mode-th mode of the expansion. More...
 
void IProductWRTBase (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 this function calculates the inner product of a given function f with the different modes of the expansion More...
 
void IProductWRTBase (const Array< OneD, const NekDouble > &base, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int coll_check)
 
void IProductWRTDerivBase (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void IProductWRTDirectionalDerivBase (const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
int GetElmtId ()
 Get the element id of this expansion when used in a list by returning value of m_elmt_id. More...
 
void SetElmtId (const int id)
 Set the element id of this expansion when used in a list by returning value of m_elmt_id. More...
 
void GetCoords (Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
 this function returns the physical coordinates of the quadrature points of the expansion More...
 
void GetCoord (const Array< OneD, const NekDouble > &Lcoord, Array< OneD, NekDouble > &coord)
 given the coordinates of a point of the element in the local collapsed coordinate system, this function calculates the physical coordinates of the point More...
 
DNekMatSharedPtr GetStdMatrix (const StdMatrixKey &mkey)
 
DNekBlkMatSharedPtr GetStdStaticCondMatrix (const StdMatrixKey &mkey)
 
IndexMapValuesSharedPtr GetIndexMap (const IndexMapKey &ikey)
 
const Array< OneD, const NekDouble > & GetPhysNormals (void)
 
void SetPhysNormals (Array< OneD, const NekDouble > &normal)
 
virtual void SetUpPhysNormals (const int edge)
 
void NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
 
void NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
void NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray)
 
void NormVectorIProductWRTBase (const Array< OneD, const Array< OneD, NekDouble > > &Fvec, Array< OneD, NekDouble > &outarray)
 
DNekScalBlkMatSharedPtr GetLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
void DropLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
StdRegions::Orientation GetForient (int face)
 
StdRegions::Orientation GetEorient (int edge)
 
void SetCoeffsToOrientation (Array< OneD, NekDouble > &coeffs, StdRegions::Orientation dir)
 
void SetCoeffsToOrientation (StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
int CalcNumberOfCoefficients (const std::vector< unsigned int > &nummodes, int &modes_offset)
 
NekDouble StdPhysEvaluate (const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
 
int GetCoordim ()
 
void GetBoundaryMap (Array< OneD, unsigned int > &outarray)
 
void GetInteriorMap (Array< OneD, unsigned int > &outarray)
 
int GetVertexMap (const int localVertexId, bool useCoeffPacking=false)
 
void GetEdgeInteriorMap (const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
 
void GetFaceNumModes (const int fid, const Orientation faceOrient, int &numModes0, int &numModes1)
 
void GetFaceInteriorMap (const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
 
void GetEdgeToElementMap (const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int P=-1)
 
void GetFaceToElementMap (const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int nummodesA=-1, int nummodesB=-1)
 
void GetEdgePhysVals (const int edge, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 Extract the physical values along edge edge from inarray into outarray following the local edge orientation and point distribution defined by defined in EdgeExp. More...
 
void GetEdgePhysVals (const int edge, const std::shared_ptr< StdExpansion > &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GetTracePhysVals (const int edge, const std::shared_ptr< StdExpansion > &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GetVertexPhysVals (const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray)
 
void GetEdgeInterpVals (const int edge, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GetEdgeQFactors (const int edge, Array< OneD, NekDouble > &outarray)
 Extract the metric factors to compute the contravariant fluxes along edge edge and stores them into outarray following the local edge orientation (i.e. anticlockwise convention). More...
 
void GetFacePhysVals (const int face, const std::shared_ptr< StdExpansion > &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient=eNoOrientation)
 
void GetEdgePhysMap (const int edge, Array< OneD, int > &outarray)
 
void GetFacePhysMap (const int face, Array< OneD, int > &outarray)
 
void MultiplyByQuadratureMetric (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void MultiplyByStdQuadratureMetric (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
DNekMatSharedPtr CreateGeneralMatrix (const StdMatrixKey &mkey)
 this function generates the mass matrix \(\mathbf{M}[i][j] = \int \phi_i(\mathbf{x}) \phi_j(\mathbf{x}) d\mathbf{x}\) More...
 
void GeneralMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void ReduceOrderCoeffs (int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void SVVLaplacianFilter (Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
 
void ExponentialFilter (Array< OneD, NekDouble > &array, const NekDouble alpha, const NekDouble exponent, const NekDouble cutoff)
 
void LaplacianMatrixOp (const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDerivMatrixOp (const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDirectionalDerivMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassLevelCurvatureMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LinearAdvectionDiffusionReactionMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
 
void HelmholtzMatrixOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
DNekMatSharedPtr GenMatrix (const StdMatrixKey &mkey)
 
void PhysDeriv (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
 
void PhysDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void PhysDeriv_s (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds)
 
void PhysDeriv_n (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn)
 
void PhysDirectionalDeriv (const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &direction, Array< OneD, NekDouble > &outarray)
 
void StdPhysDeriv (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
 
void StdPhysDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void AddRobinMassMatrix (const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
 
void AddRobinEdgeContribution (const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, Array< OneD, NekDouble > &coeffs)
 
NekDouble PhysEvaluate (const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
 This function evaluates the expansion at a single (arbitrary) point of the domain. More...
 
NekDouble PhysEvaluate (const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
 This function evaluates the expansion at a single (arbitrary) point of the domain. More...
 
void LocCoordToLocCollapsed (const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
 Convert local cartesian coordinate xi into local collapsed coordinates eta. More...
 
virtual int v_GetElmtId ()
 Get the element id of this expansion when used in a list by returning value of m_elmt_id. More...
 
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals (void)
 
virtual void v_SetPhysNormals (Array< OneD, const NekDouble > &normal)
 
virtual void v_SetUpPhysNormals (const int edge)
 
virtual int v_CalcNumberOfCoefficients (const std::vector< unsigned int > &nummodes, int &modes_offset)
 
virtual void v_NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
 
virtual void v_NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
virtual void v_NormVectorIProductWRTBase (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, const Array< OneD, const NekDouble > &Fz, Array< OneD, NekDouble > &outarray)
 
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
virtual void v_DropLocStaticCondMatrix (const LocalRegions::MatrixKey &mkey)
 
virtual StdRegions::Orientation v_GetEorient (int edge)
 
NekDouble Linf (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
 Function to evaluate the discrete \( L_\infty\) error \( |\epsilon|_\infty = \max |u - u_{exact}|\) where \( u_{exact}\) is given by the array sol. More...
 
NekDouble L2 (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
 Function to evaluate the discrete \( L_2\) error, \( | \epsilon |_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2 dx \right]^{1/2} d\xi_1 \) where \( u_{exact}\) is given by the array sol. More...
 
NekDouble H1 (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &sol=NullNekDouble1DArray)
 Function to evaluate the discrete \( H^1\) error, \( | \epsilon |^1_{2} = \left [ \int^1_{-1} [u - u_{exact}]^2 + \nabla(u - u_{exact})\cdot\nabla(u - u_{exact})\cdot dx \right]^{1/2} d\xi_1 \) where \( u_{exact}\) is given by the array sol. More...
 
const NormalVectorGetEdgeNormal (const int edge) const
 
void ComputeEdgeNormal (const int edge)
 
void NegateEdgeNormal (const int edge)
 
bool EdgeNormalNegated (const int edge)
 
void ComputeFaceNormal (const int face)
 
void NegateFaceNormal (const int face)
 
bool FaceNormalNegated (const int face)
 
void ComputeVertexNormal (const int vertex)
 
void NegateVertexNormal (const int vertex)
 
bool VertexNormalNegated (const int vertex)
 
const NormalVectorGetFaceNormal (const int face) const
 
const NormalVectorGetVertexNormal (const int vertex) const
 
const NormalVectorGetSurfaceNormal (const int id) const
 
const LibUtilities::PointsKeyVector GetPointsKeys () const
 
Array< OneD, unsigned int > GetEdgeInverseBoundaryMap (int eid)
 
Array< OneD, unsigned int > GetFaceInverseBoundaryMap (int fid, StdRegions::Orientation faceOrient=eNoOrientation, int P1=-1, int P2=-1)
 
void GetInverseBoundaryMaps (Array< OneD, unsigned int > &vmap, Array< OneD, Array< OneD, unsigned int > > &emap, Array< OneD, Array< OneD, unsigned int > > &fmap)
 
DNekMatSharedPtr BuildInverseTransformationMatrix (const DNekScalMatSharedPtr &m_transformationmatrix)
 
void PhysInterpToSimplexEquiSpaced (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, int npset=-1)
 This function performs an interpolation from the physical space points provided at input into an array of equispaced points which are not the collapsed coordinate. So for a tetrahedron you will only get a tetrahedral number of values. More...
 
void GetSimplexEquiSpacedConnectivity (Array< OneD, int > &conn, bool standard=true)
 This function provides the connectivity of local simplices (triangles or tets) to connect the equispaced data points provided by PhysInterpToSimplexEquiSpaced. More...
 
void EquiSpacedToCoeffs (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function performs a projection/interpolation from the equispaced points sometimes used in post-processing onto the coefficient space. More...
 
template<class T >
std::shared_ptr< T > as ()
 
void IProductWRTBase_SumFac (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
 
- Public Member Functions inherited from Nektar::StdRegions::StdExpansion3D
 StdExpansion3D ()
 
 StdExpansion3D (int numcoeffs, const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc)
 
 StdExpansion3D (const StdExpansion3D &T)
 
virtual ~StdExpansion3D ()
 
void PhysTensorDeriv (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray_d1, Array< OneD, NekDouble > &outarray_d2, Array< OneD, NekDouble > &outarray_d3)
 Calculate the 3D derivative in the local tensor/collapsed coordinate at the physical points. More...
 
void BwdTrans_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
 
void IProductWRTBase_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
 

Protected Member Functions

virtual void v_DGDeriv (const int dir, const Array< OneD, const NekDouble > &incoeffs, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &out_d)
 Evaluate coefficients of weak deriviative in the direction dir given the input coefficicents incoeffs and the imposed boundary values in EdgeExp (which will have its phys space updated). More...
 
virtual DNekMatSharedPtr v_GenMatrix (const StdRegions::StdMatrixKey &mkey)
 
virtual void v_AddFaceNormBoundaryInt (const int face, const ExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddRobinMassMatrix (const int face, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
 
virtual StdRegions::Orientation v_GetForient (int face)
 
virtual void v_GetTracePhysVals (const int face, const StdRegions::StdExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
 Returns the physical values at the quadrature points of a face Wrapper function to v_GetFacePhysVals. More...
 
virtual void v_GetFacePhysVals (const int face, const StdRegions::StdExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)
 
void GetPhysFaceVarCoeffsFromElement (const int face, ExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &varcoeff, Array< OneD, NekDouble > &outarray)
 
virtual Array< OneD, NekDoublev_GetnFacecdotMF (const int dir, const int face, ExpansionSharedPtr &FaceExp_f, const Array< OneD, const Array< OneD, NekDouble > > &normals, const StdRegions::VarCoeffMap &varcoeffs)
 
virtual Array< OneD, unsigned int > v_GetEdgeInverseBoundaryMap (int eid)
 
virtual Array< OneD, unsigned int > v_GetFaceInverseBoundaryMap (int fid, StdRegions::Orientation faceOrient=StdRegions::eNoOrientation, int P1=-1, int P2=-1)
 
void v_GetInverseBoundaryMaps (Array< OneD, unsigned int > &vmap, Array< OneD, Array< OneD, unsigned int > > &emap, Array< OneD, Array< OneD, unsigned int > > &fmap)
 
virtual DNekMatSharedPtr v_BuildTransformationMatrix (const DNekScalMatSharedPtr &r_bnd, const StdRegions::MatrixType matrixType)
 
virtual DNekMatSharedPtr v_BuildInverseTransformationMatrix (const DNekScalMatSharedPtr &transformationmatrix)
 Build inverse and inverse transposed transformation matrix: \(\mathbf{R^{-1}}\) and \(\mathbf{R^{-T}}\). More...
 
virtual DNekMatSharedPtr v_BuildVertexMatrix (const DNekScalMatSharedPtr &r_bnd)
 
void ReOrientTriFacePhysMap (const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
 
void ReOrientQuadFacePhysMap (const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
 
- Protected Member Functions inherited from Nektar::LocalRegions::Expansion
void ComputeLaplacianMetric ()
 
void ComputeQuadratureMetric ()
 
void ComputeGmatcdotMF (const Array< TwoD, const NekDouble > &df, const Array< OneD, const NekDouble > &direction, Array< OneD, Array< OneD, NekDouble > > &dfdir)
 
virtual void v_MultiplyByQuadratureMetric (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_ComputeLaplacianMetric ()
 
virtual void v_GetCoords (Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3)
 
Array< OneD, NekDoublev_GetMF (const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
 
Array< OneD, NekDoublev_GetMFDiv (const int dir, const StdRegions::VarCoeffMap &varcoeffs)
 
Array< OneD, NekDoublev_GetMFMag (const int dir, const StdRegions::VarCoeffMap &varcoeffs)
 
virtual DNekScalMatSharedPtr v_GetLocMatrix (const LocalRegions::MatrixKey &mkey)
 
virtual void v_ExtractDataToCoeffs (const NekDouble *data, const std::vector< unsigned int > &nummodes, const int nmodes_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType)
 
virtual void v_AddEdgeNormBoundaryInt (const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddEdgeNormBoundaryInt (const int edge, const std::shared_ptr< Expansion > &EdgeExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddFaceNormBoundaryInt (const int face, const std::shared_ptr< Expansion > &FaceExp, const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
virtual NekDouble v_VectorFlux (const Array< OneD, Array< OneD, NekDouble > > &vec)
 
- Protected Member Functions inherited from Nektar::StdRegions::StdExpansion
DNekMatSharedPtr CreateStdMatrix (const StdMatrixKey &mkey)
 
DNekBlkMatSharedPtr CreateStdStaticCondMatrix (const StdMatrixKey &mkey)
 Create the static condensation of a matrix when using a boundary interior decomposition. More...
 
IndexMapValuesSharedPtr CreateIndexMap (const IndexMapKey &ikey)
 Create an IndexMap which contains mapping information linking any specific element shape with either its boundaries, edges, faces, verteces, etc. More...
 
void BwdTrans_MatOp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void BwdTrans_SumFac (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void IProductWRTDerivBase_SumFac (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void IProductWRTDirectionalDerivBase_SumFac (const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void GeneralMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp_MatFree_Kernel (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp)
 
void LaplacianMatrixOp_MatFree_GenericImpl (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LaplacianMatrixOp_MatFree (const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDerivMatrixOp_MatFree (const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void WeakDirectionalDerivMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void MassLevelCurvatureMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void LinearAdvectionDiffusionReactionMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey, bool addDiffusionTerm=true)
 
void HelmholtzMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
void HelmholtzMatrixOp_MatFree_GenericImpl (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdMatrixKey &mkey)
 
virtual void v_SetCoeffsToOrientation (StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_SetCoeffsToOrientation (Array< OneD, NekDouble > &coeffs, StdRegions::Orientation dir)
 
virtual NekDouble v_StdPhysEvaluate (const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals)
 
- Protected Member Functions inherited from Nektar::StdRegions::StdExpansion3D
virtual NekDouble v_PhysEvaluate (const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
 This function evaluates the expansion at a single (arbitrary) point of the domain. More...
 
virtual NekDouble v_PhysEvaluate (const Array< OneD, DNekMatSharedPtr > &I, const Array< OneD, const NekDouble > &physvals)
 
virtual void v_BwdTrans_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)=0
 
virtual void v_IProductWRTBase_SumFacKernel (const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)=0
 
virtual void v_LaplacianMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
 
virtual void v_HelmholtzMatrixOp_MatFree (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
 
virtual NekDouble v_Integral (const Array< OneD, const NekDouble > &inarray)
 Integrates the specified function over the domain. More...
 
virtual void v_NegateFaceNormal (const int face)
 
virtual bool v_FaceNormalNegated (const int face)
 
virtual int v_GetTraceNcoeffs (const int i) const
 

Private Attributes

std::vector< Expansion2DWeakPtrm_faceExp
 
std::vector< bool > m_requireNeg
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::LocalRegions::Expansion
SpatialDomains::GeometrySharedPtr m_geom
 
SpatialDomains::GeomFactorsSharedPtr m_metricinfo
 
MetricMap m_metrics
 
- Protected Attributes inherited from Nektar::StdRegions::StdExpansion
Array< OneD, LibUtilities::BasisSharedPtrm_base
 
int m_elmt_id
 
int m_ncoeffs
 
LibUtilities::NekManager< StdMatrixKey, DNekMat, StdMatrixKey::opLessm_stdMatrixManager
 
LibUtilities::NekManager< StdMatrixKey, DNekBlkMat, StdMatrixKey::opLessm_stdStaticCondMatrixManager
 
LibUtilities::NekManager< IndexMapKey, IndexMapValues, IndexMapKey::opLessm_IndexMapManager
 
- Protected Attributes inherited from Nektar::StdRegions::StdExpansion3D
std::map< int, NormalVectorm_faceNormals
 
std::map< int, bool > m_negatedNormals
 

Detailed Description

Definition at line 57 of file Expansion3D.h.

Constructor & Destructor Documentation

◆ Expansion3D()

Nektar::LocalRegions::Expansion3D::Expansion3D ( SpatialDomains::Geometry3DSharedPtr  pGeom)
inline

Definition at line 61 of file Expansion3D.h.

61 : Expansion(pGeom), StdExpansion3D(), m_requireNeg() {}
std::vector< bool > m_requireNeg
Definition: Expansion3D.h:193
Expansion(SpatialDomains::GeometrySharedPtr pGeom)
Definition: Expansion.cpp:47

◆ ~Expansion3D()

virtual Nektar::LocalRegions::Expansion3D::~Expansion3D ( )
inlinevirtual

Member Function Documentation

◆ AddFaceBoundaryInt()

void Nektar::LocalRegions::Expansion3D::AddFaceBoundaryInt ( const int  face,
ExpansionSharedPtr FaceExp,
Array< OneD, NekDouble > &  facePhys,
Array< OneD, NekDouble > &  outarray,
const StdRegions::VarCoeffMap varcoeffs = StdRegions::NullVarCoeffMap 
)
inline

For a given face add the {F}_1j contributions

Definition at line 358 of file Expansion3D.cpp.

References Nektar::StdRegions::eFaceToElement.

Referenced by ~Expansion3D().

364  {
365  boost::ignore_unused(varcoeffs);
366 
367  int i;
368  int order_f = FaceExp->GetNcoeffs();
369  Array<OneD, NekDouble> coeff(order_f);
370 
371  StdRegions::IndexMapKey ikey(
374  face, GetForient(face));
376  StdExpansion::GetIndexMap(ikey);
377 
378 // StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
379 // StdRegions::eVarCoeffD11,
380 // StdRegions::eVarCoeffD22};
381 // StdRegions::VarCoeffMap::const_iterator x;
382 // Array<OneD, NekDouble> varcoeff_work(nquad_e);
383 //
384 ///// @TODO Variable coeffs
385 // if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
386 // {
387 // GetPhysEdgeVarCoeffsFromElement(edge,EdgeExp,x->second,varcoeff_work);
388 // Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp->GetPhys(),1,EdgeExp->UpdatePhys(),1);
389 // }
390 
391  FaceExp->IProductWRTBase(facePhys, coeff);
392 
393  // add data to out array
394  for(i = 0; i < order_f; ++i)
395  {
396  outarray[(*map)[i].index] += (*map)[i].sign*coeff[i];
397  }
398  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:469
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:177
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124

◆ AddHDGHelmholtzFaceTerms()

void Nektar::LocalRegions::Expansion3D::AddHDGHelmholtzFaceTerms ( const NekDouble  tau,
const int  edge,
Array< OneD, NekDouble > &  facePhys,
const StdRegions::VarCoeffMap dirForcing,
Array< OneD, NekDouble > &  outarray 
)
inline

Definition at line 52 of file Expansion3D.cpp.

References Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eInvMass, Nektar::StdRegions::eVarCoeffMass, Nektar::StdRegions::eVarCoeffMF, Nektar::StdRegions::eVarCoeffMF1x, Nektar::StdRegions::eVarCoeffMFDiv, Nektar::StdRegions::eWeakDeriv0, Nektar::StdRegions::eWeakDeriv1, Nektar::StdRegions::eWeakDeriv2, Nektar::StdRegions::eWeakDirectionalDeriv, Nektar::eWrapper, Vmath::Neg(), Nektar::StdRegions::NullConstFactorMap, and Vmath::Vmul().

Referenced by ~Expansion3D().

58  {
59  ExpansionSharedPtr FaceExp = GetFaceExp(face);
60  int i,j,n;
61  int nquad_f = FaceExp->GetNumPoints(0)*FaceExp->GetNumPoints(1);
62  int order_f = FaceExp->GetNcoeffs();
63  int coordim = GetCoordim();
64  int ncoeffs = GetNcoeffs();
65  bool mmf = (varcoeffs.find(StdRegions::eVarCoeffMF1x)
66  != varcoeffs.end());
67 
68  Array<OneD, NekDouble> inval (nquad_f);
69  Array<OneD, NekDouble> outcoeff(order_f);
70  Array<OneD, NekDouble> tmpcoeff(ncoeffs);
71 
72  const Array<OneD, const Array<OneD, NekDouble> > &normals
73  = GetFaceNormal(face);
74 
76 
77  DNekVec Coeffs(ncoeffs,outarray,eWrapper);
78  DNekVec Tmpcoeff(ncoeffs,tmpcoeff,eWrapper);
79 
80  StdRegions::IndexMapKey ikey(
83  face, GetForient(face));
85  StdExpansion::GetIndexMap(ikey);
86 
90 
91  // @TODO Variable coefficients
92  /*
93  StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
94  StdRegions::eVarCoeffD11,
95  StdRegions::eVarCoeffD22};
96  Array<OneD, NekDouble> varcoeff_work(nquad_f);
97  StdRegions::VarCoeffMap::const_iterator x;
98  ///// @TODO: What direction to use here??
99  if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
100  {
101  GetPhysFaceVarCoeffsFromElement(face,FaceExp,x->second,varcoeff_work);
102  Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp->GetPhys(),1,FaceExp->UpdatePhys(),1);
103  }
104  */
105 
106  //================================================================
107  // Add F = \tau <phi_i,in_phys>
108  // Fill face and take inner product
109  FaceExp->IProductWRTBase(facePhys, outcoeff);
110 
111  for(i = 0; i < order_f; ++i)
112  {
113  outarray[(*map)[i].index] += (*map)[i].sign*tau*outcoeff[i];
114  }
115  //================================================================
116 
117 
118  //===============================================================
119  // Add -\sum_i D_i^T M^{-1} G_i + E_i M^{-1} G_i =
120  // \sum_i D_i M^{-1} G_i term
121 
122  // Three independent direction
123  for(n = 0; n < coordim; ++n)
124  {
125  if (mmf) {
127  Weight[StdRegions::eVarCoeffMass] = v_GetMFMag(n,varcoeffs);
128 
129  MatrixKey invMasskey( StdRegions::eInvMass,
130  DetShapeType(), *this,
132  Weight);
133 
134  invMass = *GetLocMatrix(invMasskey);
135 
136  Array<OneD, NekDouble> ncdotMF_f =
137  v_GetnFacecdotMF(n, face, FaceExp, normals, varcoeffs);
138 
139  Vmath::Vmul(nquad_f, ncdotMF_f, 1, facePhys, 1, inval, 1);
140  }
141  else {
142  Vmath::Vmul(nquad_f, normals[n], 1, facePhys, 1, inval, 1);
143  }
144 
145  NekDouble scale = invMass.Scale();
146  const NekDouble *data = invMass.GetRawPtr();
147 
148  if (m_negatedNormals[face])
149  {
150  Vmath::Neg(nquad_f, inval, 1);
151  }
152 
153  // @TODO Multiply by variable coefficients
154  // @TODO: Document this (probably not needed)
155  /*
156  StdRegions::VarCoeffMap::const_iterator x;
157  if ((x = varcoeffs.find(VarCoeff[n])) != varcoeffs.end())
158  {
159  GetPhysEdgeVarCoeffsFromElement(edge,FaceExp,x->second,varcoeff_work);
160  Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp->GetPhys(),1,FaceExp->UpdatePhys(),1);
161  }
162  */
163 
164  FaceExp->IProductWRTBase(inval, outcoeff);
165 
166  // M^{-1} G
167  for(i = 0; i < ncoeffs; ++i)
168  {
169  tmpcoeff[i] = 0;
170  for(j = 0; j < order_f; ++j)
171  {
172  tmpcoeff[i] += scale*data[i+(*map)[j].index*ncoeffs]*(*map)[j].sign*outcoeff[j];
173  }
174  }
175 
176  if (mmf)
177  {
178  StdRegions::VarCoeffMap VarCoeffDirDeriv;
179  VarCoeffDirDeriv[StdRegions::eVarCoeffMF]
180  = v_GetMF(n,coordim,varcoeffs);
181  VarCoeffDirDeriv[StdRegions::eVarCoeffMFDiv]
182  = v_GetMFDiv(n,varcoeffs);
183 
184  MatrixKey Dmatkey(StdRegions::eWeakDirectionalDeriv,
185  DetShapeType(), *this,
187  VarCoeffDirDeriv);
188 
189  DNekScalMat &Dmat = *GetLocMatrix(Dmatkey);
190 
191  Coeffs = Coeffs + Dmat*Tmpcoeff;
192  }
193  else
194  {
195  DNekScalMat &Dmat = *GetLocMatrix(DerivType[n]);
196  Coeffs = Coeffs + Dmat*Tmpcoeff;
197  }
198 
199  /*
200  if(varcoeffs.find(VarCoeff[n]) != varcoeffs.end())
201  {
202  MatrixKey mkey(DerivType[n], DetExpansionType(), *this, StdRegions::NullConstFactorMap, varcoeffs);
203  DNekScalMat &Dmat = *GetLocMatrix(mkey);
204  Coeffs = Coeffs + Dmat*Tmpcoeff;
205  }
206 
207  else
208  {
209  DNekScalMat &Dmat = *GetLocMatrix(DerivType[n]);
210  Coeffs = Coeffs + Dmat*Tmpcoeff;
211  }
212  */
213  }
214  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:469
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:177
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
std::map< int, bool > m_negatedNormals
const NormalVector & GetFaceNormal(const int face) const
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
Array< OneD, NekDouble > v_GetMFMag(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:444
Array< OneD, NekDouble > v_GetMF(const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:347
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
double NekDouble
virtual Array< OneD, NekDouble > v_GetnFacecdotMF(const int dir, const int face, ExpansionSharedPtr &FaceExp_f, const Array< OneD, const Array< OneD, NekDouble > > &normals, const StdRegions::VarCoeffMap &varcoeffs)
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:130
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:65
Array< OneD, NekDouble > v_GetMFDiv(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:411
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:85
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:48
Expansion2DSharedPtr GetFaceExp(const int face)
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
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.cpp:186
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:295

◆ AddNormTraceInt() [1/2]

void Nektar::LocalRegions::Expansion3D::AddNormTraceInt ( const int  dir,
Array< OneD, ExpansionSharedPtr > &  FaceExp,
Array< OneD, Array< OneD, NekDouble > > &  faceCoeffs,
Array< OneD, NekDouble > &  outarray 
)
inline

Definition at line 321 of file Expansion3D.cpp.

References Vmath::Neg(), and Vmath::Vmul().

Referenced by ~Expansion3D().

326  {
327  int f, cnt;
328  int order_f, nquad_f;
329  int nfaces = GetNfaces();
330 
331  cnt = 0;
332  for(f = 0; f < nfaces; ++f)
333  {
334  order_f = FaceExp[f]->GetNcoeffs();
335  nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
336 
337  const Array<OneD, const Array<OneD, NekDouble> > &normals = GetFaceNormal(f);
338  Array<OneD, NekDouble> facePhys(nquad_f);
339 
340  cnt += order_f;
341 
342  FaceExp[f]->BwdTrans(faceCoeffs[f], facePhys);
343 
344  Vmath::Vmul(nquad_f, normals[dir], 1, facePhys, 1, facePhys, 1);
345 
346  if (m_negatedNormals[f])
347  {
348  Vmath::Neg(nquad_f, facePhys, 1);
349  }
350 
351  AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray);
352  }
353  }
void AddFaceBoundaryInt(const int face, ExpansionSharedPtr &FaceExp, Array< OneD, NekDouble > &facePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
std::map< int, bool > m_negatedNormals
const NormalVector & GetFaceNormal(const int face) const
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
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.cpp:186

◆ AddNormTraceInt() [2/2]

void Nektar::LocalRegions::Expansion3D::AddNormTraceInt ( const int  dir,
Array< OneD, const NekDouble > &  inarray,
Array< OneD, ExpansionSharedPtr > &  FaceExp,
Array< OneD, NekDouble > &  outarray,
const StdRegions::VarCoeffMap varcoeffs 
)
inline

Computes the C matrix entries due to the presence of the identity matrix in Eqn. 32.

: Document this

Definition at line 249 of file Expansion3D.cpp.

References Nektar::StdRegions::eVarCoeffMF1x, Vmath::Neg(), and Vmath::Vmul().

255  {
256  int i,f,cnt;
257  int order_f,nquad_f;
258  int nfaces = GetNfaces();
259 
260  cnt = 0;
261  for(f = 0; f < nfaces; ++f)
262  {
263  order_f = FaceExp[f]->GetNcoeffs();
264  nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
265 
266  const Array<OneD, const Array<OneD, NekDouble> > &normals = GetFaceNormal(f);
267  Array<OneD, NekDouble> faceCoeffs(order_f);
268  Array<OneD, NekDouble> facePhys (nquad_f);
269 
270  for(i = 0; i < order_f; ++i)
271  {
272  faceCoeffs[i] = inarray[i+cnt];
273  }
274  cnt += order_f;
275 
276  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
277 
278  // Multiply by variable coefficient
279  /// @TODO: Document this
280 // StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
281 // StdRegions::eVarCoeffD11,
282 // StdRegions::eVarCoeffD22};
283 // StdRegions::VarCoeffMap::const_iterator x;
284 // Array<OneD, NekDouble> varcoeff_work(nquad_e);
285 
286 // if ((x = varcoeffs.find(VarCoeff[dir])) != varcoeffs.end())
287 // {
288 // GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
289 // Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
290 // }
291  StdRegions::VarCoeffMap::const_iterator x;
292  if ((x = varcoeffs.find(StdRegions::eVarCoeffMF1x))
293  != varcoeffs.end())
294  {
295  Array<OneD, NekDouble> ncdotMF_f =
296  v_GetnFacecdotMF(dir, f, FaceExp[f], normals,
297  varcoeffs);
298 
299  Vmath::Vmul(nquad_f, ncdotMF_f, 1,
300  facePhys, 1,
301  facePhys, 1);
302  }
303  else
304  {
305  Vmath::Vmul(nquad_f, normals[dir], 1,
306  facePhys, 1,
307  facePhys, 1);
308  }
309 
310  if (m_negatedNormals[f])
311  {
312  Vmath::Neg(nquad_f, facePhys, 1);
313  }
314 
315  AddFaceBoundaryInt(f, FaceExp[f], facePhys, outarray,
316  varcoeffs);
317  }
318  }
void AddFaceBoundaryInt(const int face, ExpansionSharedPtr &FaceExp, Array< OneD, NekDouble > &facePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
std::map< int, bool > m_negatedNormals
const NormalVector & GetFaceNormal(const int face) const
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
virtual Array< OneD, NekDouble > v_GetnFacecdotMF(const int dir, const int face, ExpansionSharedPtr &FaceExp_f, const Array< OneD, const Array< OneD, NekDouble > > &normals, const StdRegions::VarCoeffMap &varcoeffs)
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
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.cpp:186

◆ GetFaceExp()

Expansion2DSharedPtr Nektar::LocalRegions::Expansion3D::GetFaceExp ( const int  face)

Definition at line 1133 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

1134  {
1135  return m_faceExp[face].lock();
1136  }
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:192

◆ GetGeom3D()

SpatialDomains::Geometry3DSharedPtr Nektar::LocalRegions::Expansion3D::GetGeom3D ( ) const
inline

Definition at line 196 of file Expansion3D.h.

References Nektar::LocalRegions::Expansion::m_geom.

Referenced by Nektar::MultiRegions::ExpList2D::ExpList2D(), Nektar::MultiRegions::DisContField3D::SetUpDG(), Nektar::LocalRegions::HexExp::v_GetFaceDGForwards(), and ~Expansion3D().

197  {
198  return std::dynamic_pointer_cast<SpatialDomains::Geometry3D>(m_geom);
199  }
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:127

◆ GetPhysFaceVarCoeffsFromElement()

void Nektar::LocalRegions::Expansion3D::GetPhysFaceVarCoeffsFromElement ( const int  face,
ExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  varcoeff,
Array< OneD, NekDouble > &  outarray 
)
protected

Definition at line 217 of file Expansion3D.cpp.

References sign.

Referenced by ~Expansion3D().

222  {
223  Array<OneD, NekDouble> tmp(GetNcoeffs());
224  Array<OneD, NekDouble> facetmp(FaceExp->GetNcoeffs());
225 
226  // FwdTrans varcoeffs
227  FwdTrans(varcoeff, tmp);
228 
229  // Map to edge
230  Array<OneD, unsigned int> emap;
231  Array<OneD, int> sign;
232 
233  GetFaceToElementMap(face, GetForient(face), emap, sign);
234 
235  for (unsigned int i = 0; i < FaceExp->GetNcoeffs(); ++i)
236  {
237  facetmp[i] = tmp[emap[i]];
238  }
239 
240  // BwdTrans
241  FaceExp->BwdTrans(facetmp, outarray);
242  }
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:16
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
void GetFaceToElementMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int nummodesA=-1, int nummodesB=-1)
Definition: StdExpansion.h:858
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:130
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This function performs the Forward transformation from physical space to coefficient space...

◆ ReOrientFacePhysMap()

void Nektar::LocalRegions::Expansion3D::ReOrientFacePhysMap ( const int  nvert,
const StdRegions::Orientation  orient,
const int  nq0,
const int  nq1,
Array< OneD, int > &  idmap 
)

Definition at line 2363 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

2367  {
2368  if(nvert == 3)
2369  {
2370  ReOrientTriFacePhysMap(orient,nq0,nq1,idmap);
2371  }
2372  else
2373  {
2374  ReOrientQuadFacePhysMap(orient,nq0,nq1,idmap);
2375  }
2376  }
void ReOrientQuadFacePhysMap(const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
void ReOrientTriFacePhysMap(const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)

◆ ReOrientQuadFacePhysMap()

void Nektar::LocalRegions::Expansion3D::ReOrientQuadFacePhysMap ( const StdRegions::Orientation  orient,
const int  nq0,
const int  nq1,
Array< OneD, int > &  idmap 
)
protected

Definition at line 2413 of file Expansion3D.cpp.

References ASSERTL0, Nektar::StdRegions::eDir1BwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1BwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1BwdDir2_Dir2FwdDir1, Nektar::StdRegions::eDir1FwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1FwdDir2_Dir2BwdDir1, and Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1.

Referenced by ~Expansion3D().

2417  {
2418  if(idmap.num_elements() != nq0*nq1)
2419  {
2420  idmap = Array<OneD,int>(nq0*nq1);
2421  }
2422 
2423 
2424  switch(orient)
2425  {
2427  // eseentially straight copy
2428  for(int i = 0; i < nq0*nq1; ++i)
2429  {
2430  idmap[i] = i;
2431  }
2432  break;
2434  {
2435  //Direction A negative and B positive
2436  for (int j = 0; j < nq1; j++)
2437  {
2438  for (int i =0; i < nq0; ++i)
2439  {
2440  idmap[j*nq0+i] = nq0-1-i + j*nq0;
2441  }
2442  }
2443  }
2444  break;
2446  {
2447  //Direction A positive and B negative
2448  for (int j = 0; j < nq1; j++)
2449  {
2450  for (int i =0; i < nq0; ++i)
2451  {
2452  idmap[j*nq0+i] = nq0*(nq1-1-j)+i;
2453  }
2454  }
2455  }
2456  break;
2458  {
2459  //Direction A negative and B negative
2460  for (int j = 0; j < nq1; j++)
2461  {
2462  for (int i =0; i < nq0; ++i)
2463  {
2464  idmap[j*nq0+i] = nq0*nq1-1-j*nq0 -i;
2465  }
2466  }
2467  }
2468  break;
2470  {
2471  //Transposed, Direction A and B positive
2472  for (int i =0; i < nq0; ++i)
2473  {
2474  for (int j = 0; j < nq1; ++j)
2475  {
2476  idmap[i*nq1+j] = i + j*nq0;
2477  }
2478  }
2479  }
2480  break;
2482  {
2483  //Transposed, Direction A positive and B negative
2484  for (int i =0; i < nq0; ++i)
2485  {
2486  for (int j = 0; j < nq1; ++j)
2487  {
2488  idmap[i*nq1+j] = nq0-1-i + j*nq0;
2489  }
2490  }
2491  }
2492  break;
2494  {
2495  //Transposed, Direction A negative and B positive
2496  for (int i =0; i < nq0; ++i)
2497  {
2498  for (int j = 0; j < nq1; ++j)
2499  {
2500  idmap[i*nq1+j] = i+nq0*(nq1-1)-j*nq0;
2501  }
2502  }
2503  }
2504  break;
2506  {
2507  //Transposed, Direction A and B negative
2508  for (int i =0; i < nq0; ++i)
2509  {
2510  for (int j = 0; j < nq1; ++j)
2511  {
2512  idmap[i*nq1+j] = nq0*nq1-1-i-j*nq0;
2513  }
2514  }
2515  }
2516  break;
2517  default:
2518  ASSERTL0(false,"Unknow orientation");
2519  break;
2520  }
2521  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

◆ ReOrientTriFacePhysMap()

void Nektar::LocalRegions::Expansion3D::ReOrientTriFacePhysMap ( const StdRegions::Orientation  orient,
const int  nq0,
const int  nq1,
Array< OneD, int > &  idmap 
)
protected

Definition at line 2378 of file Expansion3D.cpp.

References ASSERTL0, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, and Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2.

Referenced by ~Expansion3D().

2382  {
2383  if(idmap.num_elements() != nq0*nq1)
2384  {
2385  idmap = Array<OneD,int>(nq0*nq1);
2386  }
2387 
2388  switch(orient)
2389  {
2391  // eseentially straight copy
2392  for(int i = 0; i < nq0*nq1; ++i)
2393  {
2394  idmap[i] = i;
2395  }
2396  break;
2398  // reverse
2399  for (int j = 0; j < nq1; ++j)
2400  {
2401  for(int i = 0; i < nq0; ++i)
2402  {
2403  idmap[j*nq0+i] = nq0-1-i +j*nq0;
2404  }
2405  }
2406  break;
2407  default:
2408  ASSERTL0(false,"Case not supposed to be used in this function");
2409  }
2410  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

◆ SetFaceExp()

void Nektar::LocalRegions::Expansion3D::SetFaceExp ( const int  face,
Expansion2DSharedPtr f 
)

Definition at line 1122 of file Expansion3D.cpp.

References ASSERTL1.

Referenced by ~Expansion3D().

1123  {
1124  int nFaces = GetNfaces();
1125  ASSERTL1(face < nFaces, "Face is out of range.");
1126  if (m_faceExp.size() < nFaces)
1127  {
1128  m_faceExp.resize(nFaces);
1129  }
1130  m_faceExp[face] = f;
1131  }
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:192
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ SetFaceToGeomOrientation()

void Nektar::LocalRegions::Expansion3D::SetFaceToGeomOrientation ( const int  face,
Array< OneD, NekDouble > &  inout 
)

Align face orientation with the geometry orientation.

Definition at line 403 of file Expansion3D.cpp.

References ASSERTL1, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eFaceToElement, and Vmath::Vcopy().

Referenced by ~Expansion3D().

405  {
406  int j,k;
407  int nface = GetFaceNcoeffs(face);
408  Array<OneD, NekDouble> f_in(nface);
409  Vmath::Vcopy(nface,&inout[0],1,&f_in[0],1);
410 
411  // retreiving face to element map for standard face orientation and
412  // for actual face orientation
413  StdRegions::IndexMapKey ikey1(
418  StdExpansion::GetIndexMap(ikey1);
419  StdRegions::IndexMapKey ikey2(
422  face, GetForient(face));
424  StdExpansion::GetIndexMap(ikey2);
425 
426  ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
427  "There is an error with the GetFaceToElementMap");
428 
429  for(j = 0; j < (*map1).num_elements(); ++j)
430  {
431  // j = index in the standard orientation
432  for(k = 0; k < (*map2).num_elements(); ++k)
433  {
434  // k = index in the actual orientation
435  if((*map1)[j].index == (*map2)[k].index && k != j)
436  {
437  inout[k] = f_in[j];
438  //checking if sign is changing
439  if((*map1)[j].sign != (*map2)[k].sign)
440  inout[k] *= -1.0;
441  break;
442  }
443  }
444  }
445  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:469
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:177
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:353
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ SetTraceToGeomOrientation()

void Nektar::LocalRegions::Expansion3D::SetTraceToGeomOrientation ( Array< OneD, NekDouble > &  inout)

Align trace orientation with the geometry orientation.

Definition at line 450 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

451  {
452  int i,cnt = 0;
453  int nfaces = GetNfaces();
454 
455  Array<OneD, NekDouble> f_tmp;
456 
457  for(i = 0; i < nfaces; ++i)
458  {
459  SetFaceToGeomOrientation(i, f_tmp = inout + cnt);
460  cnt += GetFaceNcoeffs(i);
461  }
462  }
void SetFaceToGeomOrientation(const int face, Array< OneD, NekDouble > &inout)
Align face orientation with the geometry orientation.
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:353
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437

◆ v_AddFaceNormBoundaryInt()

void Nektar::LocalRegions::Expansion3D::v_AddFaceNormBoundaryInt ( const int  face,
const ExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  Fn,
Array< OneD, NekDouble > &  outarray 
)
protectedvirtual

Definition at line 1138 of file Expansion3D.cpp.

References Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eMass, Nektar::LibUtilities::eQuadrilateral, and Nektar::LibUtilities::eTriangle.

Referenced by ~Expansion3D().

1143  {
1144  int i, j;
1145 
1146  /*
1147  * Coming into this routine, the velocity V will have been
1148  * multiplied by the trace normals to give the input vector Vn. By
1149  * convention, these normals are inwards facing for elements which
1150  * have FaceExp as their right-adjacent face. This conditional
1151  * statement therefore determines whether the normals must be
1152  * negated, since the integral being performed here requires an
1153  * outwards facing normal.
1154  */
1155  if (m_requireNeg.size() == 0)
1156  {
1157  m_requireNeg.resize(GetNfaces());
1158 
1159  for (i = 0; i < GetNfaces(); ++i)
1160  {
1161  m_requireNeg[i] = false;
1162  if (m_negatedNormals[i])
1163  {
1164  m_requireNeg[i] = true;
1165  continue;
1166  }
1167 
1168  Expansion2DSharedPtr faceExp = m_faceExp[i].lock();
1169 
1170  if (faceExp->GetRightAdjacentElementExp())
1171  {
1172  if (faceExp->GetRightAdjacentElementExp()->GetGeom3D()
1173  ->GetGlobalID() == GetGeom3D()->GetGlobalID())
1174  {
1175  m_requireNeg[i] = true;
1176  }
1177  }
1178  }
1179  }
1180 
1181  StdRegions::IndexMapKey ikey(
1184  face, GetForient(face));
1186  StdExpansion::GetIndexMap(ikey);
1187 
1188  int order_e = (*map).num_elements(); // Order of the element
1189  int n_coeffs = FaceExp->GetNcoeffs();
1190 
1191  Array<OneD, NekDouble> faceCoeffs(n_coeffs);
1192 
1193  if (n_coeffs != order_e) // Going to orthogonal space
1194  {
1195  Array<OneD, NekDouble> coeff(n_coeffs);
1196  Array<OneD, NekDouble> array(n_coeffs);
1197 
1198  FaceExp->FwdTrans(Fn, faceCoeffs);
1199 
1200  int NumModesElementMax = FaceExp->GetBasis(0)->GetNumModes();
1201  int NumModesElementMin = m_base[0]->GetNumModes();
1202 
1203  FaceExp->ReduceOrderCoeffs(NumModesElementMin,
1204  faceCoeffs,
1205  faceCoeffs);
1206 
1207  StdRegions::StdMatrixKey masskey(StdRegions::eMass,
1208  FaceExp->DetShapeType(),
1209  *FaceExp);
1210  FaceExp->MassMatrixOp(faceCoeffs, faceCoeffs, masskey);
1211 
1212  // Reorder coefficients for the lower degree face.
1213  int offset1 = 0, offset2 = 0;
1214 
1215  if (FaceExp->DetShapeType() == LibUtilities::eQuadrilateral)
1216  {
1217  for (i = 0; i < NumModesElementMin; ++i)
1218  {
1219  for (j = 0; j < NumModesElementMin; ++j)
1220  {
1221  faceCoeffs[offset1+j] =
1222  faceCoeffs[offset2+j];
1223  }
1224  offset1 += NumModesElementMin;
1225  offset2 += NumModesElementMax;
1226  }
1227 
1228  // Extract lower degree modes. TODO: Check this is correct.
1229  for (i = NumModesElementMin; i < NumModesElementMax; ++i)
1230  {
1231  for (j = NumModesElementMin; j < NumModesElementMax; ++j)
1232  {
1233  faceCoeffs[i*NumModesElementMax+j] = 0.0;
1234  }
1235  }
1236  }
1237 
1238  if (FaceExp->DetShapeType() == LibUtilities::eTriangle)
1239  {
1240 
1241  // Reorder coefficients for the lower degree face.
1242  int offset1 = 0, offset2 = 0;
1243 
1244  for (i = 0; i < NumModesElementMin; ++i)
1245  {
1246  for (j = 0; j < NumModesElementMin-i; ++j)
1247  {
1248  faceCoeffs[offset1+j] =
1249  faceCoeffs[offset2+j];
1250  }
1251  offset1 += NumModesElementMin-i;
1252  offset2 += NumModesElementMax-i;
1253  }
1254  }
1255 
1256  }
1257  else
1258  {
1259  FaceExp->IProductWRTBase(Fn, faceCoeffs);
1260  }
1261 
1262  if (m_requireNeg[face])
1263  {
1264  for (i = 0; i < order_e; ++i)
1265  {
1266  outarray[(*map)[i].index] -= (*map)[i].sign * faceCoeffs[i];
1267  }
1268  }
1269  else
1270  {
1271  for (i = 0; i < order_e; ++i)
1272  {
1273  outarray[(*map)[i].index] += (*map)[i].sign * faceCoeffs[i];
1274  }
1275  }
1276  }
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:469
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:177
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
std::vector< bool > m_requireNeg
Definition: Expansion3D.h:193
std::map< int, bool > m_negatedNormals
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:192
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:196
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:47
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124
Array< OneD, LibUtilities::BasisSharedPtr > m_base

◆ v_AddRobinMassMatrix()

void Nektar::LocalRegions::Expansion3D::v_AddRobinMassMatrix ( const int  face,
const Array< OneD, const NekDouble > &  primCoeffs,
DNekMatSharedPtr inoutmat 
)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1314 of file Expansion3D.cpp.

References ASSERTL0, ASSERTL1, ASSERTL2, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eMass, Nektar::StdRegions::eVarCoeffMass, Nektar::StdRegions::NullConstFactorMap, and sign.

Referenced by ~Expansion3D().

1318  {
1320  "Not set up for non boundary-interior expansions");
1321  ASSERTL1(inoutmat->GetRows() == inoutmat->GetColumns(),
1322  "Assuming that input matrix was square");
1323 
1324  int i,j;
1325  int id1,id2;
1326  Expansion2DSharedPtr faceExp = m_faceExp[face].lock();
1327  int order_f = faceExp->GetNcoeffs();
1328 
1329  Array<OneD, unsigned int> map;
1330  Array<OneD, int> sign;
1331 
1332  StdRegions::VarCoeffMap varcoeffs;
1333  varcoeffs[StdRegions::eVarCoeffMass] = primCoeffs;
1334 
1335  LibUtilities::ShapeType shapeType =
1336  faceExp->DetShapeType();
1337 
1338  LocalRegions::MatrixKey mkey(StdRegions::eMass,
1339  shapeType,
1340  *faceExp,
1342  varcoeffs);
1343 
1344  DNekScalMat &facemat = *faceExp->GetLocMatrix(mkey);
1345 
1346  // Now need to identify a map which takes the local face
1347  // mass matrix to the matrix stored in inoutmat;
1348  // This can currently be deduced from the size of the matrix
1349 
1350  // - if inoutmat.m_rows() == v_NCoeffs() it is a full
1351  // matrix system
1352 
1353  // - if inoutmat.m_rows() == v_GetNverts() it is a vertex space
1354  // preconditioner.
1355 
1356  // - if inoutmat.m_rows() == v_NumBndCoeffs() it is a
1357  // boundary CG system
1358 
1359  // - if inoutmat.m_rows() == v_NumDGBndCoeffs() it is a
1360  // trace DG system; still needs implementing.
1361  int rows = inoutmat->GetRows();
1362 
1363  if (rows == GetNcoeffs())
1364  {
1365  GetFaceToElementMap(face,GetForient(face),map,sign);
1366  }
1367  else if (rows == GetNverts())
1368  {
1369  int nfvert = faceExp->GetNverts();
1370 
1371  // Need to find where linear vertices are in facemat
1372  Array<OneD, unsigned int> linmap;
1373  Array<OneD, int> linsign;
1374 
1375  // Use a linear expansion to get correct mapping
1376  GetLinStdExp()->GetFaceToElementMap(face,GetForient(face),linmap, linsign);
1377 
1378  // zero out sign map to remove all other modes
1379  sign = Array<OneD, int> (order_f,0);
1380  map = Array<OneD, unsigned int>(order_f,(unsigned int)0);
1381 
1382  int fmap;
1383  // Reset sign map to only have contribution from vertices
1384  for(i = 0; i < nfvert; ++i)
1385  {
1386  fmap = faceExp->GetVertexMap(i,true);
1387  sign[fmap] = 1;
1388 
1389  // need to reset map
1390  map[fmap] = linmap[i];
1391  }
1392  }
1393  else if(rows == NumBndryCoeffs())
1394  {
1395  int nbndry = NumBndryCoeffs();
1396  Array<OneD,unsigned int> bmap(nbndry);
1397 
1398  GetFaceToElementMap(face,GetForient(face),map,sign);
1399  GetBoundaryMap(bmap);
1400 
1401  for(i = 0; i < order_f; ++i)
1402  {
1403  for(j = 0; j < nbndry; ++j)
1404  {
1405  if(map[i] == bmap[j])
1406  {
1407  map[i] = j;
1408  break;
1409  }
1410  }
1411  ASSERTL1(j != nbndry,"Did not find number in map");
1412  }
1413  }
1414  else if (rows == NumDGBndryCoeffs())
1415  {
1416  // possibly this should be a separate method
1417  int cnt = 0;
1418  map = Array<OneD, unsigned int> (order_f);
1419  sign = Array<OneD, int> (order_f,1);
1420 
1421  StdRegions::IndexMapKey ikey1(
1424  face, GetForient(face));
1426  StdExpansion::GetIndexMap(ikey1);
1427  StdRegions::IndexMapKey ikey2(
1429  DetShapeType(),
1430  GetBasisNumModes(0),
1431  GetBasisNumModes(1),
1432  GetBasisNumModes(2),
1433  face,
1436  StdExpansion::GetIndexMap(ikey2);
1437 
1438  ASSERTL1((*map1).num_elements() == (*map2).num_elements(),
1439  "There is an error with the GetFaceToElementMap");
1440 
1441  for (i = 0; i < face; ++i)
1442  {
1443  cnt += GetFaceNcoeffs(i);
1444  }
1445 
1446  for(i = 0; i < (*map1).num_elements(); ++i)
1447  {
1448  int idx = -1;
1449 
1450  for(j = 0; j < (*map2).num_elements(); ++j)
1451  {
1452  if((*map1)[i].index == (*map2)[j].index)
1453  {
1454  idx = j;
1455  break;
1456  }
1457  }
1458 
1459  ASSERTL2(idx >= 0, "Index not found");
1460  map [i] = idx + cnt;
1461  sign[i] = (*map2)[idx].sign;
1462  }
1463  }
1464  else
1465  {
1466  ASSERTL0(false,"Could not identify matrix type from dimension");
1467  }
1468 
1469  for(i = 0; i < order_f; ++i)
1470  {
1471  id1 = map[i];
1472  for(j = 0; j < order_f; ++j)
1473  {
1474  id2 = map[j];
1475  (*inoutmat)(id1,id2) += facemat(i,j)*sign[i]*sign[j];
1476  }
1477  }
1478  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:469
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:16
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:177
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:258
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:353
void GetFaceToElementMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int nummodesA=-1, int nummodesB=-1)
Definition: StdExpansion.h:858
std::shared_ptr< StdExpansion > GetLinStdExp(void) const
Definition: StdExpansion.h:480
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:130
std::vector< Expansion2DWeakPtr > m_faceExp
Definition: Expansion3D.h:192
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:47
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:274
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:812
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:295

◆ v_BuildInverseTransformationMatrix()

DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_BuildInverseTransformationMatrix ( const DNekScalMatSharedPtr transformationmatrix)
protectedvirtual

Build inverse and inverse transposed transformation matrix: \(\mathbf{R^{-1}}\) and \(\mathbf{R^{-T}}\).

{R^{-T}}=[[{array}{ccc} {I} & -{R}_{ef} & -{R}_{ve}+{R}_{ve}{R}_{vf} \ 0 & {I} & {R}_{ef} \ 0 & 0 & {I}} {array}]]

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 1922 of file Expansion3D.cpp.

References Nektar::eFULL, and Vmath::Vcopy().

Referenced by ~Expansion3D().

1924  {
1925  int i, j, n, eid = 0, fid = 0;
1926  int nCoeffs = NumBndryCoeffs();
1927  NekDouble MatrixValue;
1928  DNekScalMat &R = (*transformationmatrix);
1929 
1930  // Define storage for vertex transpose matrix and zero all entries
1931  MatrixStorage storage = eFULL;
1932 
1933  // Inverse transformation matrix
1934  DNekMatSharedPtr inversetransformationmatrix =
1936  nCoeffs, nCoeffs, 0.0, storage);
1937  DNekMat &InvR = (*inversetransformationmatrix);
1938 
1939  int nVerts = GetNverts();
1940  int nEdges = GetNedges();
1941  int nFaces = GetNfaces();
1942 
1943  int nedgemodes = 0;
1944  int nfacemodes = 0;
1945  int nedgemodestotal = 0;
1946  int nfacemodestotal = 0;
1947 
1948  for (eid = 0; eid < nEdges; ++eid)
1949  {
1950  nedgemodes = GetEdgeNcoeffs(eid) - 2;
1951  nedgemodestotal += nedgemodes;
1952  }
1953 
1954  for (fid = 0; fid < nFaces; ++fid)
1955  {
1956  nfacemodes = GetFaceIntNcoeffs(fid);
1957  nfacemodestotal += nfacemodes;
1958  }
1959 
1960  Array<OneD, unsigned int>
1961  edgemodearray(nedgemodestotal);
1962  Array<OneD, unsigned int>
1963  facemodearray(nfacemodestotal);
1964 
1965  int offset = 0;
1966 
1967  // Create array of edge modes
1968  for (eid = 0; eid < nEdges; ++eid)
1969  {
1970  Array<OneD, unsigned int> edgearray
1972  nedgemodes = GetEdgeNcoeffs(eid) - 2;
1973 
1974  // Only copy if there are edge modes
1975  if (nedgemodes)
1976  {
1977  Vmath::Vcopy(nedgemodes, &edgearray[0], 1,
1978  &edgemodearray[offset], 1);
1979  }
1980 
1981  offset += nedgemodes;
1982  }
1983 
1984  offset = 0;
1985 
1986  // Create array of face modes
1987  for (fid = 0; fid < nFaces; ++fid)
1988  {
1989  Array<OneD, unsigned int> facearray
1991  nfacemodes = GetFaceIntNcoeffs(fid);
1992 
1993  // Only copy if there are face modes
1994  if (nfacemodes)
1995  {
1996  Vmath::Vcopy(nfacemodes, &facearray[0], 1,
1997  &facemodearray[offset], 1);
1998  }
1999 
2000  offset += nfacemodes;
2001  }
2002 
2003  // Vertex-edge/face
2004  for (i = 0; i < nVerts; ++i)
2005  {
2006  for (j = 0; j < nedgemodestotal; ++j)
2007  {
2008  InvR.SetValue(
2009  GetVertexMap(i), edgemodearray[j],
2010  -R(GetVertexMap(i), edgemodearray[j]));
2011  }
2012  for (j = 0; j < nfacemodestotal; ++j)
2013  {
2014  InvR.SetValue(
2015  GetVertexMap(i), facemodearray[j],
2016  -R(GetVertexMap(i), facemodearray[j]));
2017  for (n = 0; n < nedgemodestotal; ++n)
2018  {
2019  MatrixValue = InvR.GetValue(GetVertexMap(i),
2020  facemodearray[j])
2021  + R(GetVertexMap(i), edgemodearray[n])
2022  * R(edgemodearray[n], facemodearray[j]);
2023  InvR.SetValue(GetVertexMap(i),
2024  facemodearray[j],
2025  MatrixValue);
2026  }
2027  }
2028  }
2029 
2030  // Edge-face contributions
2031  for (i = 0; i < nedgemodestotal; ++i)
2032  {
2033  for (j = 0; j < nfacemodestotal; ++j)
2034  {
2035  InvR.SetValue(
2036  edgemodearray[i], facemodearray[j],
2037  -R(edgemodearray[i], facemodearray[j]));
2038  }
2039  }
2040 
2041  for (i = 0; i < nCoeffs; ++i)
2042  {
2043  InvR.SetValue(i, i, 1.0);
2044  }
2045 
2046  return inversetransformationmatrix;
2047  }
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:258
Array< OneD, unsigned int > GetEdgeInverseBoundaryMap(int eid)
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:286
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:822
Array< OneD, unsigned int > GetFaceInverseBoundaryMap(int fid, StdRegions::Orientation faceOrient=eNoOrientation, int P1=-1, int P2=-1)
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:358
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:51
double NekDouble
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:271
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat

◆ v_BuildTransformationMatrix()

DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_BuildTransformationMatrix ( const DNekScalMatSharedPtr r_bnd,
const StdRegions::MatrixType  matrixType 
)
protectedvirtual

The matrix component of \(\mathbf{R}\) is given by

\[ \mathbf{R^{T}_{v}}= -\mathbf{S}^{-1}_{ef,ef}\mathbf{S}^{T}_{v,ef}\]

For every vertex mode we extract the submatrices from statically condensed matrix \(\mathbf{S}\) corresponding to the coupling between the attached edges and faces of a vertex ( \(\mathbf{S_{ef,ef}}\)). This matrix is then inverted and multiplied by the submatrix representing the coupling between a vertex and the attached edges and faces ( \(\mathbf{S_{v,ef}}\)).

Reimplemented from Nektar::LocalRegions::Expansion.

Definition at line 1511 of file Expansion3D.cpp.

References Nektar::eFULL, Nektar::StdRegions::ePreconR, Nektar::StdRegions::ePreconRMass, NEKERROR, Nektar::NullDNekMatSharedPtr, and Vmath::Vcopy().

Referenced by ~Expansion3D().

1514  {
1515  int nVerts, nEdges;
1516  int eid, fid, vid, n, i;
1517 
1518  int nBndCoeffs = NumBndryCoeffs();
1519 
1521 
1522  // Get geometric information about this element
1523  nVerts = GetNverts();
1524  nEdges = GetNedges();
1525 
1526  /*************************************/
1527  /* Vetex-edge & vertex-face matrices */
1528  /*************************************/
1529 
1530  /**
1531  * The matrix component of \f$\mathbf{R}\f$ is given by \f[
1532  * \mathbf{R^{T}_{v}}=
1533  * -\mathbf{S}^{-1}_{ef,ef}\mathbf{S}^{T}_{v,ef}\f]
1534  *
1535  * For every vertex mode we extract the submatrices from statically
1536  * condensed matrix \f$\mathbf{S}\f$ corresponding to the coupling
1537  * between the attached edges and faces of a vertex
1538  * (\f$\mathbf{S_{ef,ef}}\f$). This matrix is then inverted and
1539  * multiplied by the submatrix representing the coupling between a
1540  * vertex and the attached edges and faces
1541  * (\f$\mathbf{S_{v,ef}}\f$).
1542  */
1543 
1544  int nmodes;
1545  int m;
1546  NekDouble VertexEdgeFaceValue;
1547 
1548  // The number of connected edges/faces is 3 (for all elements)
1549  int nConnectedEdges = 3;
1550  int nConnectedFaces = 3;
1551 
1552  // Location in the matrix
1553  Array<OneD, Array<OneD, unsigned int> >
1554  MatEdgeLocation(nConnectedEdges);
1555  Array<OneD, Array<OneD, unsigned int> >
1556  MatFaceLocation(nConnectedFaces);
1557 
1558  // Define storage for vertex transpose matrix and zero all entries
1559  MatrixStorage storage = eFULL;
1560  DNekMatSharedPtr transformationmatrix;
1561 
1562  transformationmatrix =
1564  nBndCoeffs, nBndCoeffs, 0.0, storage);
1565 
1566  DNekMat &R = (*transformationmatrix);
1567 
1568 
1569  // Build the vertex-edge/face transform matrix: This matrix is
1570  // constructed from the submatrices corresponding to the couping
1571  // between each vertex and the attached edges/faces
1572  for (vid = 0; vid < nVerts; ++vid)
1573  {
1574  // Row and column size of the vertex-edge/face matrix
1575  int efRow =
1576  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1577  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1578  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) +
1579  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1580  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1581  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2)) - 6;
1582 
1583  int nedgemodesconnected =
1584  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 0)) +
1585  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 1)) +
1586  GetEdgeNcoeffs (geom->GetVertexEdgeMap(vid, 2)) - 6;
1587  Array<OneD, unsigned int> edgemodearray(nedgemodesconnected);
1588 
1589  int nfacemodesconnected =
1590  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 0)) +
1591  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 1)) +
1592  GetFaceIntNcoeffs(geom->GetVertexFaceMap(vid, 2));
1593  Array<OneD, unsigned int> facemodearray(nfacemodesconnected);
1594 
1595  int offset = 0;
1596 
1597  // Create array of edge modes
1598  for (eid = 0; eid < nConnectedEdges; ++eid)
1599  {
1600  MatEdgeLocation[eid] = GetEdgeInverseBoundaryMap(
1601  geom->GetVertexEdgeMap(vid, eid));
1602  nmodes = MatEdgeLocation[eid].num_elements();
1603 
1604  if (nmodes)
1605  {
1606  Vmath::Vcopy(nmodes, &MatEdgeLocation[eid][0],
1607  1, &edgemodearray[offset], 1);
1608  }
1609 
1610  offset += nmodes;
1611  }
1612 
1613  offset = 0;
1614 
1615  // Create array of face modes
1616  for (fid = 0; fid < nConnectedFaces; ++fid)
1617  {
1618  MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1619  geom->GetVertexFaceMap(vid, fid));
1620  nmodes = MatFaceLocation[fid].num_elements();
1621 
1622  if (nmodes)
1623  {
1624  Vmath::Vcopy(nmodes, &MatFaceLocation[fid][0],
1625  1, &facemodearray[offset], 1);
1626  }
1627  offset += nmodes;
1628  }
1629 
1630  DNekMatSharedPtr vertexedgefacetransformmatrix =
1632  1, efRow, 0.0, storage);
1633  DNekMat &Sveft = (*vertexedgefacetransformmatrix);
1634 
1635  DNekMatSharedPtr vertexedgefacecoupling =
1637  1, efRow, 0.0, storage);
1638  DNekMat &Svef = (*vertexedgefacecoupling);
1639 
1640  // Vertex-edge coupling
1641  for (n = 0; n < nedgemodesconnected; ++n)
1642  {
1643  // Matrix value for each coefficient location
1644  VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1645  edgemodearray[n]);
1646 
1647  // Set the value in the vertex edge/face matrix
1648  Svef.SetValue(0, n, VertexEdgeFaceValue);
1649  }
1650 
1651  // Vertex-face coupling
1652  for (n = 0; n < nfacemodesconnected; ++n)
1653  {
1654  // Matrix value for each coefficient location
1655  VertexEdgeFaceValue = (*r_bnd)(GetVertexMap(vid),
1656  facemodearray[n]);
1657 
1658  // Set the value in the vertex edge/face matrix
1659  Svef.SetValue(0, n + nedgemodesconnected,
1660  VertexEdgeFaceValue);
1661  }
1662 
1663  /*
1664  * Build the edge-face transform matrix: This matrix is
1665  * constructed from the submatrices corresponding to the couping
1666  * between the edges and faces on the attached faces/edges of a
1667  * vertex.
1668  */
1669 
1670  // Allocation of matrix to store edge/face-edge/face coupling
1671  DNekMatSharedPtr edgefacecoupling =
1673  efRow, efRow, 0.0, storage);
1674  DNekMat &Sefef = (*edgefacecoupling);
1675 
1676  NekDouble EdgeEdgeValue, FaceFaceValue;
1677 
1678  // Edge-edge coupling (S_{ee})
1679  for (m = 0; m < nedgemodesconnected; ++m)
1680  {
1681  for (n = 0; n < nedgemodesconnected; ++n)
1682  {
1683  // Matrix value for each coefficient location
1684  EdgeEdgeValue = (*r_bnd)(edgemodearray[n],
1685  edgemodearray[m]);
1686 
1687  // Set the value in the vertex edge/face matrix
1688  Sefef.SetValue(n, m, EdgeEdgeValue);
1689  }
1690  }
1691 
1692  // Face-face coupling (S_{ff})
1693  for (n = 0; n < nfacemodesconnected; ++n)
1694  {
1695  for (m = 0; m < nfacemodesconnected; ++m)
1696  {
1697  // Matrix value for each coefficient location
1698  FaceFaceValue = (*r_bnd)(facemodearray[n],
1699  facemodearray[m]);
1700  // Set the value in the vertex edge/face matrix
1701  Sefef.SetValue(nedgemodesconnected + n,
1702  nedgemodesconnected + m, FaceFaceValue);
1703  }
1704  }
1705 
1706  // Edge-face coupling (S_{ef} and trans(S_{ef}))
1707  for (n = 0; n < nedgemodesconnected; ++n)
1708  {
1709  for (m = 0; m < nfacemodesconnected; ++m)
1710  {
1711  // Matrix value for each coefficient location
1712  FaceFaceValue = (*r_bnd)(edgemodearray[n],
1713  facemodearray[m]);
1714 
1715  // Set the value in the vertex edge/face matrix
1716  Sefef.SetValue(n,
1717  nedgemodesconnected + m,
1718  FaceFaceValue);
1719 
1720  FaceFaceValue = (*r_bnd)(facemodearray[m],
1721  edgemodearray[n]);
1722 
1723  // and transpose
1724  Sefef.SetValue(nedgemodesconnected + m,
1725  n,
1726  FaceFaceValue);
1727  }
1728  }
1729 
1730  // Invert edge-face coupling matrix
1731  if (efRow)
1732  {
1733  Sefef.Invert();
1734 
1735 
1736  //R_{v}=-S_{v,ef}inv(S_{ef,ef})
1737  Sveft = -Svef * Sefef;
1738  }
1739 
1740  // Populate R with R_{ve} components
1741  for (n = 0; n < edgemodearray.num_elements(); ++n)
1742  {
1743  R.SetValue(GetVertexMap(vid), edgemodearray[n],
1744  Sveft(0, n));
1745  }
1746 
1747  // Populate R with R_{vf} components
1748  for (n = 0; n < facemodearray.num_elements(); ++n)
1749  {
1750  R.SetValue(GetVertexMap(vid), facemodearray[n],
1751  Sveft(0, n + nedgemodesconnected));
1752  }
1753  }
1754 
1755  /********************/
1756  /* edge-face matrix */
1757  /********************/
1758 
1759  /*
1760  * The matrix component of \f$\mathbf{R}\f$ is given by \f[
1761  * \mathbf{R^{T}_{ef}}=-\mathbf{S}^{-1}_{ff}\mathbf{S}^{T}_{ef}\f]
1762  *
1763  * For each edge extract the submatrices from statically condensed
1764  * matrix \f$\mathbf{S}\f$ corresponding to inner products of modes
1765  * on the two attached faces within themselves as well as the
1766  * coupling matrix between the two faces
1767  * (\f$\mathbf{S}_{ff}\f$). This matrix of face coupling is then
1768  * inverted and multiplied by the submatrices of corresponding to
1769  * the coupling between the edge and attached faces
1770  * (\f$\mathbf{S}_{ef}\f$).
1771  */
1772 
1773  NekDouble EdgeFaceValue, FaceFaceValue;
1774  int efCol, efRow, nedgemodes;
1775 
1776  // Number of attached faces is always 2
1777  nConnectedFaces = 2;
1778 
1779  // Location in the matrix
1780  MatEdgeLocation = Array<OneD, Array<OneD, unsigned int> >
1781  (nEdges);
1782  MatFaceLocation = Array<OneD, Array<OneD, unsigned int> >
1783  (nConnectedFaces);
1784 
1785  // Build the edge/face transform matrix: This matrix is constructed
1786  // from the submatrices corresponding to the couping between a
1787  // specific edge and the two attached faces.
1788  for (eid = 0; eid < nEdges; ++eid)
1789  {
1790  // Row and column size of the vertex-edge/face matrix
1791  efCol = GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1792  GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1793  efRow = GetEdgeNcoeffs(eid) - 2;
1794 
1795  // Edge-face coupling matrix
1796  DNekMatSharedPtr efedgefacecoupling =
1798  efRow, efCol, 0.0, storage);
1799  DNekMat &Mef = (*efedgefacecoupling);
1800 
1801  // Face-face coupling matrix
1802  DNekMatSharedPtr effacefacecoupling =
1804  efCol, efCol, 0.0, storage);
1805  DNekMat &Meff = (*effacefacecoupling);
1806 
1807  // Edge-face transformation matrix
1808  DNekMatSharedPtr edgefacetransformmatrix =
1810  efRow, efCol, 0.0, storage);
1811  DNekMat &Meft = (*edgefacetransformmatrix);
1812 
1813  int nfacemodesconnected =
1814  GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 0)) +
1815  GetFaceIntNcoeffs(geom->GetEdgeFaceMap(eid, 1));
1816  Array<OneD, unsigned int>
1817  facemodearray(nfacemodesconnected);
1818 
1819  // Create array of edge modes
1820  Array<OneD, unsigned int> inedgearray
1822  nedgemodes = GetEdgeNcoeffs(eid) - 2;
1823  Array<OneD, unsigned int> edgemodearray(nedgemodes);
1824 
1825  if (nedgemodes)
1826  {
1827  Vmath::Vcopy(nedgemodes, &inedgearray[0],
1828  1, &edgemodearray[0], 1);
1829  }
1830 
1831  int offset = 0;
1832 
1833  // Create array of face modes
1834  for (fid = 0; fid < nConnectedFaces; ++fid)
1835  {
1836  MatFaceLocation[fid] = GetFaceInverseBoundaryMap(
1837  geom->GetEdgeFaceMap(eid, fid));
1838  nmodes = MatFaceLocation[fid].num_elements();
1839 
1840  if (nmodes)
1841  {
1842  Vmath::Vcopy(nmodes, &MatFaceLocation[fid][0],
1843  1, &facemodearray[offset], 1);
1844  }
1845  offset += nmodes;
1846  }
1847 
1848  // Edge-face coupling
1849  for (n = 0; n < nedgemodes; ++n)
1850  {
1851  for (m = 0; m < nfacemodesconnected; ++m)
1852  {
1853  // Matrix value for each coefficient location
1854  EdgeFaceValue = (*r_bnd)(edgemodearray[n],
1855  facemodearray[m]);
1856 
1857  // Set the value in the edge/face matrix
1858  Mef.SetValue(n, m, EdgeFaceValue);
1859  }
1860  }
1861 
1862  // Face-face coupling
1863  for (n = 0; n < nfacemodesconnected; ++n)
1864  {
1865  for (m = 0; m < nfacemodesconnected; ++m)
1866  {
1867  // Matrix value for each coefficient location
1868  FaceFaceValue = (*r_bnd)(facemodearray[n],
1869  facemodearray[m]);
1870 
1871  // Set the value in the vertex edge/face matrix
1872  Meff.SetValue(n, m, FaceFaceValue);
1873  }
1874  }
1875 
1876  if (efCol)
1877  {
1878  // Invert edge-face coupling matrix
1879  Meff.Invert();
1880 
1881  // trans(R_{ef})=-S_{ef}*(inv(S_{ff})
1882  Meft = -Mef * Meff;
1883  }
1884 
1885  //Populate transformation matrix with Meft
1886  for (n = 0; n < Meft.GetRows(); ++n)
1887  {
1888  for (m = 0; m < Meft.GetColumns(); ++m)
1889  {
1890  R.SetValue(edgemodearray[n], facemodearray[m],
1891  Meft(n, m));
1892  }
1893  }
1894  }
1895 
1896  for (i = 0; i < R.GetRows(); ++i)
1897  {
1898  R.SetValue(i, i, 1.0);
1899  }
1900 
1901  if ((matrixType == StdRegions::ePreconR)||
1902  (matrixType == StdRegions::ePreconRMass))
1903  {
1904  return transformationmatrix;
1905  }
1906  else
1907  {
1908  NEKERROR(ErrorUtil::efatal, "unkown matrix type" );
1909  return NullDNekMatSharedPtr;
1910  }
1911  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
std::shared_ptr< Geometry3D > Geometry3DSharedPtr
Definition: Geometry3D.h:52
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:258
static DNekMatSharedPtr NullDNekMatSharedPtr
Definition: NekTypeDefs.hpp:78
Array< OneD, unsigned int > GetEdgeInverseBoundaryMap(int eid)
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:286
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:822
Array< OneD, unsigned int > GetFaceInverseBoundaryMap(int fid, StdRegions::Orientation faceOrient=eNoOrientation, int P1=-1, int P2=-1)
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:358
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:51
double NekDouble
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:271
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:196
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ v_BuildVertexMatrix()

DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_BuildVertexMatrix ( const DNekScalMatSharedPtr r_bnd)
protectedvirtual

Reimplemented from Nektar::LocalRegions::Expansion.

Definition at line 1480 of file Expansion3D.cpp.

References Nektar::eFULL.

Referenced by ~Expansion3D().

1482  {
1483  MatrixStorage storage = eFULL;
1484  DNekMatSharedPtr vertexmatrix;
1485 
1486  int nVerts, vid1, vid2, vMap1, vMap2;
1487  NekDouble VertexValue;
1488 
1489  nVerts = GetNverts();
1490 
1491  vertexmatrix =
1493  nVerts, nVerts, 0.0, storage);
1494  DNekMat &VertexMat = (*vertexmatrix);
1495 
1496  for (vid1 = 0; vid1 < nVerts; ++vid1)
1497  {
1498  vMap1 = GetVertexMap(vid1,true);
1499 
1500  for (vid2 = 0; vid2 < nVerts; ++vid2)
1501  {
1502  vMap2 = GetVertexMap(vid2,true);
1503  VertexValue = (*r_bnd)(vMap1, vMap2);
1504  VertexMat.SetValue(vid1, vid2, VertexValue);
1505  }
1506  }
1507 
1508  return vertexmatrix;
1509  }
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:258
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:822
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:51
double NekDouble

◆ v_DGDeriv()

void Nektar::LocalRegions::Expansion3D::v_DGDeriv ( const int  dir,
const Array< OneD, const NekDouble > &  incoeffs,
Array< OneD, ExpansionSharedPtr > &  FaceExp,
Array< OneD, Array< OneD, NekDouble > > &  faceCoeffs,
Array< OneD, NekDouble > &  out_d 
)
protectedvirtual

Evaluate coefficients of weak deriviative in the direction dir given the input coefficicents incoeffs and the imposed boundary values in EdgeExp (which will have its phys space updated).

Reimplemented from Nektar::LocalRegions::Expansion.

Definition at line 1284 of file Expansion3D.cpp.

References Nektar::StdRegions::eInvMass, Nektar::StdRegions::eWeakDeriv0, Nektar::StdRegions::eWeakDeriv1, Nektar::StdRegions::eWeakDeriv2, Nektar::eWrapper, Vmath::Neg(), and Nektar::Transpose().

Referenced by ~Expansion3D().

1290  {
1291  int ncoeffs = GetNcoeffs();
1295 
1297  DNekScalMat &Dmat = *GetLocMatrix(DerivType[dir]);
1298 
1299  Array<OneD, NekDouble> coeffs = incoeffs;
1300  DNekVec Coeffs (ncoeffs,coeffs, eWrapper);
1301 
1302  Coeffs = Transpose(Dmat)*Coeffs;
1303  Vmath::Neg(ncoeffs, coeffs,1);
1304 
1305  // Add the boundary integral including the relevant part of
1306  // the normal
1307  AddNormTraceInt(dir, FaceExp, faceCoeffs, coeffs);
1308 
1309  DNekVec Out_d (ncoeffs,out_d,eWrapper);
1310 
1311  Out_d = InvMass*Coeffs;
1312  }
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &outarray)
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:130
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:85
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:48
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat

◆ v_GenMatrix()

DNekMatSharedPtr Nektar::LocalRegions::Expansion3D::v_GenMatrix ( const StdRegions::StdMatrixKey mkey)
protectedvirtual

Computes matrices needed for the HDG formulation. References to equations relate to the following paper (with a suitable changes in formulation to adapt to 3D): R. M. Kirby, S. J. Sherwin, B. Cockburn, To CG or to HDG: A Comparative Study, J. Sci. Comp P1-30 DOI 10.1007/s10915-011-9501-7 NOTE: VARIABLE COEFFICIENTS CASE IS NOT IMPLEMENTED

Reimplemented from Nektar::StdRegions::StdExpansion.

Reimplemented in Nektar::LocalRegions::HexExp, Nektar::LocalRegions::PrismExp, Nektar::LocalRegions::TetExp, and Nektar::LocalRegions::PyrExp.

Definition at line 473 of file Expansion3D.cpp.

References ASSERTL0, ASSERTL1, Nektar::StdRegions::eFaceToElement, Nektar::StdRegions::eFactorLambda, Nektar::StdRegions::eFactorTau, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::StdRegions::eHybridDGHelmholtz, Nektar::StdRegions::eHybridDGLamToQ0, Nektar::StdRegions::eHybridDGLamToQ1, Nektar::StdRegions::eHybridDGLamToQ2, Nektar::StdRegions::eHybridDGLamToU, Nektar::StdRegions::eInvHybridDGHelmholtz, Nektar::StdRegions::eInvLaplacianWithUnityMean, Nektar::StdRegions::eInvMass, Nektar::StdRegions::eLaplacian, Nektar::StdRegions::eMass, Nektar::StdRegions::eVarCoeffD00, Nektar::StdRegions::eVarCoeffMass, Nektar::StdRegions::eVarCoeffMF, Nektar::StdRegions::eVarCoeffMF1x, Nektar::StdRegions::eVarCoeffMFDiv, Nektar::StdRegions::eWeakDeriv0, Nektar::StdRegions::eWeakDeriv1, Nektar::StdRegions::eWeakDeriv2, Nektar::StdRegions::eWeakDirectionalDeriv, Nektar::eWrapper, Vmath::Fill(), Nektar::StdRegions::StdMatrixKey::GetConstFactor(), Nektar::StdRegions::StdMatrixKey::GetConstFactors(), Nektar::StdRegions::StdMatrixKey::GetMatrixType(), Nektar::StdRegions::StdMatrixKey::GetVarCoeffs(), Nektar::StdRegions::StdMatrixKey::HasVarCoeff(), Vmath::Neg(), Nektar::StdRegions::NullConstFactorMap, sign, Vmath::Svtvp(), Nektar::Transpose(), Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by Nektar::LocalRegions::PyrExp::v_GenMatrix(), Nektar::LocalRegions::TetExp::v_GenMatrix(), Nektar::LocalRegions::PrismExp::v_GenMatrix(), Nektar::LocalRegions::HexExp::v_GenMatrix(), and ~Expansion3D().

474  {
475  //Variable coefficients are not implemented/////////
476  ASSERTL1(!mkey.HasVarCoeff(StdRegions::eVarCoeffD00),
477  "Matrix construction is not implemented for variable "
478  "coefficients at the moment");
479  ////////////////////////////////////////////////////
480 
481  DNekMatSharedPtr returnval;
482 
483  switch(mkey.GetMatrixType())
484  {
485  // (Z^e)^{-1} (Eqn. 33, P22)
487  {
489  "HybridDGHelmholtz matrix not set up "
490  "for non boundary-interior expansions");
491 
492  int i,j,k;
493  NekDouble lambdaval = mkey.GetConstFactor(StdRegions::eFactorLambda);
494  NekDouble tau = mkey.GetConstFactor(StdRegions::eFactorTau);
495  int ncoeffs = GetNcoeffs();
496  int nfaces = GetNfaces();
497 
498  Array<OneD,unsigned int> fmap;
499  Array<OneD,int> sign;
500  ExpansionSharedPtr FaceExp;
501  ExpansionSharedPtr FaceExp2;
502 
503  int order_f, coordim = GetCoordim();
508 
509  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(ncoeffs,ncoeffs);
510  DNekMat &Mat = *returnval;
511  Vmath::Zero(ncoeffs*ncoeffs,Mat.GetPtr(),1);
512 
513  // StdRegions::VarCoeffType Coeffs[3] = {StdRegions::eVarCoeffD00,
514  // StdRegions::eVarCoeffD11,
515  // StdRegions::eVarCoeffD22};
516  StdRegions::VarCoeffMap::const_iterator x;
517  const StdRegions::VarCoeffMap &varcoeffs =
518  mkey.GetVarCoeffs();
519 
520  for(i = 0; i < coordim; ++i)
521  {
522  if ((x = varcoeffs.find(StdRegions::eVarCoeffMF1x))
523  != varcoeffs.end())
524  {
525  StdRegions::VarCoeffMap VarCoeffDirDeriv;
526  VarCoeffDirDeriv[StdRegions::eVarCoeffMF] =
527  v_GetMF(i,coordim,varcoeffs);
528  VarCoeffDirDeriv[StdRegions::eVarCoeffMFDiv] =
529  v_GetMFDiv(i,varcoeffs);
530 
531  MatrixKey Dmatkey(StdRegions::eWeakDirectionalDeriv,
532  DetShapeType(), *this,
534  VarCoeffDirDeriv);
535 
536  DNekScalMat &Dmat = *GetLocMatrix(Dmatkey);
537 
539  Weight[StdRegions::eVarCoeffMass] =
540  v_GetMFMag(i,mkey.GetVarCoeffs());
541 
542  MatrixKey invMasskey(StdRegions::eInvMass,
543  DetShapeType(), *this,
545  Weight);
546 
547  DNekScalMat &invMass = *GetLocMatrix(invMasskey);
548 
549  Mat = Mat + Dmat*invMass*Transpose(Dmat);
550  }
551  else
552  {
553  DNekScalMat &Dmat = *GetLocMatrix(DerivType[i]);
554  Mat = Mat + Dmat*invMass*Transpose(Dmat);
555  }
556 
557  /*
558  if(mkey.HasVarCoeff(Coeffs[i]))
559  {
560  MatrixKey DmatkeyL(DerivType[i], DetExpansionType(), *this,
561  StdRegions::NullConstFactorMap,
562  mkey.GetVarCoeffAsMap(Coeffs[i]));
563  MatrixKey DmatkeyR(DerivType[i], DetExpansionType(), *this);
564 
565  DNekScalMat &DmatL = *GetLocMatrix(DmatkeyL);
566  DNekScalMat &DmatR = *GetLocMatrix(DmatkeyR);
567  Mat = Mat + DmatL*invMass*Transpose(DmatR);
568  }
569  else
570  {
571  DNekScalMat &Dmat = *GetLocMatrix(DerivType[i]);
572  Mat = Mat + Dmat*invMass*Transpose(Dmat);
573  }
574  */
575  }
576 
577  // Add Mass Matrix Contribution for Helmholtz problem
579  Mat = Mat + lambdaval*Mass;
580 
581  // Add tau*E_l using elemental mass matrices on each edge
582  for(i = 0; i < nfaces; ++i)
583  {
584  FaceExp = GetFaceExp(i);
585  order_f = FaceExp->GetNcoeffs();
586  StdRegions::IndexMapKey ikey(
589  GetBasisNumModes(2), i, GetForient(i));
591  StdExpansion::GetIndexMap(ikey);
592 
593  // @TODO: Document
594  /*
595  StdRegions::VarCoeffMap edgeVarCoeffs;
596  if (mkey.HasVarCoeff(StdRegions::eVarCoeffD00))
597  {
598  Array<OneD, NekDouble> mu(nq);
599  GetPhysEdgeVarCoeffsFromElement(
600  i, EdgeExp2,
601  mkey.GetVarCoeff(StdRegions::eVarCoeffD00), mu);
602  edgeVarCoeffs[StdRegions::eVarCoeffMass] = mu;
603  }
604  DNekScalMat &eMass = *EdgeExp->GetLocMatrix(
605  StdRegions::eMass,
606  StdRegions::NullConstFactorMap, edgeVarCoeffs);
607  */
608 
609  DNekScalMat &eMass = *FaceExp->GetLocMatrix(StdRegions::eMass);
610 
611  for(j = 0; j < order_f; ++j)
612  {
613  for(k = 0; k < order_f; ++k)
614  {
615  Mat((*map)[j].index,(*map)[k].index) +=
616  tau*(*map)[j].sign*(*map)[k].sign*eMass(j,k);
617  }
618  }
619  }
620  break;
621  }
622 
623  // U^e (P22)
625  {
626  int i,j,k;
627  int nbndry = NumDGBndryCoeffs();
628  int ncoeffs = GetNcoeffs();
629  int nfaces = GetNfaces();
630  NekDouble tau = mkey.GetConstFactor(StdRegions::eFactorTau);
631 
632  Array<OneD,NekDouble> lambda(nbndry);
633  DNekVec Lambda(nbndry,lambda,eWrapper);
634  Array<OneD,NekDouble> ulam(ncoeffs);
635  DNekVec Ulam(ncoeffs,ulam,eWrapper);
636  Array<OneD,NekDouble> f(ncoeffs);
637  DNekVec F(ncoeffs,f,eWrapper);
638 
639  ExpansionSharedPtr FaceExp;
640  // declare matrix space
641  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(ncoeffs,nbndry);
642  DNekMat &Umat = *returnval;
643 
644  // Z^e matrix
645  MatrixKey newkey(StdRegions::eInvHybridDGHelmholtz, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
646  DNekScalMat &invHmat = *GetLocMatrix(newkey);
647 
648  Array<OneD,unsigned int> fmap;
649  Array<OneD,int> sign;
650 
651  //alternative way to add boundary terms contribution
652  int bndry_cnt = 0;
653  for(i = 0; i < nfaces; ++i)
654  {
655  FaceExp = GetFaceExp(i);//temporary, need to rewrite AddHDGHelmholtzFaceTerms
656  int nface = GetFaceNcoeffs(i);
657  Array<OneD, NekDouble> face_lambda(nface);
658 
659  const Array<OneD, const Array<OneD, NekDouble> > normals
660  = GetFaceNormal(i);
661 
662  for(j = 0; j < nface; ++j)
663  {
664  Vmath::Zero(nface,&face_lambda[0],1);
665  Vmath::Zero(ncoeffs,&f[0],1);
666  face_lambda[j] = 1.0;
667 
668  SetFaceToGeomOrientation(i, face_lambda);
669 
670  Array<OneD, NekDouble> tmp(FaceExp->GetTotPoints());
671  FaceExp->BwdTrans(face_lambda, tmp);
672  AddHDGHelmholtzFaceTerms(tau, i, tmp, mkey.GetVarCoeffs(), f);
673 
674  Ulam = invHmat*F; // generate Ulam from lambda
675 
676  // fill column of matrix
677  for(k = 0; k < ncoeffs; ++k)
678  {
679  Umat(k,bndry_cnt) = Ulam[k];
680  }
681 
682  ++bndry_cnt;
683  }
684  }
685 
686  //// Set up face expansions from local geom info
687  //for(i = 0; i < nfaces; ++i)
688  //{
689  // FaceExp[i] = GetFaceExp(i);
690  //}
691  //
692  //// for each degree of freedom of the lambda space
693  //// calculate Umat entry
694  //// Generate Lambda to U_lambda matrix
695  //for(j = 0; j < nbndry; ++j)
696  //{
697  // // standard basis vectors e_j
698  // Vmath::Zero(nbndry,&lambda[0],1);
699  // Vmath::Zero(ncoeffs,&f[0],1);
700  // lambda[j] = 1.0;
701  //
702  // //cout << Lambda;
703  // SetTraceToGeomOrientation(lambda);
704  // //cout << Lambda << endl;
705  //
706  // // Compute F = [I D_1 M^{-1} D_2 M^{-1}] C e_j
707  // AddHDGHelmholtzTraceTerms(tau, lambda, FaceExp, mkey.GetVarCoeffs(), f);
708  //
709  // // Compute U^e_j
710  // Ulam = invHmat*F; // generate Ulam from lambda
711  //
712  // // fill column of matrix
713  // for(k = 0; k < ncoeffs; ++k)
714  // {
715  // Umat(k,j) = Ulam[k];
716  // }
717  //}
718  }
719  break;
720  // Q_0, Q_1, Q_2 matrices (P23)
721  // Each are a product of a row of Eqn 32 with the C matrix.
722  // Rather than explicitly computing all of Eqn 32, we note each
723  // row is almost a multiple of U^e, so use that as our starting
724  // point.
728  {
729  int i = 0;
730  int j = 0;
731  int k = 0;
732  int dir = 0;
733  int nbndry = NumDGBndryCoeffs();
734  int coordim = GetCoordim();
735  int ncoeffs = GetNcoeffs();
736  int nfaces = GetNfaces();
737 
738  Array<OneD,NekDouble> lambda(nbndry);
739  DNekVec Lambda(nbndry,lambda,eWrapper);
740  Array<OneD, ExpansionSharedPtr> FaceExp(nfaces);
741 
742  Array<OneD,NekDouble> ulam(ncoeffs);
743  DNekVec Ulam(ncoeffs,ulam,eWrapper);
744  Array<OneD,NekDouble> f(ncoeffs);
745  DNekVec F(ncoeffs,f,eWrapper);
746 
747  // declare matrix space
748  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(ncoeffs,nbndry);
749  DNekMat &Qmat = *returnval;
750 
751  // Lambda to U matrix
752  MatrixKey lamToUkey(StdRegions::eHybridDGLamToU, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
753  DNekScalMat &lamToU = *GetLocMatrix(lamToUkey);
754 
755  // Inverse mass matrix
757 
758  for(i = 0; i < nfaces; ++i)
759  {
760  FaceExp[i] = GetFaceExp(i);
761  }
762 
763  //Weak Derivative matrix
765  switch(mkey.GetMatrixType())
766  {
768  dir = 0;
770  break;
772  dir = 1;
774  break;
776  dir = 2;
777  Dmat = GetLocMatrix(StdRegions::eWeakDeriv2);
778  break;
779  default:
780  ASSERTL0(false,"Direction not known");
781  break;
782  }
783 
784  //DNekScalMatSharedPtr Dmat;
785  //DNekScalMatSharedPtr &invMass;
786  StdRegions::VarCoeffMap::const_iterator x;
787  const StdRegions::VarCoeffMap &varcoeffs =
788  mkey.GetVarCoeffs();
789  if ((x = varcoeffs.find(StdRegions::eVarCoeffMF1x)) !=
790  varcoeffs.end())
791  {
792  StdRegions::VarCoeffMap VarCoeffDirDeriv;
793  VarCoeffDirDeriv[StdRegions::eVarCoeffMF] =
794  v_GetMF(dir,coordim,varcoeffs);
795  VarCoeffDirDeriv[StdRegions::eVarCoeffMFDiv] =
796  v_GetMFDiv(dir,varcoeffs);
797 
798  MatrixKey Dmatkey(StdRegions::eWeakDirectionalDeriv,
799  DetShapeType(), *this,
801  VarCoeffDirDeriv);
802 
803  Dmat = GetLocMatrix(Dmatkey);
804 
806  Weight[StdRegions::eVarCoeffMass] =
807  v_GetMFMag(dir,mkey.GetVarCoeffs());
808 
809  MatrixKey invMasskey(StdRegions::eInvMass,
810  DetShapeType(), *this,
812  Weight);
813 
814  invMass = *GetLocMatrix(invMasskey);
815  }
816  else
817  {
818  // Inverse mass matrix
820  }
821 
822  // for each degree of freedom of the lambda space
823  // calculate Qmat entry
824  // Generate Lambda to Q_lambda matrix
825  for(j = 0; j < nbndry; ++j)
826  {
827  Vmath::Zero(nbndry,&lambda[0],1);
828  lambda[j] = 1.0;
829 
830  // for lambda[j] = 1 this is the solution to ulam
831  for(k = 0; k < ncoeffs; ++k)
832  {
833  Ulam[k] = lamToU(k,j);
834  }
835 
836  // -D^T ulam
837  Vmath::Neg(ncoeffs,&ulam[0],1);
838  F = Transpose(*Dmat)*Ulam;
839 
841 
842  // Add the C terms resulting from the I's on the
843  // diagonals of Eqn 32
844  AddNormTraceInt(dir,lambda,FaceExp,f,mkey.GetVarCoeffs());
845 
846  // finally multiply by inverse mass matrix
847  Ulam = invMass*F;
848 
849  // fill column of matrix (Qmat is in column major format)
850  Vmath::Vcopy(ncoeffs,&ulam[0],1,&(Qmat.GetPtr())[0]+j*ncoeffs,1);
851  }
852  }
853  break;
854  // Matrix K (P23)
856  {
857  int i,j,f,cnt;
858  int order_f, nquad_f;
859  int nbndry = NumDGBndryCoeffs();
860  int nfaces = GetNfaces();
861  NekDouble tau = mkey.GetConstFactor(StdRegions::eFactorTau);
862 
863  Array<OneD,NekDouble> work, varcoeff_work;
864  Array<OneD,const Array<OneD, NekDouble> > normals;
865  Array<OneD, ExpansionSharedPtr> FaceExp(nfaces);
866  Array<OneD, NekDouble> lam(nbndry);
867 
868  Array<OneD,unsigned int> fmap;
869  Array<OneD, int> sign;
870 
871  // declare matrix space
872  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(nbndry, nbndry);
873  DNekMat &BndMat = *returnval;
874 
875  DNekScalMatSharedPtr LamToQ[3];
876 
877  // Matrix to map Lambda to U
878  MatrixKey LamToUkey(StdRegions::eHybridDGLamToU, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
879  DNekScalMat &LamToU = *GetLocMatrix(LamToUkey);
880 
881  // Matrix to map Lambda to Q0
882  MatrixKey LamToQ0key(StdRegions::eHybridDGLamToQ0, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
883  LamToQ[0] = GetLocMatrix(LamToQ0key);
884 
885  // Matrix to map Lambda to Q1
886  MatrixKey LamToQ1key(StdRegions::eHybridDGLamToQ1, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
887  LamToQ[1] = GetLocMatrix(LamToQ1key);
888 
889  // Matrix to map Lambda to Q2
890  MatrixKey LamToQ2key(StdRegions::eHybridDGLamToQ2, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
891  LamToQ[2] = GetLocMatrix(LamToQ2key);
892 
893  // Set up edge segment expansions from local geom info
894  const StdRegions::VarCoeffMap &varcoeffs = mkey.GetVarCoeffs();
895  for(i = 0; i < nfaces; ++i)
896  {
897  FaceExp[i] = GetFaceExp(i);
898  }
899 
900  // Set up matrix derived from <mu, Q_lam.n - \tau (U_lam - Lam) >
901  for(i = 0; i < nbndry; ++i)
902  {
903  cnt = 0;
904 
905  Vmath::Zero(nbndry,lam,1);
906  lam[i] = 1.0;
908 
909  for(f = 0; f < nfaces; ++f)
910  {
911  order_f = FaceExp[f]->GetNcoeffs();
912  nquad_f = FaceExp[f]->GetNumPoints(0)*FaceExp[f]->GetNumPoints(1);
913  normals = GetFaceNormal(f);
914 
915  work = Array<OneD,NekDouble>(nquad_f);
916  varcoeff_work = Array<OneD, NekDouble>(nquad_f);
917 
918  StdRegions::IndexMapKey ikey(
921  GetBasisNumModes(2), f, GetForient(f));
923  StdExpansion::GetIndexMap(ikey);
924 
925  // @TODO Variable coefficients
926  /*
927  StdRegions::VarCoeffType VarCoeff[3] = {StdRegions::eVarCoeffD00,
928  StdRegions::eVarCoeffD11,
929  StdRegions::eVarCoeffD22};
930  const StdRegions::VarCoeffMap &varcoeffs = mkey.GetVarCoeffs();
931  StdRegions::VarCoeffMap::const_iterator x;
932  */
933 
934  // Q0 * n0 (BQ_0 terms)
935  Array<OneD, NekDouble> faceCoeffs(order_f);
936  Array<OneD, NekDouble> facePhys (nquad_f);
937  for(j = 0; j < order_f; ++j)
938  {
939  faceCoeffs[j] = (*map)[j].sign*(*LamToQ[0])((*map)[j].index,i);
940  }
941 
942  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
943 
944  // @TODO Variable coefficients
945  // Multiply by variable coefficient
946  /*
947  if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
948  {
949  GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
950  Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
951  }
952  */
953 
954  if (varcoeffs.find(StdRegions::eVarCoeffMF1x)
955  != varcoeffs.end())
956  {
957  Array<OneD, NekDouble> ncdotMF =
958  v_GetnFacecdotMF(0, f, FaceExp[f],
959  normals, varcoeffs);
960 
961  Vmath::Vmul(nquad_f, ncdotMF, 1,
962  facePhys, 1,
963  work, 1);
964  }
965  else
966  {
967  Vmath::Vmul(nquad_f, normals[0], 1,
968  facePhys, 1,
969  work, 1);
970  }
971 
972  // Q1 * n1 (BQ_1 terms)
973  for(j = 0; j < order_f; ++j)
974  {
975  faceCoeffs[j] = (*map)[j].sign*(*LamToQ[1])((*map)[j].index,i);
976  }
977 
978  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
979 
980  // @TODO Variable coefficients
981  // Multiply by variable coefficients
982  /*
983  if ((x = varcoeffs.find(VarCoeff[1])) != varcoeffs.end())
984  {
985  GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
986  Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
987  }
988  */
989 
990  if ((varcoeffs.find(StdRegions::eVarCoeffMF1x)) !=
991  varcoeffs.end())
992  {
993  Array<OneD, NekDouble> ncdotMF =
994  v_GetnFacecdotMF(1, f, FaceExp[f],
995  normals, varcoeffs);
996 
997  Vmath::Vvtvp(nquad_f, ncdotMF, 1,
998  facePhys, 1,
999  work, 1,
1000  work, 1);
1001  }
1002  else
1003  {
1004  Vmath::Vvtvp(nquad_f, normals[1], 1,
1005  facePhys, 1,
1006  work, 1,
1007  work, 1);
1008  }
1009 
1010  // Q2 * n2 (BQ_2 terms)
1011  for(j = 0; j < order_f; ++j)
1012  {
1013  faceCoeffs[j] = (*map)[j].sign*(*LamToQ[2])((*map)[j].index,i);
1014  }
1015 
1016  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
1017 
1018  // @TODO Variable coefficients
1019  // Multiply by variable coefficients
1020  /*
1021  if ((x = varcoeffs.find(VarCoeff[2])) != varcoeffs.end())
1022  {
1023  GetPhysEdgeVarCoeffsFromElement(e,EdgeExp[e],x->second,varcoeff_work);
1024  Vmath::Vmul(nquad_e,varcoeff_work,1,EdgeExp[e]->GetPhys(),1,EdgeExp[e]->UpdatePhys(),1);
1025  }
1026  */
1027 
1028  if (varcoeffs.find(StdRegions::eVarCoeffMF1x) !=
1029  varcoeffs.end())
1030  {
1031  Array<OneD, NekDouble> ncdotMF =
1032  v_GetnFacecdotMF(2, f, FaceExp[f],
1033  normals, varcoeffs);
1034 
1035  Vmath::Vvtvp(nquad_f, ncdotMF, 1,
1036  facePhys, 1,
1037  work, 1,
1038  work, 1);
1039  }
1040  else
1041  {
1042  Vmath::Vvtvp(nquad_f, normals[2], 1,
1043  facePhys, 1,
1044  work, 1,
1045  work, 1);
1046  }
1047 
1048  if (m_negatedNormals[f])
1049  {
1050  Vmath::Neg(nquad_f, work, 1);
1051  }
1052 
1053  // - tau (ulam - lam)
1054  // Corresponds to the G and BU terms.
1055  for(j = 0; j < order_f; ++j)
1056  {
1057  faceCoeffs[j] = (*map)[j].sign*LamToU((*map)[j].index,i) - lam[cnt+j];
1058  }
1059 
1060  FaceExp[f]->BwdTrans(faceCoeffs, facePhys);
1061 
1062  // @TODO Variable coefficients
1063  // Multiply by variable coefficients
1064  /*
1065  if ((x = varcoeffs.find(VarCoeff[0])) != varcoeffs.end())
1066  {
1067  GetPhysEdgeVarCoeffsFromElement(e,FaceExp[f],x->second,varcoeff_work);
1068  Vmath::Vmul(nquad_f,varcoeff_work,1,FaceExp[f]->GetPhys(),1,FaceExp[f]->UpdatePhys(),1);
1069  }
1070  */
1071 
1072  Vmath::Svtvp(nquad_f, -tau, facePhys, 1,
1073  work, 1, work, 1);
1074 
1075  // @TODO Add variable coefficients
1076  FaceExp[f]->IProductWRTBase(work, faceCoeffs);
1077 
1078  SetFaceToGeomOrientation(f, faceCoeffs);
1079 
1080  for(j = 0; j < order_f; ++j)
1081  {
1082  BndMat(cnt+j,i) = faceCoeffs[j];
1083  }
1084 
1085  cnt += order_f;
1086  }
1087  }
1088  }
1089  break;
1090  //HDG postprocessing
1092  {
1093  MatrixKey lapkey(StdRegions::eLaplacian, DetShapeType(), *this, mkey.GetConstFactors(), mkey.GetVarCoeffs());
1094  DNekScalMat &LapMat = *GetLocMatrix(lapkey);
1095 
1096  returnval = MemoryManager<DNekMat>::AllocateSharedPtr(LapMat.GetRows(),LapMat.GetColumns());
1097  DNekMatSharedPtr lmat = returnval;
1098 
1099  (*lmat) = LapMat;
1100 
1101  // replace first column with inner product wrt 1
1102  int nq = GetTotPoints();
1103  Array<OneD, NekDouble> tmp(nq);
1104  Array<OneD, NekDouble> outarray(m_ncoeffs);
1105  Vmath::Fill(nq,1.0,tmp,1);
1106  IProductWRTBase(tmp, outarray);
1107 
1108  Vmath::Vcopy(m_ncoeffs,&outarray[0],1,
1109  &(lmat->GetPtr())[0],1);
1110 
1111  lmat->Invert();
1112  }
1113  break;
1114  default:
1115  ASSERTL0(false,"This matrix type cannot be generated from this class");
1116  break;
1117  }
1118 
1119  return returnval;
1120  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:469
#define sign(a, b)
return the sign(b)*a
Definition: Polylib.cpp:16
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
int GetBasisNumModes(const int dir) const
This function returns the number of expansion modes in the dir direction.
Definition: StdExpansion.h:177
void SetFaceToGeomOrientation(const int face, Array< OneD, NekDouble > &inout)
Align face orientation with the geometry orientation.
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
this function calculates the inner product of a given function f with the different modes of the expa...
Definition: StdExpansion.h:634
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:488
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:445
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
int GetFaceNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th face.
Definition: StdExpansion.h:353
void SetTraceToGeomOrientation(Array< OneD, NekDouble > &inout)
Align trace orientation with the geometry orientation.
std::map< int, bool > m_negatedNormals
const NormalVector & GetFaceNormal(const int face) const
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
Array< OneD, NekDouble > v_GetMFMag(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:444
Array< OneD, NekDouble > v_GetMF(const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:347
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:51
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
double NekDouble
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &FaceExp, Array< OneD, Array< OneD, NekDouble > > &faceCoeffs, Array< OneD, NekDouble > &outarray)
virtual Array< OneD, NekDouble > v_GetnFacecdotMF(const int dir, const int face, ExpansionSharedPtr &FaceExp_f, const Array< OneD, const Array< OneD, NekDouble > > &normals, const StdRegions::VarCoeffMap &varcoeffs)
int GetNcoeffs(void) const
This function returns the total number of coefficients used in the expansion.
Definition: StdExpansion.h:130
void AddHDGHelmholtzFaceTerms(const NekDouble tau, const int edge, Array< OneD, NekDouble > &facePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
Definition: Expansion3D.cpp:52
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:65
Array< OneD, NekDouble > v_GetMFDiv(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Definition: Expansion.cpp:411
DNekScalMatSharedPtr GetLocMatrix(const LocalRegions::MatrixKey &mkey)
Definition: Expansion.cpp:85
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:48
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:140
Expansion2DSharedPtr GetFaceExp(const int face)
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
std::shared_ptr< IndexMapValues > IndexMapValuesSharedPtr
Definition: IndexMapKey.h:124
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
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.cpp:186
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:295

◆ v_GetEdgeInverseBoundaryMap()

Array< OneD, unsigned int > Nektar::LocalRegions::Expansion3D::v_GetEdgeInverseBoundaryMap ( int  eid)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 2049 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

2051  {
2052  int n, j;
2053  int nEdgeCoeffs;
2054  int nBndCoeffs = NumBndryCoeffs();
2055 
2056  Array<OneD, unsigned int> bmap(nBndCoeffs);
2057  GetBoundaryMap(bmap);
2058 
2059  // Map from full system to statically condensed system (i.e reverse
2060  // GetBoundaryMap)
2061  map<int, int> invmap;
2062  for (j = 0; j < nBndCoeffs; ++j)
2063  {
2064  invmap[bmap[j]] = j;
2065  }
2066 
2067  // Number of interior edge coefficients
2068  nEdgeCoeffs = GetEdgeNcoeffs(eid) - 2;
2069 
2071 
2072  Array<OneD, unsigned int> edgemaparray(nEdgeCoeffs);
2073  StdRegions::Orientation eOrient =
2074  geom->GetEorient(eid);
2075  Array<OneD, unsigned int> maparray =
2076  Array<OneD, unsigned int>(nEdgeCoeffs);
2077  Array<OneD, int> signarray =
2078  Array<OneD, int>(nEdgeCoeffs, 1);
2079 
2080  // maparray is the location of the edge within the matrix
2081  GetEdgeInteriorMap(eid, eOrient, maparray, signarray);
2082 
2083  for (n = 0; n < nEdgeCoeffs; ++n)
2084  {
2085  edgemaparray[n] = invmap[maparray[n]];
2086  }
2087 
2088  return edgemaparray;
2089  }
std::shared_ptr< Geometry3D > Geometry3DSharedPtr
Definition: Geometry3D.h:52
void GetEdgeInteriorMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdExpansion.h:828
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:286
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:196
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:812

◆ v_GetFaceInverseBoundaryMap()

Array< OneD, unsigned int > Nektar::LocalRegions::Expansion3D::v_GetFaceInverseBoundaryMap ( int  fid,
StdRegions::Orientation  faceOrient = StdRegions::eNoOrientation,
int  P1 = -1,
int  P2 = -1 
)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 2092 of file Expansion3D.cpp.

References ASSERTL0, ASSERTL1, Nektar::StdRegions::eNoOrientation, Nektar::LibUtilities::eQuadrilateral, Nektar::LibUtilities::eTriangle, and Nektar::LibUtilities::StdSegData::getNumberOfCoefficients().

Referenced by ~Expansion3D().

2097  {
2098  int n,j;
2099  int nFaceCoeffs;
2100 
2101  int nBndCoeffs = NumBndryCoeffs();
2102 
2103  Array<OneD, unsigned int> bmap(nBndCoeffs);
2104  GetBoundaryMap(bmap);
2105 
2106  // Map from full system to statically condensed system (i.e reverse
2107  // GetBoundaryMap)
2108  map<int, int> reversemap;
2109  for (j = 0; j < bmap.num_elements(); ++j)
2110  {
2111  reversemap[bmap[j]] = j;
2112  }
2113 
2114  // Number of interior face coefficients
2115  nFaceCoeffs = GetFaceIntNcoeffs(fid);
2116 
2117  StdRegions::Orientation fOrient;
2118  Array<OneD, unsigned int> maparray =
2119  Array<OneD, unsigned int>(nFaceCoeffs);
2120  Array<OneD, int> signarray =
2121  Array<OneD, int>(nFaceCoeffs, 1);
2122 
2123  if(faceOrient == StdRegions::eNoOrientation)
2124  {
2125  fOrient = GetForient(fid);
2126  }
2127  else
2128  {
2129  fOrient = faceOrient;
2130  }
2131 
2132  // maparray is the location of the face within the matrix
2133  GetFaceInteriorMap(fid, fOrient, maparray, signarray);
2134 
2135  Array<OneD, unsigned int> facemaparray;
2136  int locP1,locP2;
2137  GetFaceNumModes(fid,fOrient,locP1,locP2);
2138 
2139  if(P1 == -1)
2140  {
2141  P1 = locP1;
2142  }
2143  else
2144  {
2145  ASSERTL1(P1 <= locP1,"Expect value of passed P1 to "
2146  "be lower or equal to face num modes");
2147  }
2148 
2149  if(P2 == -1)
2150  {
2151  P2 = locP2;
2152  }
2153  else
2154  {
2155  ASSERTL1(P2 <= locP2,"Expect value of passed P2 to "
2156  "be lower or equal to face num modes");
2157  }
2158 
2159  switch(GetGeom3D()->GetFace(fid)->GetShapeType())
2160  {
2162  {
2163  if(((P1-3)>0)&&((P2-3)>0))
2164  {
2165  facemaparray= Array<OneD, unsigned int>(LibUtilities::StdTriData::getNumberOfCoefficients(P1-3,P2-3));
2166  int cnt = 0;
2167  int cnt1 = 0;
2168  for(n = 0; n < P1-3; ++n)
2169  {
2170  for(int m = 0; m < P2-3-n; ++m, ++cnt)
2171  {
2172  facemaparray[cnt] = reversemap[maparray[cnt1+m]];
2173  }
2174  cnt1 += locP2-3-n;
2175  }
2176  }
2177  }
2178  break;
2180  {
2181  if(((P1-2)>0)&&((P2-2)>0))
2182  {
2183  facemaparray = Array<OneD, unsigned int>(LibUtilities::StdQuadData::getNumberOfCoefficients(P1-2,P2-2));
2184  int cnt = 0;
2185  int cnt1 = 0;
2186  for(n = 0; n < P2-2; ++n)
2187  {
2188  for(int m = 0; m < P1-2; ++m, ++cnt)
2189  {
2190  facemaparray[cnt] = reversemap[maparray[cnt1+m]];
2191  }
2192  cnt1 += locP1-2;
2193  }
2194  }
2195  }
2196  break;
2197  default:
2198  ASSERTL0(false, "Invalid shape type.");
2199  break;
2200  }
2201 
2202 
2203  return facemaparray;
2204  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
void GetFaceNumModes(const int fid, const Orientation faceOrient, int &numModes0, int &numModes1)
Definition: StdExpansion.h:835
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:358
int getNumberOfCoefficients(int Na, int Nb)
Definition: ShapeType.hpp:113
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:196
int getNumberOfCoefficients(int Na, int Nb)
Definition: ShapeType.hpp:137
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:812
void GetFaceInteriorMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdExpansion.h:842

◆ v_GetFacePhysVals()

void Nektar::LocalRegions::Expansion3D::v_GetFacePhysVals ( const int  face,
const StdRegions::StdExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
StdRegions::Orientation  orient 
)
protectedvirtual

Definition at line 2308 of file Expansion3D.cpp.

References Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, Nektar::StdRegions::eNoOrientation, Vmath::Gathr(), Nektar::LibUtilities::Interp2D(), and Vmath::Scatr().

Referenced by ~Expansion3D().

2314  {
2315 
2316  if (orient == StdRegions::eNoOrientation)
2317  {
2318  orient = GetForient(face);
2319  }
2320 
2321  int nq0 = FaceExp->GetNumPoints(0);
2322  int nq1 = FaceExp->GetNumPoints(1);
2323 
2324  int nfacepts = GetFaceNumPoints(face);
2325  int dir0 = GetGeom3D()->GetDir(face,0);
2326  int dir1 = GetGeom3D()->GetDir(face,1);
2327 
2328  Array<OneD,NekDouble> o_tmp (nfacepts);
2329  Array<OneD,NekDouble> o_tmp2(FaceExp->GetTotPoints());
2330  Array<OneD, int> faceids;
2331 
2332  // Get local face pts and put into o_tmp
2333  GetFacePhysMap(face,faceids);
2334  Vmath::Gathr(faceids.num_elements(),inarray,faceids,o_tmp);
2335 
2336 
2337  int to_id0,to_id1;
2338 
2340  {
2341  to_id0 = 0;
2342  to_id1 = 1;
2343  }
2344  else // transpose points key evaluation
2345  {
2346  to_id0 = 1;
2347  to_id1 = 0;
2348  }
2349 
2350  // interpolate to points distrbution given in FaceExp
2351  LibUtilities::Interp2D(m_base[dir0]->GetPointsKey(),
2352  m_base[dir1]->GetPointsKey(),
2353  o_tmp.get(),
2354  FaceExp->GetBasis(to_id0)->GetPointsKey(),
2355  FaceExp->GetBasis(to_id1)->GetPointsKey(),
2356  o_tmp2.get());
2357 
2358  // Reshuffule points as required and put into outarray.
2359  ReOrientFacePhysMap(FaceExp->GetNverts(),orient,nq0,nq1,faceids);
2360  Vmath::Scatr(nq0*nq1,o_tmp2,faceids,outarray);
2361  }
void Gathr(int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
Definition: Vmath.cpp:647
void GetFacePhysMap(const int face, Array< OneD, int > &outarray)
Definition: StdExpansion.h:938
StdRegions::Orientation GetForient(int face)
Definition: StdExpansion.h:771
void ReOrientFacePhysMap(const int nvert, const StdRegions::Orientation orient, const int nq0, const int nq1, Array< OneD, int > &idmap)
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis...
Definition: Interp.cpp:115
int GetFaceNumPoints(const int i) const
This function returns the number of quadrature points belonging to the i-th face. ...
Definition: StdExpansion.h:338
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
Definition: Vmath.cpp:676
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
Definition: Expansion3D.h:196
Array< OneD, LibUtilities::BasisSharedPtr > m_base

◆ v_GetForient()

StdRegions::Orientation Nektar::LocalRegions::Expansion3D::v_GetForient ( int  face)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 2289 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

2290  {
2291  return m_geom->GetForient(face);
2292  }
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:127

◆ v_GetInverseBoundaryMaps()

void Nektar::LocalRegions::Expansion3D::v_GetInverseBoundaryMaps ( Array< OneD, unsigned int > &  vmap,
Array< OneD, Array< OneD, unsigned int > > &  emap,
Array< OneD, Array< OneD, unsigned int > > &  fmap 
)
protectedvirtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 2206 of file Expansion3D.cpp.

References Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, and Nektar::StdRegions::eForwards.

Referenced by ~Expansion3D().

2210  {
2211  int n, j;
2212  int nEdgeCoeffs;
2213  int nFaceCoeffs;
2214 
2215  int nBndCoeffs = NumBndryCoeffs();
2216 
2217  Array<OneD, unsigned int> bmap(nBndCoeffs);
2218  GetBoundaryMap(bmap);
2219 
2220  // Map from full system to statically condensed system (i.e reverse
2221  // GetBoundaryMap)
2222  map<int, int> reversemap;
2223  for (j = 0; j < bmap.num_elements(); ++j)
2224  {
2225  reversemap[bmap[j]] = j;
2226  }
2227 
2228  int nverts = GetNverts();
2229  vmap = Array<OneD, unsigned int>(nverts);
2230  for (n = 0; n < nverts; ++n)
2231  {
2232  int id = GetVertexMap(n);
2233  vmap[n] = reversemap[id]; // not sure what should be true here.
2234  }
2235 
2236  int nedges = GetNedges();
2237  emap = Array<OneD, Array<OneD, unsigned int> >(nedges);
2238 
2239  for(int eid = 0; eid < nedges; ++eid)
2240  {
2241  // Number of interior edge coefficients
2242  nEdgeCoeffs = GetEdgeNcoeffs(eid) - 2;
2243 
2244  Array<OneD, unsigned int> edgemaparray(nEdgeCoeffs);
2245  Array<OneD, unsigned int> maparray =
2246  Array<OneD, unsigned int>(nEdgeCoeffs);
2247  Array<OneD, int> signarray =
2248  Array<OneD, int>(nEdgeCoeffs, 1);
2249 
2250  // maparray is the location of the edge within the matrix
2252  maparray, signarray);
2253 
2254  for (n = 0; n < nEdgeCoeffs; ++n)
2255  {
2256  edgemaparray[n] = reversemap[maparray[n]];
2257  }
2258  emap[eid] = edgemaparray;
2259  }
2260 
2261  int nfaces = GetNfaces();
2262  fmap = Array<OneD, Array<OneD, unsigned int> >(nfaces);
2263 
2264  for(int fid = 0; fid < nfaces; ++fid)
2265  {
2266  // Number of interior face coefficients
2267  nFaceCoeffs = GetFaceIntNcoeffs(fid);
2268 
2269  Array<OneD, unsigned int> facemaparray(nFaceCoeffs);
2270  Array<OneD, unsigned int> maparray =
2271  Array<OneD, unsigned int>(nFaceCoeffs);
2272  Array<OneD, int> signarray =
2273  Array<OneD, int>(nFaceCoeffs, 1);
2274 
2275  // maparray is the location of the face within the matrix
2277  maparray, signarray);
2278 
2279  for (n = 0; n < nFaceCoeffs; ++n)
2280  {
2281  facemaparray[n] = reversemap[maparray[n]];
2282  }
2283 
2284  fmap[fid] = facemaparray;
2285  }
2286  }
void GetEdgeInteriorMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdExpansion.h:828
int GetNverts() const
This function returns the number of vertices of the expansion domain.
Definition: StdExpansion.h:258
int GetEdgeNcoeffs(const int i) const
This function returns the number of expansion coefficients belonging to the i-th edge.
Definition: StdExpansion.h:286
int GetVertexMap(const int localVertexId, bool useCoeffPacking=false)
Definition: StdExpansion.h:822
int GetFaceIntNcoeffs(const int i) const
Definition: StdExpansion.h:358
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:271
int GetNfaces() const
This function returns the number of faces of the expansion domain.
Definition: StdExpansion.h:437
void GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdExpansion.h:812
void GetFaceInteriorMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdExpansion.h:842

◆ v_GetnFacecdotMF()

Array< OneD, NekDouble > Nektar::LocalRegions::Expansion3D::v_GetnFacecdotMF ( const int  dir,
const int  face,
ExpansionSharedPtr FaceExp_f,
const Array< OneD, const Array< OneD, NekDouble > > &  normals,
const StdRegions::VarCoeffMap varcoeffs 
)
protectedvirtual

Definition at line 2532 of file Expansion3D.cpp.

References Nektar::StdRegions::eVarCoeffMF1Div, Nektar::StdRegions::eVarCoeffMF1Mag, Nektar::StdRegions::eVarCoeffMF1x, Nektar::StdRegions::eVarCoeffMF1y, Nektar::StdRegions::eVarCoeffMF1z, Nektar::StdRegions::eVarCoeffMF2Div, Nektar::StdRegions::eVarCoeffMF2Mag, Nektar::StdRegions::eVarCoeffMF2x, Nektar::StdRegions::eVarCoeffMF2y, Nektar::StdRegions::eVarCoeffMF2z, Nektar::StdRegions::eVarCoeffMF3Div, Nektar::StdRegions::eVarCoeffMF3Mag, Nektar::StdRegions::eVarCoeffMF3x, Nektar::StdRegions::eVarCoeffMF3y, Nektar::StdRegions::eVarCoeffMF3z, and Vmath::Vvtvp().

Referenced by ~Expansion3D().

2538  {
2539  int nquad_f = FaceExp_f->GetNumPoints(0)*FaceExp_f->GetNumPoints(1);
2540  int coordim = GetCoordim();
2541 
2542  int nquad0 = m_base[0]->GetNumPoints();
2543  int nquad1 = m_base[1]->GetNumPoints();
2544  int nquad2 = m_base[2]->GetNumPoints();
2545  int nqtot = nquad0*nquad1*nquad2;
2546 
2562 
2563  StdRegions::VarCoeffMap::const_iterator MFdir;
2564 
2565  Array<OneD, NekDouble> nFacecdotMF(nqtot,0.0);
2566  Array<OneD, NekDouble> tmp(nqtot);
2567  Array<OneD, NekDouble> tmp_f(nquad_f);
2568  for (int k=0; k<coordim; k++)
2569  {
2570  MFdir = varcoeffs.find(MMFCoeffs[dir*5+k]);
2571  tmp = MFdir->second;
2572 
2573  GetPhysFaceVarCoeffsFromElement(face, FaceExp_f, tmp, tmp_f);
2574 
2575  Vmath::Vvtvp(nquad_f, &tmp_f[0], 1,
2576  &normals[k][0], 1,
2577  &nFacecdotMF[0], 1,
2578  &nFacecdotMF[0], 1);
2579  }
2580 
2581  return nFacecdotMF;
2582  }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:445
void GetPhysFaceVarCoeffsFromElement(const int face, ExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &varcoeff, Array< OneD, NekDouble > &outarray)
Array< OneD, LibUtilities::BasisSharedPtr > m_base

◆ v_GetTracePhysVals()

void Nektar::LocalRegions::Expansion3D::v_GetTracePhysVals ( const int  face,
const StdRegions::StdExpansionSharedPtr FaceExp,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
StdRegions::Orientation  orient 
)
protectedvirtual

Returns the physical values at the quadrature points of a face Wrapper function to v_GetFacePhysVals.

Definition at line 2298 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

2304  {
2305  v_GetFacePhysVals(face,FaceExp,inarray,outarray,orient);
2306  }
virtual void v_GetFacePhysVals(const int face, const StdRegions::StdExpansionSharedPtr &FaceExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient)

◆ v_NormVectorIProductWRTBase()

void Nektar::LocalRegions::Expansion3D::v_NormVectorIProductWRTBase ( const Array< OneD, const Array< OneD, NekDouble > > &  Fvec,
Array< OneD, NekDouble > &  outarray 
)
virtual

Reimplemented from Nektar::StdRegions::StdExpansion.

Definition at line 2523 of file Expansion3D.cpp.

Referenced by ~Expansion3D().

2526  {
2527  NormVectorIProductWRTBase(Fvec[0], Fvec[1], Fvec[2], outarray);
2528  }
void NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, Array< OneD, NekDouble > &outarray)
Definition: StdExpansion.h:741

Member Data Documentation

◆ m_faceExp

std::vector<Expansion2DWeakPtr> Nektar::LocalRegions::Expansion3D::m_faceExp
private

Definition at line 192 of file Expansion3D.h.

◆ m_requireNeg

std::vector<bool> Nektar::LocalRegions::Expansion3D::m_requireNeg
private

Definition at line 193 of file Expansion3D.h.