Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Nektar::MultiRegions::DisContField3D Class Reference

#include <DisContField3D.h>

Inheritance diagram for Nektar::MultiRegions::DisContField3D:
Inheritance graph
[legend]
Collaboration diagram for Nektar::MultiRegions::DisContField3D:
Collaboration graph
[legend]

Public Member Functions

 DisContField3D ()
 Default constructor. More...
 
 DisContField3D (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &graph3D, const std::string &variable, const bool SetUpJustDG=true)
 Constructs a global discontinuous field based on an input mesh with boundary conditions. More...
 
 DisContField3D (const DisContField3D &In, const SpatialDomains::MeshGraphSharedPtr &graph3D, const std::string &variable, const bool SetUpJustDG=false)
 
 DisContField3D (const DisContField3D &In)
 Constructs a global discontinuous field based on another discontinuous field. More...
 
virtual ~DisContField3D ()
 Destructor. More...
 
GlobalLinSysSharedPtr GetGlobalBndLinSys (const GlobalLinSysKey &mkey)
 
void EvaluateHDGPostProcessing (Array< OneD, NekDouble > &outarray)
 Evaluate HDG post-processing to increase polynomial order of solution. More...
 
bool GetLeftAdjacentFaces (int cnt)
 
- Public Member Functions inherited from Nektar::MultiRegions::ExpList3D
 ExpList3D ()
 Default constructor. More...
 
 ExpList3D (const ExpList3D &In)
 Copy constructor. More...
 
 ExpList3D (const ExpList3D &In, const std::vector< unsigned int > &eIDs, const bool DeclareCoeffPhysArrays=true)
 Constructor copying only elements defined in eIds. More...
 
 ExpList3D (const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::BasisKey &TBa, const LibUtilities::BasisKey &TBb, const LibUtilities::BasisKey &TBc, const LibUtilities::BasisKey &HBa, const LibUtilities::BasisKey &HBb, const LibUtilities::BasisKey &HBc, const SpatialDomains::MeshGraphSharedPtr &graph3D, const LibUtilities::PointsType TetNb=LibUtilities::SIZE_PointsType)
 
 ExpList3D (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &graph3D, const std::string &variable="DefaultVar")
 Sets up a list of local expansions based on an input mesh. More...
 
 ExpList3D (const SpatialDomains::ExpansionMap &expansions)
 Sets up a list of local expansions based on an expansion vector. More...
 
virtual ~ExpList3D ()
 Destructor. More...
 
- Public Member Functions inherited from Nektar::MultiRegions::ExpList
 ExpList ()
 The default constructor. More...
 
 ExpList (const LibUtilities::SessionReaderSharedPtr &pSession)
 The default constructor. More...
 
 ExpList (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 The default constructor. More...
 
 ExpList (const ExpList &in, const std::vector< unsigned int > &eIDs, const bool DeclareCoeffPhysArrays=true)
 Constructor copying only elements defined in eIds. More...
 
 ExpList (const ExpList &in, const bool DeclareCoeffPhysArrays=true)
 The copy constructor. More...
 
virtual ~ExpList ()
 The default destructor. More...
 
int GetNcoeffs (void) const
 Returns the total number of local degrees of freedom $N_{\mathrm{eof}}=\sum_{e=1}^{{N_{\mathrm{el}}}}N^{e}_m$. More...
 
int GetNcoeffs (const int eid) const
 Returns the total number of local degrees of freedom for element eid. More...
 
ExpansionType GetExpType (void)
 Returns the type of the expansion. More...
 
void SetExpType (ExpansionType Type)
 Returns the type of the expansion. More...
 
int EvalBasisNumModesMax (void) const
 Evaulates the maximum number of modes in the elemental basis order over all elements. More...
 
const Array< OneD, int > EvalBasisNumModesMaxPerExp (void) const
 Returns the vector of the number of modes in the elemental basis order over all elements. More...
 
int GetTotPoints (void) const
 Returns the total number of quadrature points m_npoints $=Q_{\mathrm{tot}}$. More...
 
int GetTotPoints (const int eid) const
 Returns the total number of quadrature points for eid's element $=Q_{\mathrm{tot}}$. More...
 
int GetNpoints (void) const
 Returns the total number of quadrature points m_npoints $=Q_{\mathrm{tot}}$. More...
 
int Get1DScaledTotPoints (const NekDouble scale) const
 Returns the total number of qudature points scaled by the factor scale on each 1D direction. More...
 
void SetWaveSpace (const bool wavespace)
 Sets the wave space to the one of the possible configuration true or false. More...
 
void SetModifiedBasis (const bool modbasis)
 Set Modified Basis for the stability analysis. More...
 
void SetPhys (int i, NekDouble val)
 Set the i th value of m_phys to value val. More...
 
bool GetWaveSpace (void) const
 This function returns the third direction expansion condition, which can be in wave space (coefficient) or not It is stored in the variable m_WaveSpace. More...
 
void SetPhys (const Array< OneD, const NekDouble > &inarray)
 Fills the array m_phys. More...
 
void SetPhysArray (Array< OneD, NekDouble > &inarray)
 Sets the array m_phys. More...
 
void SetPhysState (const bool physState)
 This function manually sets whether the array of physical values $\boldsymbol{u}_l$ (implemented as m_phys) is filled or not. More...
 
bool GetPhysState (void) const
 This function indicates whether the array of physical values $\boldsymbol{u}_l$ (implemented as m_phys) is filled or not. More...
 
NekDouble PhysIntegral (void)
 This function integrates a function $f(\boldsymbol{x})$ over the domain consisting of all the elements of the expansion. More...
 
NekDouble PhysIntegral (const Array< OneD, const NekDouble > &inarray)
 This function integrates a function $f(\boldsymbol{x})$ over the domain consisting of all the elements of the expansion. More...
 
void IProductWRTBase_IterPerExp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function calculates the inner product of a function $f(\boldsymbol{x})$ with respect to all {local} expansion modes $\phi_n^e(\boldsymbol{x})$. More...
 
void IProductWRTBase (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 
void IProductWRTDerivBase (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function calculates the inner product of a function $f(\boldsymbol{x})$ with respect to the derivative (in direction. More...
 
void IProductWRTDerivBase (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &outarray)
 This function calculates the inner product of a function $f(\boldsymbol{x})$ with respect to the derivative (in direction. More...
 
void FwdTrans_IterPerExp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function elementally evaluates the forward transformation of a function $u(\boldsymbol{x})$ onto the global spectral/hp expansion. More...
 
void FwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 
void MultiplyByElmtInvMass (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function elementally mulplies the coefficient space of Sin my the elemental inverse of the mass matrix. More...
 
void MultiplyByInvMassMatrix (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 
void SmoothField (Array< OneD, NekDouble > &field)
 Smooth a field across elements. More...
 
void HelmSolve (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const FlagList &flags, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff=StdRegions::NullVarCoeffMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray, const bool PhysSpaceForcing=true)
 Solve helmholtz problem. More...
 
void LinearAdvectionDiffusionReactionSolve (const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, CoeffState coeffstate=eLocal, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
 Solve Advection Diffusion Reaction. More...
 
void LinearAdvectionReactionSolve (const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, CoeffState coeffstate=eLocal, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
 Solve Advection Diffusion Reaction. More...
 
void FwdTrans_BndConstrained (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void BwdTrans_IterPerExp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function elementally evaluates the backward transformation of the global spectral/hp element expansion. More...
 
void BwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 
void GetCoords (Array< OneD, NekDouble > &coord_0, Array< OneD, NekDouble > &coord_1=NullNekDouble1DArray, Array< OneD, NekDouble > &coord_2=NullNekDouble1DArray)
 This function calculates the coordinates of all the elemental quadrature points $\boldsymbol{x}_i$. More...
 
void HomogeneousFwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
 
void HomogeneousBwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
 
void DealiasedProd (const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 
void DealiasedDotProd (const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray, CoeffState coeffstate=eLocal)
 
void GetBCValues (Array< OneD, NekDouble > &BndVals, const Array< OneD, NekDouble > &TotField, int BndID)
 
void NormVectorIProductWRTBase (Array< OneD, const NekDouble > &V1, Array< OneD, const NekDouble > &V2, Array< OneD, NekDouble > &outarray, int BndID)
 
void NormVectorIProductWRTBase (Array< OneD, Array< OneD, NekDouble > > &V, Array< OneD, NekDouble > &outarray)
 
void ApplyGeomInfo ()
 Apply geometry information to each expansion. More...
 
void Reset ()
 Reset geometry information and reset matrices. More...
 
void WriteTecplotHeader (std::ostream &outfile, std::string var="")
 
void WriteTecplotZone (std::ostream &outfile, int expansion=-1)
 
void WriteTecplotField (std::ostream &outfile, int expansion=-1)
 
void WriteTecplotConnectivity (std::ostream &outfile, int expansion=-1)
 
void WriteVtkHeader (std::ostream &outfile)
 
void WriteVtkFooter (std::ostream &outfile)
 
void WriteVtkPieceHeader (std::ostream &outfile, int expansion, int istrip=0)
 
void WriteVtkPieceFooter (std::ostream &outfile, int expansion)
 
void WriteVtkPieceData (std::ostream &outfile, int expansion, std::string var="v")
 
int GetCoordim (int eid)
 This function returns the dimension of the coordinates of the element eid. More...
 
void SetCoeff (int i, NekDouble val)
 Set the i th coefficiient in m_coeffs to value val. More...
 
void SetCoeffs (int i, NekDouble val)
 Set the i th coefficiient in m_coeffs to value val. More...
 
void SetCoeffsArray (Array< OneD, NekDouble > &inarray)
 Set the m_coeffs array to inarray. More...
 
const Array< OneD, const
NekDouble > & 
GetCoeffs () const
 This function returns (a reference to) the array $\boldsymbol{\hat{u}}_l$ (implemented as m_coeffs) containing all local expansion coefficients. More...
 
void ImposeDirichletConditions (Array< OneD, NekDouble > &outarray)
 Impose Dirichlet Boundary Conditions onto Array. More...
 
void FillBndCondFromField (void)
 Fill Bnd Condition expansion from the values stored in expansion. More...
 
void FillBndCondFromField (const int nreg)
 Fill Bnd Condition expansion in nreg from the values stored in expansion. More...
 
void LocalToGlobal (bool useComm=true)
 Gathers the global coefficients $\boldsymbol{\hat{u}}_g$ from the local coefficients $\boldsymbol{\hat{u}}_l$. More...
 
void LocalToGlobal (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool useComm=true)
 
void GlobalToLocal (void)
 Scatters from the global coefficients $\boldsymbol{\hat{u}}_g$ to the local coefficients $\boldsymbol{\hat{u}}_l$. More...
 
void GlobalToLocal (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
NekDouble GetCoeff (int i)
 Get the i th value (coefficient) of m_coeffs. More...
 
NekDouble GetCoeffs (int i)
 Get the i th value (coefficient) of m_coeffs. More...
 
const Array< OneD, const
NekDouble > & 
GetPhys () const
 This function returns (a reference to) the array $\boldsymbol{u}_l$ (implemented as m_phys) containing the function $u^{\delta}(\boldsymbol{x})$ evaluated at the quadrature points. More...
 
NekDouble Linf (const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &soln=NullNekDouble1DArray)
 This function calculates the $L_\infty$ error of the global spectral/hp element approximation. More...
 
NekDouble L2 (const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &soln=NullNekDouble1DArray)
 This function calculates the $L_2$ error with respect to soln of the global spectral/hp element approximation. More...
 
NekDouble H1 (const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &soln=NullNekDouble1DArray)
 Calculates the $H^1$ error of the global spectral/hp element approximation. More...
 
NekDouble Integral (const Array< OneD, const NekDouble > &inarray)
 
Array< OneD, const NekDoubleHomogeneousEnergy (void)
 This function calculates the energy associated with each one of the modesof a 3D homogeneous nD expansion. More...
 
void SetHomo1DSpecVanVisc (Array< OneD, NekDouble > visc)
 This function sets the Spectral Vanishing Viscosity in homogeneous1D expansion. More...
 
Array< OneD, const unsigned int > GetZIDs (void)
 This function returns a vector containing the wave numbers in z-direction associated with the 3D homogenous expansion. Required if a parellelisation is applied in the Fourier direction. More...
 
LibUtilities::TranspositionSharedPtr GetTransposition (void)
 This function returns the transposition class associaed with the homogeneous expansion. More...
 
NekDouble GetHomoLen (void)
 This function returns the Width of homogeneous direction associaed with the homogeneous expansion. More...
 
Array< OneD, const unsigned int > GetYIDs (void)
 This function returns a vector containing the wave numbers in y-direction associated with the 3D homogenous expansion. Required if a parellelisation is applied in the Fourier direction. More...
 
void PhysInterp1DScaled (const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function interpolates the physical space points in inarray to outarray using the same points defined in the expansion but where the number of points are rescaled by 1DScale. More...
 
void PhysGalerkinProjection1DScaled (const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 This function Galerkin projects the physical space points in inarray to outarray where inarray is assumed to be defined in the expansion but where the number of points are rescaled by 1DScale. More...
 
int GetExpSize (void)
 This function returns the number of elements in the expansion. More...
 
int GetNumElmts (void)
 This function returns the number of elements in the expansion which may be different for a homogeoenous extended expansionp. More...
 
const boost::shared_ptr
< LocalRegions::ExpansionVector
GetExp () const
 This function returns the vector of elements in the expansion. More...
 
LocalRegions::ExpansionSharedPtrGetExp (int n) const
 This function returns (a shared pointer to) the local elemental expansion of the $n^{\mathrm{th}}$ element. More...
 
LocalRegions::ExpansionSharedPtrGetExp (const Array< OneD, const NekDouble > &gloCoord)
 This function returns (a shared pointer to) the local elemental expansion containing the arbitrary point given by gloCoord. More...
 
int GetExpIndex (const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0, bool returnNearestElmt=false)
 
int GetExpIndex (const Array< OneD, const NekDouble > &gloCoords, Array< OneD, NekDouble > &locCoords, NekDouble tol=0.0, bool returnNearestElmt=false)
 
int GetCoeff_Offset (int n) const
 Get the start offset position for a global list of m_coeffs correspoinding to element n. More...
 
int GetPhys_Offset (int n) const
 Get the start offset position for a global list of m_phys correspoinding to element n. More...
 
int GetOffset_Elmt_Id (int n) const
 Get the element id associated with the n th consecutive block of data in m_phys and m_coeffs. More...
 
Array< OneD, NekDouble > & UpdateCoeffs ()
 This function returns (a reference to) the array $\boldsymbol{\hat{u}}_l$ (implemented as m_coeffs) containing all local expansion coefficients. More...
 
Array< OneD, NekDouble > & UpdatePhys ()
 This function returns (a reference to) the array $\boldsymbol{u}_l$ (implemented as m_phys) containing the function $u^{\delta}(\boldsymbol{x})$ evaluated at the quadrature points. More...
 
void PhysDeriv (Direction edir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d)
 
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)
 This function discretely evaluates the derivative of a function $f(\boldsymbol{x})$ on the domain consisting of all elements of the expansion. More...
 
void PhysDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d)
 
void CurlCurl (Array< OneD, Array< OneD, NekDouble > > &Vel, Array< OneD, Array< OneD, NekDouble > > &Q)
 
const Array< OneD, const
boost::shared_ptr< ExpList > > & 
GetBndCondExpansions ()
 
boost::shared_ptr< ExpList > & UpdateBndCondExpansion (int i)
 
void Upwind (const Array< OneD, const Array< OneD, NekDouble > > &Vec, const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &Upwind)
 
void Upwind (const Array< OneD, const NekDouble > &Vn, const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &Upwind)
 
boost::shared_ptr< ExpList > & GetTrace ()
 
boost::shared_ptr
< AssemblyMapDG > & 
GetTraceMap (void)
 
const Array< OneD, const int > & GetTraceBndMap (void)
 
void GetNormals (Array< OneD, Array< OneD, NekDouble > > &normals)
 
void AddTraceIntegral (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
void AddTraceIntegral (const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 
void AddFwdBwdTraceIntegral (const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &outarray)
 
void GetFwdBwdTracePhys (Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
 
void GetFwdBwdTracePhys (const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
 
const std::vector< bool > & GetLeftAdjacentFaces (void) const
 
void ExtractTracePhys (Array< OneD, NekDouble > &outarray)
 
void ExtractTracePhys (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
const Array< OneD, const
SpatialDomains::BoundaryConditionShPtr > & 
GetBndConditions ()
 
Array< OneD,
SpatialDomains::BoundaryConditionShPtr > & 
UpdateBndConditions ()
 
void EvaluateBoundaryConditions (const NekDouble time=0.0, const std::string varName="", const NekDouble=NekConstants::kNekUnsetDouble, const NekDouble=NekConstants::kNekUnsetDouble)
 
void GeneralMatrixOp (const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 This function calculates the result of the multiplication of a matrix of type specified by mkey with a vector given by inarray. More...
 
void GeneralMatrixOp_IterPerExp (const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
void SetUpPhysNormals ()
 
void GetBoundaryToElmtMap (Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
 
void GetBndElmtExpansion (int i, boost::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays=true)
 
void ExtractElmtToBndPhys (int i, Array< OneD, NekDouble > &elmt, Array< OneD, NekDouble > &boundary)
 
void ExtractPhysToBndElmt (int i, const Array< OneD, const NekDouble > &phys, Array< OneD, NekDouble > &bndElmt)
 
void ExtractPhysToBnd (int i, const Array< OneD, const NekDouble > &phys, Array< OneD, NekDouble > &bnd)
 
void GetBoundaryNormals (int i, Array< OneD, Array< OneD, NekDouble > > &normals)
 
void GeneralGetFieldDefinitions (std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef, int NumHomoDir=0, Array< OneD, LibUtilities::BasisSharedPtr > &HomoBasis=LibUtilities::NullBasisSharedPtr1DArray, std::vector< NekDouble > &HomoLen=LibUtilities::NullNekDoubleVector, bool homoStrips=false, std::vector< unsigned int > &HomoSIDs=LibUtilities::NullUnsignedIntVector, std::vector< unsigned int > &HomoZIDs=LibUtilities::NullUnsignedIntVector, std::vector< unsigned int > &HomoYIDs=LibUtilities::NullUnsignedIntVector)
 
const
NekOptimize::GlobalOptParamSharedPtr
GetGlobalOptParam (void)
 
std::map< int,
RobinBCInfoSharedPtr
GetRobinBCInfo ()
 
void GetPeriodicEntities (PeriodicMap &periodicVerts, PeriodicMap &periodicEdges, PeriodicMap &periodicFaces=NullPeriodicMap)
 
std::vector
< LibUtilities::FieldDefinitionsSharedPtr
GetFieldDefinitions ()
 
void GetFieldDefinitions (std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef)
 
void AppendFieldData (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
 Append the element data listed in elements fielddef->m_ElementIDs onto fielddata. More...
 
void AppendFieldData (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, Array< OneD, NekDouble > &coeffs)
 Append the data in coeffs listed in elements fielddef->m_ElementIDs onto fielddata. More...
 
void ExtractElmtDataToCoeffs (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
 Extract the data in fielddata into the coeffs using the basic ExpList Elemental expansions rather than planes in homogeneous case. More...
 
void ExtractCoeffsToCoeffs (const boost::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
 Extract the data from fromField using fromExpList the coeffs using the basic ExpList Elemental expansions rather than planes in homogeneous case. More...
 
void ExtractDataToCoeffs (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
 Extract the data in fielddata into the coeffs. More...
 
boost::shared_ptr< ExpListGetSharedThisPtr ()
 Returns a shared pointer to the current object. More...
 
boost::shared_ptr
< LibUtilities::SessionReader
GetSession () const
 Returns the session object. More...
 
boost::shared_ptr
< LibUtilities::Comm
GetComm ()
 Returns the comm object. More...
 
SpatialDomains::MeshGraphSharedPtr GetGraph ()
 
LibUtilities::BasisSharedPtr GetHomogeneousBasis (void)
 
boost::shared_ptr< ExpList > & GetPlane (int n)
 
void CreateCollections (Collections::ImplementationType ImpType=Collections::eNoImpType)
 Construct collections of elements containing a single element type and polynomial order from the list of expansions. More...
 
void ClearGlobalLinSysManager (void)
 

Public Attributes

Array< OneD, int > m_BCtoElmMap
 
Array< OneD, int > m_BCtoFaceMap
 
- Public Attributes inherited from Nektar::MultiRegions::ExpList
ExpansionType m_expType
 

Protected Member Functions

void SetUpDG (const std::string="DefaultVar")
 Set up all DG member variables and maps. More...
 
bool SameTypeOfBoundaryConditions (const DisContField3D &In)
 
void GenerateBoundaryConditionExpansion (const SpatialDomains::MeshGraphSharedPtr &graph3D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
 
void FindPeriodicFaces (const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
 Determine the periodic faces, edges and vertices for the given graph. More...
 
bool IsLeftAdjacentFace (const int n, const int e)
 
virtual void v_GetFwdBwdTracePhys (Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
 This method extracts the "forward" and "backward" trace data from the array field and puts the data into output vectors Fwd and Bwd. More...
 
virtual void v_GetFwdBwdTracePhys (const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
 
virtual const std::vector< bool > & v_GetLeftAdjacentFaces (void) const
 
virtual void v_ExtractTracePhys (Array< OneD, NekDouble > &outarray)
 
virtual void v_ExtractTracePhys (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_AddTraceIntegral (const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
 Add trace contributions into elemental coefficient spaces. More...
 
virtual void v_AddFwdBwdTraceIntegral (const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &outarray)
 Add trace contributions into elemental coefficient spaces. More...
 
virtual void v_HelmSolve (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const FlagList &flags, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff, const Array< OneD, const NekDouble > &dirForcing, const bool PhysSpaceForcing)
 
virtual void v_GeneralMatrixOp (const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 Calculates the result of the multiplication of a global matrix of type specified by mkey with a vector given by inarray. More...
 
virtual void v_GetBoundaryToElmtMap (Array< OneD, int > &ElmtID, Array< OneD, int > &FaceID)
 Set up a list of elemeent IDs and edge IDs that link to the boundary conditions. More...
 
virtual void v_GetBndElmtExpansion (int i, boost::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
 
virtual void v_Reset ()
 Reset this field, so that geometry information can be updated. More...
 
virtual void v_GetPeriodicEntities (PeriodicMap &periodicVerts, PeriodicMap &periodicEdges, PeriodicMap &periodicFaces)
 
virtual ExpListSharedPtrv_GetTrace ()
 
virtual AssemblyMapDGSharedPtrv_GetTraceMap ()
 
virtual const Array< OneD,
const
MultiRegions::ExpListSharedPtr > & 
v_GetBndCondExpansions ()
 
virtual const Array< OneD,
const
SpatialDomains::BoundaryConditionShPtr > & 
v_GetBndConditions ()
 
virtual
MultiRegions::ExpListSharedPtr
v_UpdateBndCondExpansion (int i)
 
virtual Array< OneD,
SpatialDomains::BoundaryConditionShPtr > & 
v_UpdateBndConditions ()
 
virtual void v_EvaluateBoundaryConditions (const NekDouble time=0.0, const std::string varName="", const NekDouble x2_in=NekConstants::kNekUnsetDouble, const NekDouble x3_in=NekConstants::kNekUnsetDouble)
 This function evaluates the boundary conditions at a certain time-level. More...
 
virtual std::map< int,
RobinBCInfoSharedPtr
v_GetRobinBCInfo ()
 
- Protected Member Functions inherited from Nektar::MultiRegions::ExpList3D
virtual void v_SetUpPhysNormals ()
 Set up the normals on each expansion. More...
 
- Protected Member Functions inherited from Nektar::MultiRegions::ExpList
boost::shared_ptr< DNekMatGenGlobalMatrixFull (const GlobalLinSysKey &mkey, const boost::shared_ptr< AssemblyMapCG > &locToGloMap)
 
const DNekScalBlkMatSharedPtr GenBlockMatrix (const GlobalMatrixKey &gkey)
 This function assembles the block diagonal matrix of local matrices of the type mtype. More...
 
const DNekScalBlkMatSharedPtrGetBlockMatrix (const GlobalMatrixKey &gkey)
 
void MultiplyByBlockMatrix (const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
boost::shared_ptr< GlobalMatrixGenGlobalMatrix (const GlobalMatrixKey &mkey, const boost::shared_ptr< AssemblyMapCG > &locToGloMap)
 Generates a global matrix from the given key and map. More...
 
void GlobalEigenSystem (const boost::shared_ptr< DNekMat > &Gmat, Array< OneD, NekDouble > &EigValsReal, Array< OneD, NekDouble > &EigValsImag, Array< OneD, NekDouble > &EigVecs=NullNekDouble1DArray)
 
boost::shared_ptr< GlobalLinSysGenGlobalLinSys (const GlobalLinSysKey &mkey, const boost::shared_ptr< AssemblyMapCG > &locToGloMap)
 This operation constructs the global linear system of type mkey. More...
 
boost::shared_ptr< GlobalLinSysGenGlobalBndLinSys (const GlobalLinSysKey &mkey, const AssemblyMapSharedPtr &locToGloMap)
 Generate a GlobalLinSys from information provided by the key "mkey" and the mapping provided in LocToGloBaseMap. More...
 
void ReadGlobalOptimizationParameters ()
 
virtual int v_GetNumElmts (void)
 
virtual void v_Upwind (const Array< OneD, const Array< OneD, NekDouble > > &Vec, const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &Upwind)
 
virtual void v_Upwind (const Array< OneD, const NekDouble > &Vn, const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &Upwind)
 
virtual const Array< OneD,
const int > & 
v_GetTraceBndMap ()
 
virtual void v_GetNormals (Array< OneD, Array< OneD, NekDouble > > &normals)
 
virtual void v_AddTraceIntegral (const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
 
virtual void v_MultiplyByInvMassMatrix (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
 
virtual void v_LinearAdvectionDiffusionReactionSolve (const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, CoeffState coeffstate=eLocal, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
 
virtual void v_LinearAdvectionReactionSolve (const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, CoeffState coeffstate=eLocal, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
 
virtual void v_ImposeDirichletConditions (Array< OneD, NekDouble > &outarray)
 
virtual void v_FillBndCondFromField ()
 
virtual void v_FillBndCondFromField (const int nreg)
 
virtual void v_LocalToGlobal (bool UseComm)
 
virtual void v_LocalToGlobal (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseComm)
 
virtual void v_GlobalToLocal (void)
 
virtual void v_GlobalToLocal (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_BwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
 
virtual void v_BwdTrans_IterPerExp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_FwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
 
virtual void v_FwdTrans_IterPerExp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_SmoothField (Array< OneD, NekDouble > &field)
 
virtual void v_IProductWRTBase (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
 
virtual void v_IProductWRTBase_IterPerExp (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
 
virtual void v_GetCoords (Array< OneD, NekDouble > &coord_0, Array< OneD, NekDouble > &coord_1, Array< OneD, NekDouble > &coord_2=NullNekDouble1DArray)
 
virtual void v_PhysDeriv (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
 
virtual void v_PhysDeriv (const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d)
 
virtual void v_PhysDeriv (Direction edir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d)
 
virtual void v_CurlCurl (Array< OneD, Array< OneD, NekDouble > > &Vel, Array< OneD, Array< OneD, NekDouble > > &Q)
 
virtual void v_HomogeneousFwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
 
virtual void v_HomogeneousBwdTrans (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
 
virtual void v_DealiasedProd (const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
 
virtual void v_DealiasedDotProd (const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray, CoeffState coeffstate=eLocal)
 
virtual void v_GetBCValues (Array< OneD, NekDouble > &BndVals, const Array< OneD, NekDouble > &TotField, int BndID)
 
virtual void v_NormVectorIProductWRTBase (Array< OneD, const NekDouble > &V1, Array< OneD, const NekDouble > &V2, Array< OneD, NekDouble > &outarray, int BndID)
 
virtual void v_NormVectorIProductWRTBase (Array< OneD, Array< OneD, NekDouble > > &V, Array< OneD, NekDouble > &outarray)
 
virtual void v_ExtractElmtToBndPhys (int i, Array< OneD, NekDouble > &elmt, Array< OneD, NekDouble > &boundary)
 
virtual void v_ExtractPhysToBndElmt (int i, const Array< OneD, const NekDouble > &phys, Array< OneD, NekDouble > &bndElmt)
 
virtual void v_ExtractPhysToBnd (int i, const Array< OneD, const NekDouble > &phys, Array< OneD, NekDouble > &bnd)
 
virtual void v_GetBoundaryNormals (int i, Array< OneD, Array< OneD, NekDouble > > &normals)
 
virtual std::vector
< LibUtilities::FieldDefinitionsSharedPtr
v_GetFieldDefinitions (void)
 
virtual void v_GetFieldDefinitions (std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef)
 
virtual void v_AppendFieldData (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
 
virtual void v_AppendFieldData (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, Array< OneD, NekDouble > &coeffs)
 
virtual void v_ExtractDataToCoeffs (LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
 Extract data from raw field data into expansion list. More...
 
virtual void v_ExtractCoeffsToCoeffs (const boost::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
 
virtual void v_WriteTecplotHeader (std::ostream &outfile, std::string var="")
 
virtual void v_WriteTecplotZone (std::ostream &outfile, int expansion)
 
virtual void v_WriteTecplotField (std::ostream &outfile, int expansion)
 
virtual void v_WriteTecplotConnectivity (std::ostream &outfile, int expansion)
 
virtual void v_WriteVtkPieceData (std::ostream &outfile, int expansion, std::string var)
 
virtual NekDouble v_L2 (const Array< OneD, const NekDouble > &phys, const Array< OneD, const NekDouble > &soln=NullNekDouble1DArray)
 
virtual NekDouble v_Integral (const Array< OneD, const NekDouble > &inarray)
 
virtual Array< OneD, const
NekDouble
v_HomogeneousEnergy (void)
 
virtual
LibUtilities::TranspositionSharedPtr 
v_GetTransposition (void)
 
virtual NekDouble v_GetHomoLen (void)
 
virtual Array< OneD, const
unsigned int > 
v_GetZIDs (void)
 
virtual Array< OneD, const
unsigned int > 
v_GetYIDs (void)
 
virtual void v_ClearGlobalLinSysManager (void)
 
void ExtractFileBCs (const std::string &fileName, LibUtilities::CommSharedPtr comm, const std::string &varName, const boost::shared_ptr< ExpList > locExpList)
 

Protected Attributes

Array< OneD,
MultiRegions::ExpListSharedPtr
m_bndCondExpansions
 An object which contains the discretised boundary conditions. More...
 
Array< OneD,
SpatialDomains::BoundaryConditionShPtr
m_bndConditions
 An array which contains the information about the boundary condition on the different boundary regions. More...
 
GlobalLinSysMapShPtr m_globalBndMat
 
ExpListSharedPtr m_trace
 
AssemblyMapDGSharedPtr m_traceMap
 
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
 Map of local trace (the points at the face of the element) to the trace space discretisation. More...
 
std::set< int > m_boundaryFaces
 A set storing the global IDs of any boundary faces. More...
 
PeriodicMap m_periodicFaces
 A map which identifies pairs of periodic faces. More...
 
PeriodicMap m_periodicEdges
 A map which identifies groups of periodic edges. More...
 
PeriodicMap m_periodicVerts
 A map which identifies groups of periodic vertices. More...
 
std::vector< bool > m_leftAdjacentFaces
 
std::vector< int > m_periodicFwdCopy
 A vector indicating degress of freedom which need to be copied from forwards to backwards space in case of a periodic boundary condition. More...
 
std::vector< int > m_periodicBwdCopy
 
- Protected Attributes inherited from Nektar::MultiRegions::ExpList
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 Session. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Mesh associated with this expansion list. More...
 
int m_ncoeffs
 The total number of local degrees of freedom. m_ncoeffs $=N_{\mathrm{eof}}=\sum_{e=1}^{{N_{\mathrm{el}}}}N^{e}_l$. More...
 
int m_npoints
 
Array< OneD, NekDoublem_coeffs
 Concatenation of all local expansion coefficients. More...
 
Array< OneD, NekDoublem_phys
 The global expansion evaluated at the quadrature points. More...
 
bool m_physState
 The state of the array m_phys. More...
 
boost::shared_ptr
< LocalRegions::ExpansionVector
m_exp
 The list of local expansions. More...
 
Collections::CollectionVector m_collections
 
std::vector< int > m_coll_coeff_offset
 Offset of elemental data into the array m_coeffs. More...
 
std::vector< int > m_coll_phys_offset
 Offset of elemental data into the array m_phys. More...
 
Array< OneD, int > m_coeff_offset
 Offset of elemental data into the array m_coeffs. More...
 
Array< OneD, int > m_phys_offset
 Offset of elemental data into the array m_phys. More...
 
Array< OneD, int > m_offset_elmt_id
 Array containing the element id m_offset_elmt_id[n] that the n^th consecutive block of data in m_coeffs and m_phys is associated, i.e. for an array of constant expansion size and single shape elements m_phys[n*m_npoints] is the data related to m_exp[m_offset_elmt_id[n]];. More...
 
NekOptimize::GlobalOptParamSharedPtr m_globalOptParam
 
BlockMatrixMapShPtr m_blockMat
 
bool m_WaveSpace
 
boost::unordered_map< int, int > m_elmtToExpId
 Mapping from geometry ID of element to index inside m_exp. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Nektar::MultiRegions::ExpList
static
SpatialDomains::BoundaryConditionShPtr 
GetBoundaryCondition (const SpatialDomains::BoundaryConditionCollection &collection, unsigned int index, const std::string &variable)
 

Detailed Description

Abstraction of a global discontinuous three-dimensional spectral/hp element expansion which approximates the solution of a set of partial differential equations.

Definition at line 55 of file DisContField3D.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::DisContField3D::DisContField3D ( )

Default constructor.

Definition at line 66 of file DisContField3D.cpp.

66  :
67  ExpList3D (),
69  m_bndConditions (),
71  {
72  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1485
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
ExpList3D()
Default constructor.
Definition: ExpList3D.cpp:54
Nektar::MultiRegions::DisContField3D::DisContField3D ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr graph3D,
const std::string &  variable,
const bool  SetUpJustDG = true 
)

Constructs a global discontinuous field based on an input mesh with boundary conditions.

Definition at line 78 of file DisContField3D.cpp.

References Nektar::MultiRegions::ExpList::EvaluateBoundaryConditions(), FindPeriodicFaces(), GenerateBoundaryConditionExpansion(), Nektar::MultiRegions::ExpList::GetBoundaryToElmtMap(), m_bndCondExpansions, Nektar::MultiRegions::ExpList::m_session, and SetUpDG().

83  : ExpList3D (pSession, graph3D, variable),
85  m_bndConditions (),
87  {
88  // do not set up BCs if default variable
89  if (variable.compare("DefaultVar") != 0)
90  {
91  SpatialDomains::BoundaryConditions bcs(m_session, graph3D);
92 
93  GenerateBoundaryConditionExpansion(graph3D,bcs,variable);
94  EvaluateBoundaryConditions(0.0, variable);
95 
96  // Find periodic edges for this variable.
97  FindPeriodicFaces(bcs, variable);
98  }
99 
100  if(SetUpJustDG)
101  {
102  SetUpDG();
103  }
104  else
105  {
106  // Set element edges to point to Robin BC edges if required.
107  int i, cnt, f;
108  Array<OneD, int> ElmtID, FaceID;
109  GetBoundaryToElmtMap(ElmtID, FaceID);
110 
111  for(cnt = i = 0; i < m_bndCondExpansions.num_elements(); ++i)
112  {
114  locExpList = m_bndCondExpansions[i];
115 
116  for(f = 0; f < locExpList->GetExpSize(); ++f)
117  {
119  = (*m_exp)[ElmtID[cnt+f]]->
120  as<LocalRegions::Expansion3D>();
122  = locExpList->GetExp(f)->
123  as<LocalRegions::Expansion2D>();
124 
125  exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
126  exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
127  }
128  cnt += m_bndCondExpansions[i]->GetExpSize();
129  }
130  }
131  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1485
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble=NekConstants::kNekUnsetDouble, const NekDouble=NekConstants::kNekUnsetDouble)
Definition: ExpList.h:2249
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Definition: ExpList.h:2302
void FindPeriodicFaces(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic faces, edges and vertices for the given graph.
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph3D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: ExpList.h:969
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
ExpList3D()
Default constructor.
Definition: ExpList3D.cpp:54
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
Nektar::MultiRegions::DisContField3D::DisContField3D ( const DisContField3D In,
const SpatialDomains::MeshGraphSharedPtr graph3D,
const std::string &  variable,
const bool  SetUpJustDG = false 
)

Definition at line 137 of file DisContField3D.cpp.

References Nektar::MultiRegions::ExpList::ApplyGeomInfo(), Nektar::MultiRegions::ExpList::EvaluateBoundaryConditions(), FindPeriodicFaces(), GenerateBoundaryConditionExpansion(), Nektar::MultiRegions::ExpList::GetBoundaryToElmtMap(), m_bndCondExpansions, m_globalBndMat, m_locTraceToTraceMap, m_periodicEdges, m_periodicFaces, m_periodicVerts, Nektar::MultiRegions::ExpList::m_session, m_trace, m_traceMap, SameTypeOfBoundaryConditions(), SetUpDG(), and Nektar::MultiRegions::ExpList::SetUpPhysNormals().

142  : ExpList3D(In),
144  {
145  SpatialDomains::BoundaryConditions bcs(m_session, graph3D);
146 
147  GenerateBoundaryConditionExpansion(graph3D,bcs,variable);
148  EvaluateBoundaryConditions(0.0, variable);
149  ApplyGeomInfo();
150 
152  {
153  // Find periodic edges for this variable.
154  FindPeriodicFaces(bcs, variable);
155 
156  if (SetUpJustDG)
157  {
158  SetUpDG(variable);
159  }
160  else
161  {
162  int i,cnt,f;
163  Array<OneD, int> ElmtID,FaceID;
164  GetBoundaryToElmtMap(ElmtID,FaceID);
165 
166  for(cnt = i = 0; i < m_bndCondExpansions.num_elements(); ++i)
167  {
169  locExpList = m_bndCondExpansions[i];
170 
171  for(f = 0; f < locExpList->GetExpSize(); ++f)
172  {
174  = (*m_exp)[ElmtID[cnt+f]]->
175  as<LocalRegions::Expansion3D>();
177  = locExpList->GetExp(f)->
178  as<LocalRegions::Expansion2D>();
179 
180  exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
181  exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
182  }
183 
184  cnt += m_bndCondExpansions[i]->GetExpSize();
185  }
187  }
188 
189  }
190  //else if we have the same boundary condition
191  else
192  {
193  m_globalBndMat = In.m_globalBndMat;
194  m_trace = In.m_trace;
195  m_traceMap = In.m_traceMap;
196  m_locTraceToTraceMap = In.m_locTraceToTraceMap;
197  m_periodicVerts = In.m_periodicVerts;
198  m_periodicEdges = In.m_periodicEdges;
199  m_periodicFaces = In.m_periodicFaces;
200 
201  if(SetUpJustDG)
202  {
203  }
204  else
205  {
206  int i,cnt,f;
207  Array<OneD, int> ElmtID,FaceID;
208  GetBoundaryToElmtMap(ElmtID,FaceID);
209 
210  for (cnt = i = 0;
211  i < m_bndCondExpansions.num_elements(); ++i)
212  {
214  locExpList = m_bndCondExpansions[i];
215 
216  for(f = 0; f < locExpList->GetExpSize(); ++f)
217  {
219  = (*m_exp)[ElmtID[cnt+f]]->
220  as<LocalRegions::Expansion3D>();
222  = locExpList->GetExp(f)->
223  as<LocalRegions::Expansion2D>();
224 
225  exp3d->SetFaceExp(FaceID[cnt+f], exp2d);
226  exp2d->SetAdjacentElementExp(FaceID[cnt+f], exp3d);
227  }
228 
229  cnt += m_bndCondExpansions[i]->GetExpSize();
230  }
231 
232  if (m_session->DefinesSolverInfo("PROJECTION"))
233  {
234  std::string ProjectStr =
235  m_session->GetSolverInfo("PROJECTION");
236  if (ProjectStr == "MixedCGDG" ||
237  ProjectStr == "Mixed_CG_Discontinuous")
238  {
239  SetUpDG(variable);
240  }
241  else
242  {
244  }
245  }
246  else
247  {
249  }
250  }
251  }
252  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1485
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble=NekConstants::kNekUnsetDouble, const NekDouble=NekConstants::kNekUnsetDouble)
Definition: ExpList.h:2249
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Definition: ExpList.h:2302
void ApplyGeomInfo()
Apply geometry information to each expansion.
Definition: ExpList.cpp:1500
void FindPeriodicFaces(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic faces, edges and vertices for the given graph.
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph3D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: ExpList.h:969
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
bool SameTypeOfBoundaryConditions(const DisContField3D &In)
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
ExpList3D()
Default constructor.
Definition: ExpList3D.cpp:54
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
Nektar::MultiRegions::DisContField3D::DisContField3D ( const DisContField3D In)

Constructs a global discontinuous field based on another discontinuous field.

Definition at line 257 of file DisContField3D.cpp.

257  :
258  ExpList3D(In),
259  m_bndCondExpansions (In.m_bndCondExpansions),
260  m_bndConditions (In.m_bndConditions),
261  m_globalBndMat (In.m_globalBndMat),
262  m_trace (In.m_trace),
263  m_traceMap (In.m_traceMap),
264  m_locTraceToTraceMap (In.m_locTraceToTraceMap),
265  m_periodicFaces (In.m_periodicFaces),
266  m_periodicEdges (In.m_periodicEdges),
267  m_periodicVerts (In.m_periodicVerts)
268  {
269  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
ExpList3D()
Default constructor.
Definition: ExpList3D.cpp:54
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
Nektar::MultiRegions::DisContField3D::~DisContField3D ( )
virtual

Destructor.

Definition at line 274 of file DisContField3D.cpp.

275  {
276  }

Member Function Documentation

void Nektar::MultiRegions::DisContField3D::EvaluateHDGPostProcessing ( Array< OneD, NekDouble > &  outarray)

Evaluate HDG post-processing to increase polynomial order of solution.

This function takes the solution (assumed to be one order lower) in physical space, and postprocesses at the current polynomial order by solving the system:

\[ \begin{aligned} (\nabla w, \nabla u^*) &= (\nabla w, u), \\ \langle \nabla u^*, 1 \rangle &= \langle \nabla u, 1 \rangle \end{aligned} \]

where $ u $ corresponds with the current solution as stored inside m_coeffs.

Parameters
outarrayThe resulting field $ u^* $.

Definition at line 2269 of file DisContField3D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGaussRadauMAlpha1Beta0, Nektar::LibUtilities::eGaussRadauMAlpha2Beta0, Nektar::LibUtilities::eHexahedron, Nektar::StdRegions::eInvLaplacianWithUnityMean, Nektar::LibUtilities::eOrtho_A, Nektar::LibUtilities::eOrtho_B, Nektar::LibUtilities::eOrtho_C, Nektar::LibUtilities::ePrism, Nektar::LibUtilities::eTetrahedron, Nektar::eWrapper, Nektar::MultiRegions::ExpList::GetExpSize(), Nektar::NekVector< DataType >::GetPtr(), Nektar::MultiRegions::ExpList::m_coeff_offset, Nektar::MultiRegions::ExpList::m_coeffs, Nektar::MultiRegions::ExpList::m_offset_elmt_id, m_trace, m_traceMap, Vmath::Vadd(), and Vmath::Vcopy().

2271  {
2272  int i,cnt,f,ncoeff_face;
2273  Array<OneD, NekDouble> force, out_tmp,qrhs,qrhs1;
2274  Array<OneD, Array< OneD, LocalRegions::ExpansionSharedPtr> >
2275  &elmtToTrace = m_traceMap->GetElmtToTrace();
2276 
2277  int eid,nq_elmt, nm_elmt;
2278  int LocBndCoeffs = m_traceMap->GetNumLocalBndCoeffs();
2279  Array<OneD, NekDouble> loc_lambda(LocBndCoeffs), face_lambda;
2280  Array<OneD, NekDouble> tmp_coeffs;
2281  m_traceMap->GlobalToLocalBnd(m_trace->GetCoeffs(),loc_lambda);
2282 
2283  face_lambda = loc_lambda;
2284 
2285  // Calculate Q using standard DG formulation.
2286  for(i = cnt = 0; i < GetExpSize(); ++i)
2287  {
2289  (*m_exp)[i]->as<LocalRegions::Expansion3D>();
2290 
2291  eid = m_offset_elmt_id[i];
2292  nq_elmt = (*m_exp)[eid]->GetTotPoints();
2293  nm_elmt = (*m_exp)[eid]->GetNcoeffs();
2294  qrhs = Array<OneD, NekDouble>(nq_elmt);
2295  qrhs1 = Array<OneD, NekDouble>(nq_elmt);
2296  force = Array<OneD, NekDouble>(2*nm_elmt);
2297  out_tmp = force + nm_elmt;
2299 
2300  int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
2301  int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
2302  int num_points2 = (*m_exp)[eid]->GetBasis(2)->GetNumPoints();
2303  int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
2304  int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2305  int num_modes2 = (*m_exp)[eid]->GetBasis(2)->GetNumModes();
2306 
2307  // Probably a better way of setting up lambda than this. Note
2308  // cannot use PutCoeffsInToElmts since lambda space is mapped
2309  // during the solve.
2310  int nFaces = (*m_exp)[eid]->GetNfaces();
2311  Array<OneD, Array<OneD, NekDouble> > faceCoeffs(nFaces);
2312  for(f = 0; f < nFaces; ++f)
2313  {
2314  ncoeff_face = elmtToTrace[eid][f]->GetNcoeffs();
2315  faceCoeffs[f] = Array<OneD, NekDouble>(ncoeff_face);
2316  Vmath::Vcopy(ncoeff_face, face_lambda, 1, faceCoeffs[f], 1);
2317  exp->SetFaceToGeomOrientation(f, faceCoeffs[f]);
2318  face_lambda = face_lambda + ncoeff_face;
2319  }
2320 
2321  //creating orthogonal expansion (checking if we have quads or triangles)
2322  LibUtilities::ShapeType shape = (*m_exp)[eid]->DetShapeType();
2323  switch(shape)
2324  {
2326  {
2327  const LibUtilities::PointsKey PkeyH1(num_points0,LibUtilities::eGaussLobattoLegendre);
2328  const LibUtilities::PointsKey PkeyH2(num_points1,LibUtilities::eGaussLobattoLegendre);
2329  const LibUtilities::PointsKey PkeyH3(num_points2,LibUtilities::eGaussLobattoLegendre);
2330  LibUtilities::BasisKey BkeyH1(LibUtilities::eOrtho_A, num_modes0, PkeyH1);
2331  LibUtilities::BasisKey BkeyH2(LibUtilities::eOrtho_A, num_modes1, PkeyH2);
2332  LibUtilities::BasisKey BkeyH3(LibUtilities::eOrtho_A, num_modes2, PkeyH3);
2333  SpatialDomains::HexGeomSharedPtr hGeom = boost::dynamic_pointer_cast<SpatialDomains::HexGeom>((*m_exp)[eid]->GetGeom());
2334  ppExp = MemoryManager<LocalRegions::HexExp>::AllocateSharedPtr(BkeyH1, BkeyH2, BkeyH3, hGeom);
2335  }
2336  break;
2338  {
2339  const LibUtilities::PointsKey PkeyT1(num_points0,LibUtilities::eGaussLobattoLegendre);
2340  const LibUtilities::PointsKey PkeyT2(num_points1,LibUtilities::eGaussRadauMAlpha1Beta0);
2341  const LibUtilities::PointsKey PkeyT3(num_points2,LibUtilities::eGaussRadauMAlpha2Beta0);
2342  LibUtilities::BasisKey BkeyT1(LibUtilities::eOrtho_A, num_modes0, PkeyT1);
2343  LibUtilities::BasisKey BkeyT2(LibUtilities::eOrtho_B, num_modes1, PkeyT2);
2344  LibUtilities::BasisKey BkeyT3(LibUtilities::eOrtho_C, num_modes2, PkeyT3);
2345  SpatialDomains::TetGeomSharedPtr tGeom = boost::dynamic_pointer_cast<SpatialDomains::TetGeom>((*m_exp)[eid]->GetGeom());
2346  ppExp = MemoryManager<LocalRegions::TetExp>::AllocateSharedPtr(BkeyT1, BkeyT2, BkeyT3, tGeom);
2347  }
2348  break;
2349  case LibUtilities::ePrism:
2350  {
2351  const LibUtilities::PointsKey PkeyP1(num_points0,LibUtilities::eGaussLobattoLegendre);
2352  const LibUtilities::PointsKey PkeyP2(num_points1,LibUtilities::eGaussLobattoLegendre);
2353  const LibUtilities::PointsKey PkeyP3(num_points2,LibUtilities::eGaussRadauMAlpha1Beta0);
2354  LibUtilities::BasisKey BkeyP1(LibUtilities::eOrtho_A, num_modes0, PkeyP1);
2355  LibUtilities::BasisKey BkeyP2(LibUtilities::eOrtho_A, num_modes1, PkeyP2);
2356  LibUtilities::BasisKey BkeyP3(LibUtilities::eOrtho_B, num_modes2, PkeyP3);
2357  SpatialDomains::PrismGeomSharedPtr pGeom = boost::dynamic_pointer_cast<SpatialDomains::PrismGeom>((*m_exp)[eid]->GetGeom());
2358  ppExp = MemoryManager<LocalRegions::PrismExp>::AllocateSharedPtr(BkeyP1, BkeyP2, BkeyP3, pGeom);
2359  }
2360  break;
2361  default:
2362  ASSERTL0(false, "Wrong shape type, HDG postprocessing is not implemented");
2363  };
2364 
2365 
2366  //DGDeriv
2367  // (d/dx w, q_0)
2368  (*m_exp)[eid]->DGDeriv(
2369  0,tmp_coeffs = m_coeffs + m_coeff_offset[eid],
2370  elmtToTrace[eid], faceCoeffs, out_tmp);
2371  (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2372  ppExp->IProductWRTDerivBase(0,qrhs,force);
2373 
2374 
2375  // + (d/dy w, q_1)
2376  (*m_exp)[eid]->DGDeriv(
2377  1,tmp_coeffs = m_coeffs + m_coeff_offset[eid],
2378  elmtToTrace[eid], faceCoeffs, out_tmp);
2379  (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2380  ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2381 
2382  Vmath::Vadd(nm_elmt,force,1,out_tmp,1,force,1);
2383 
2384  // + (d/dz w, q_2)
2385  (*m_exp)[eid]->DGDeriv(
2386  2,tmp_coeffs = m_coeffs + m_coeff_offset[eid],
2387  elmtToTrace[eid], faceCoeffs, out_tmp);
2388  (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2389  ppExp->IProductWRTDerivBase(2,qrhs,out_tmp);
2390 
2391  Vmath::Vadd(nm_elmt,force,1,out_tmp,1,force,1);
2392  // determine force[0] = (1,u)
2393  (*m_exp)[eid]->BwdTrans(
2394  tmp_coeffs = m_coeffs + m_coeff_offset[eid],qrhs);
2395  force[0] = (*m_exp)[eid]->Integral(qrhs);
2396 
2397  // multiply by inverse Laplacian matrix
2398  // get matrix inverse
2399  LocalRegions::MatrixKey lapkey(StdRegions::eInvLaplacianWithUnityMean, ppExp->DetShapeType(), *ppExp);
2400  DNekScalMatSharedPtr lapsys = ppExp->GetLocMatrix(lapkey);
2401 
2402  NekVector<NekDouble> in (nm_elmt, force, eWrapper);
2403  NekVector<NekDouble> out(nm_elmt);
2404 
2405  out = (*lapsys)*in;
2406 
2407  // Transforming back to modified basis
2408  Array<OneD, NekDouble> work(nq_elmt);
2409  ppExp->BwdTrans(out.GetPtr(), work);
2410  (*m_exp)[eid]->FwdTrans(work,
2411  tmp_coeffs = outarray + m_coeff_offset[eid]);
2412  }
2413  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:110
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
Definition: ExpList.h:998
int GetExpSize(void)
This function returns the number of elements in the expansion.
Definition: ExpList.h:2054
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:59
Principle Orthogonal Functions .
Definition: BasisType.h:47
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
Definition: ExpList.h:1047
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
Array< OneD, int > m_offset_elmt_id
Array containing the element id m_offset_elmt_id[n] that the n^th consecutive block of data in m_coef...
Definition: ExpList.h:1058
Principle Orthogonal Functions .
Definition: BasisType.h:48
Principle Orthogonal Functions .
Definition: BasisType.h:46
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
boost::shared_ptr< PrismGeom > PrismGeomSharedPtr
Definition: PrismGeom.h:109
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:60
boost::shared_ptr< TetGeom > TetGeomSharedPtr
Definition: TetGeom.h:106
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:52
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:299
void Nektar::MultiRegions::DisContField3D::FindPeriodicFaces ( const SpatialDomains::BoundaryConditions bcs,
const std::string &  variable 
)
protected

Determine the periodic faces, edges and vertices for the given graph.

Parameters
bcsInformation about the boundary conditions.
variableSpecifies the field.

Definition at line 673 of file DisContField3D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ASSERTL1, Nektar::StdRegions::eBackwards, 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, Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, Nektar::StdRegions::eForwards, Nektar::StdRegions::eNoOrientation, Nektar::SpatialDomains::ePeriodic, Nektar::MultiRegions::ExpList::GetBoundaryCondition(), Nektar::SpatialDomains::BoundaryConditions::GetBoundaryConditions(), Nektar::SpatialDomains::BoundaryConditions::GetBoundaryRegions(), Nektar::SpatialDomains::QuadGeom::GetFaceOrientation(), Nektar::SpatialDomains::TriGeom::GetFaceOrientation(), Nektar::iterator, Nektar::MultiRegions::ExpList::m_graph, m_periodicEdges, m_periodicFaces, m_periodicVerts, Nektar::MultiRegions::ExpList::m_session, CellMLToNektar.cellml_metadata::p, Nektar::LibUtilities::ReduceSum, and Vmath::Vsum().

Referenced by DisContField3D().

676  {
678  = bcs.GetBoundaryRegions();
680  = bcs.GetBoundaryConditions();
682  = boost::dynamic_pointer_cast<
683  SpatialDomains::MeshGraph3D>(m_graph);
684  SpatialDomains::BoundaryRegionCollection::const_iterator it;
685 
687  m_session->GetComm()->GetRowComm();
689  m_session->GetCompositeOrdering();
690  LibUtilities::BndRegionOrdering bndRegOrder =
691  m_session->GetBndRegionOrdering();
693  m_graph->GetComposites();
694 
695  // perComps: Stores a unique collection of pairs of periodic
696  // composites (i.e. if composites 1 and 2 are periodic then this map
697  // will contain either the pair (1,2) or (2,1) but not both).
698  //
699  // The four maps allVerts, allCoord, allEdges and allOrient map a
700  // periodic face to a vector containing the vertex ids of the face;
701  // their coordinates; the edge ids of the face; and their
702  // orientation within that face respectively.
703  //
704  // Finally the three sets locVerts, locEdges and locFaces store any
705  // vertices, edges and faces that belong to a periodic composite and
706  // lie on this process.
707  map<int,int> perComps;
708  map<int,vector<int> > allVerts;
709  map<int,SpatialDomains::PointGeomVector> allCoord;
710  map<int,vector<int> > allEdges;
711  map<int,vector<StdRegions::Orientation> > allOrient;
712  set<int> locVerts;
713  set<int> locEdges;
714  set<int> locFaces;
715 
716  int region1ID, region2ID, i, j, k, cnt;
718 
719  // Set up a set of all local verts and edges.
720  for(i = 0; i < (*m_exp).size(); ++i)
721  {
722  for(j = 0; j < (*m_exp)[i]->GetNverts(); ++j)
723  {
724  int id = (*m_exp)[i]->GetGeom()->GetVid(j);
725  locVerts.insert(id);
726  }
727 
728  for(j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
729  {
730  int id = (*m_exp)[i]->GetGeom()->GetEid(j);
731  locEdges.insert(id);
732  }
733  }
734 
735  // Begin by populating the perComps map. We loop over all periodic
736  // boundary conditions and determine the composite associated with
737  // it, then fill out the all* maps.
738  for (it = bregions.begin(); it != bregions.end(); ++it)
739  {
740  locBCond = GetBoundaryCondition(
741  bconditions, it->first, variable);
742 
743  if (locBCond->GetBoundaryConditionType()
745  {
746  continue;
747  }
748 
749  // Identify periodic boundary region IDs.
750  region1ID = it->first;
751  region2ID = boost::static_pointer_cast<
752  SpatialDomains::PeriodicBoundaryCondition>(
753  locBCond)->m_connectedBoundaryRegion;
754 
755  // Check the region only contains a single composite.
756  ASSERTL0(it->second->size() == 1,
757  "Boundary region "+boost::lexical_cast<string>(
758  region1ID)+" should only contain 1 composite.");
759 
760  // From this identify composites by looking at the original
761  // boundary region ordering. Note that in serial the mesh
762  // partitioner is not run, so this map will be empty and
763  // therefore needs to be populated by using the corresponding
764  // boundary region.
765  int cId1, cId2;
766  if (vComm->GetSize() == 1)
767  {
768  cId1 = it->second->begin()->first;
769  cId2 = bregions.find(region2ID)->second->begin()->first;
770  }
771  else
772  {
773  cId1 = bndRegOrder.find(region1ID)->second[0];
774  cId2 = bndRegOrder.find(region2ID)->second[0];
775  }
776 
777  SpatialDomains::Composite c = it->second->begin()->second;
778  vector<unsigned int> tmpOrder;
779 
780  // From the composite, we now construct the allVerts, allEdges
781  // and allCoord map so that they can be transferred across
782  // processors. We also populate the locFaces set to store a
783  // record of all faces local to this process.
784  for (i = 0; i < c->size(); ++i)
785  {
787  boost::dynamic_pointer_cast<
788  SpatialDomains::Geometry2D>((*c)[i]);
789  ASSERTL1(faceGeom, "Unable to cast to shared ptr");
790 
791  // Get geometry ID of this face and store in locFaces.
792  int faceId = (*c)[i]->GetGlobalID();
793  locFaces.insert(faceId);
794 
795  // In serial, mesh partitioning will not have occurred so
796  // need to fill composite ordering map manually.
797  if (vComm->GetSize() == 1)
798  {
799  tmpOrder.push_back((*c)[i]->GetGlobalID());
800  }
801 
802  // Loop over vertices and edges of the face to populate
803  // allVerts, allEdges and allCoord maps.
804  vector<int> vertList, edgeList;
806  vector<StdRegions::Orientation> orientVec;
807  for (j = 0; j < faceGeom->GetNumVerts(); ++j)
808  {
809  vertList .push_back(faceGeom->GetVid (j));
810  edgeList .push_back(faceGeom->GetEid (j));
811  coordVec .push_back(faceGeom->GetVertex(j));
812  orientVec.push_back(faceGeom->GetEorient(j));
813  }
814 
815  allVerts [faceId] = vertList;
816  allEdges [faceId] = edgeList;
817  allCoord [faceId] = coordVec;
818  allOrient[faceId] = orientVec;
819  }
820 
821  // In serial, record the composite ordering in compOrder for
822  // later in the routine.
823  if (vComm->GetSize() == 1)
824  {
825  compOrder[it->second->begin()->first] = tmpOrder;
826  }
827 
828  // See if we already have either region1 or region2 stored in
829  // perComps map already and do a sanity check to ensure regions
830  // are mutually periodic.
831  if (perComps.count(cId1) == 0)
832  {
833  if (perComps.count(cId2) == 0)
834  {
835  perComps[cId1] = cId2;
836  }
837  else
838  {
839  std::stringstream ss;
840  ss << "Boundary region " << cId2 << " should be "
841  << "periodic with " << perComps[cId2] << " but "
842  << "found " << cId1 << " instead!";
843  ASSERTL0(perComps[cId2] == cId1, ss.str());
844  }
845  }
846  else
847  {
848  std::stringstream ss;
849  ss << "Boundary region " << cId1 << " should be "
850  << "periodic with " << perComps[cId1] << " but "
851  << "found " << cId2 << " instead!";
852  ASSERTL0(perComps[cId1] == cId1, ss.str());
853  }
854  }
855 
856  // The next routines process local face lists to exchange vertices,
857  // edges and faces.
858  int n = vComm->GetSize();
859  int p = vComm->GetRank();
860  int totFaces;
861  Array<OneD, int> facecounts(n,0);
862  Array<OneD, int> vertcounts(n,0);
863  Array<OneD, int> faceoffset(n,0);
864  Array<OneD, int> vertoffset(n,0);
865 
866  // First exchange the number of faces on each process.
867  facecounts[p] = locFaces.size();
868  vComm->AllReduce(facecounts, LibUtilities::ReduceSum);
869 
870  // Set up an offset map to allow us to distribute face IDs to all
871  // processors.
872  faceoffset[0] = 0;
873  for (i = 1; i < n; ++i)
874  {
875  faceoffset[i] = faceoffset[i-1] + facecounts[i-1];
876  }
877 
878  // Calculate total number of faces.
879  totFaces = Vmath::Vsum(n, facecounts, 1);
880 
881  // faceIds holds face IDs for each periodic face. faceVerts holds
882  // the number of vertices in this face.
883  Array<OneD, int> faceIds (totFaces, 0);
884  Array<OneD, int> faceVerts(totFaces, 0);
885 
886  // Process p writes IDs of its faces into position faceoffset[p] of
887  // faceIds which allows us to perform an AllReduce to distribute
888  // information amongst processors.
889  set<int>::iterator sIt;
890  for (i = 0, sIt = locFaces.begin(); sIt != locFaces.end(); ++sIt)
891  {
892  faceIds [faceoffset[p] + i ] = *sIt;
893  faceVerts[faceoffset[p] + i++] = allVerts[*sIt].size();
894  }
895 
896  vComm->AllReduce(faceIds, LibUtilities::ReduceSum);
897  vComm->AllReduce(faceVerts, LibUtilities::ReduceSum);
898 
899  // procVerts holds number of vertices (and also edges since each
900  // face is 2D) on each process.
901  Array<OneD, int> procVerts(n,0);
902  int nTotVerts;
903 
904  // Note if there are no periodic faces at all calling Vsum will
905  // cause a segfault.
906  if (totFaces > 0)
907  {
908  // Calculate number of vertices on each processor.
909  nTotVerts = Vmath::Vsum(totFaces, faceVerts, 1);
910  }
911  else
912  {
913  nTotVerts = 0;
914  }
915 
916  for (i = 0; i < n; ++i)
917  {
918  if (facecounts[i] > 0)
919  {
920  procVerts[i] = Vmath::Vsum(
921  facecounts[i], faceVerts + faceoffset[i], 1);
922  }
923  else
924  {
925  procVerts[i] = 0;
926  }
927  }
928 
929  // vertoffset is defined in the same manner as edgeoffset
930  // beforehand.
931  vertoffset[0] = 0;
932  for (i = 1; i < n; ++i)
933  {
934  vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
935  }
936 
937  // At this point we exchange all vertex IDs, edge IDs and vertex
938  // coordinates for each face. The coordinates are necessary because
939  // we need to calculate relative face orientations between periodic
940  // faces to determined edge and vertex connectivity.
941  Array<OneD, int> vertIds(nTotVerts, 0);
942  Array<OneD, int> edgeIds(nTotVerts, 0);
943  Array<OneD, int> edgeOrt(nTotVerts, 0);
944  Array<OneD, NekDouble> vertX (nTotVerts, 0.0);
945  Array<OneD, NekDouble> vertY (nTotVerts, 0.0);
946  Array<OneD, NekDouble> vertZ (nTotVerts, 0.0);
947 
948  for (cnt = 0, sIt = locFaces.begin();
949  sIt != locFaces.end(); ++sIt)
950  {
951  for (j = 0; j < allVerts[*sIt].size(); ++j)
952  {
953  int vertId = allVerts[*sIt][j];
954  vertIds[vertoffset[p] + cnt ] = vertId;
955  vertX [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(0);
956  vertY [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(1);
957  vertZ [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(2);
958  edgeIds[vertoffset[p] + cnt ] = allEdges [*sIt][j];
959  edgeOrt[vertoffset[p] + cnt++] = allOrient[*sIt][j];
960  }
961  }
962 
963  vComm->AllReduce(vertIds, LibUtilities::ReduceSum);
964  vComm->AllReduce(vertX, LibUtilities::ReduceSum);
965  vComm->AllReduce(vertY, LibUtilities::ReduceSum);
966  vComm->AllReduce(vertZ, LibUtilities::ReduceSum);
967  vComm->AllReduce(edgeIds, LibUtilities::ReduceSum);
968  vComm->AllReduce(edgeOrt, LibUtilities::ReduceSum);
969 
970  // Finally now we have all of this information, we construct maps
971  // which make accessing the information easier. These are
972  // conceptually the same as all* maps at the beginning of the
973  // routine, but now hold information for all periodic vertices.
974  map<int, vector<int> > vertMap;
975  map<int, vector<int> > edgeMap;
976  map<int, SpatialDomains::PointGeomVector> coordMap;
977 
978  // These final two maps are required for determining the relative
979  // orientation of periodic edges. vCoMap associates vertex IDs with
980  // their coordinates, and eIdMap maps an edge ID to the two vertices
981  // which construct it.
982  map<int, SpatialDomains::PointGeomSharedPtr> vCoMap;
983  map<int, pair<int, int> > eIdMap;
984 
985  for (cnt = i = 0; i < totFaces; ++i)
986  {
987  vector<int> edges(faceVerts[i]);
988  vector<int> verts(faceVerts[i]);
989  SpatialDomains::PointGeomVector coord(faceVerts[i]);
990 
991  // Keep track of cnt to enable correct edge vertices to be
992  // inserted into eIdMap.
993  int tmp = cnt;
994  for (j = 0; j < faceVerts[i]; ++j, ++cnt)
995  {
996  edges[j] = edgeIds[cnt];
997  verts[j] = vertIds[cnt];
1000  3, verts[j], vertX[cnt], vertY[cnt], vertZ[cnt]);
1001  vCoMap[vertIds[cnt]] = coord[j];
1002 
1003  // Try to insert edge into the eIdMap to avoid re-inserting.
1004  pair<map<int, pair<int, int> >::iterator, bool> testIns =
1005  eIdMap.insert(make_pair(
1006  edgeIds[cnt],
1007  make_pair(vertIds[tmp+j],
1008  vertIds[tmp+((j+1) % faceVerts[i])])));
1009 
1010  if (testIns.second == false)
1011  {
1012  continue;
1013  }
1014 
1015  // If the edge is reversed with respect to the face, then
1016  // swap the edges so that we have the original ordering of
1017  // the edge in the 3D element. This is necessary to properly
1018  // determine edge orientation.
1019  if ((StdRegions::Orientation)edgeOrt[cnt]
1021  {
1022  swap(testIns.first->second.first,
1023  testIns.first->second.second);
1024  }
1025  }
1026 
1027  vertMap [faceIds[i]] = verts;
1028  edgeMap [faceIds[i]] = edges;
1029  coordMap[faceIds[i]] = coord;
1030  }
1031 
1032  // Go through list of composites and figure out which edges are
1033  // parallel from original ordering in session file. This includes
1034  // composites which are not necessarily on this process.
1035  map<int,int>::iterator cIt, pIt;
1036  map<int,int>::const_iterator oIt;
1037 
1038  // Store temporary map of periodic vertices which will hold all
1039  // periodic vertices on the entire mesh so that doubly periodic
1040  // vertices/edges can be counted properly across partitions. Local
1041  // vertices/edges are copied into m_periodicVerts and
1042  // m_periodicEdges at the end of the function.
1043  PeriodicMap periodicVerts;
1044  PeriodicMap periodicEdges;
1045 
1046  // Construct two maps which determine how vertices and edges of
1047  // faces connect given a specific face orientation. The key of the
1048  // map is the number of vertices in the face, used to determine
1049  // difference between tris and quads.
1050  map<int, map<StdRegions::Orientation, vector<int> > > vmap;
1051  map<int, map<StdRegions::Orientation, vector<int> > > emap;
1052 
1053  map<StdRegions::Orientation, vector<int> > quadVertMap;
1054  quadVertMap[StdRegions::eDir1FwdDir1_Dir2FwdDir2] += 0,1,2,3;
1055  quadVertMap[StdRegions::eDir1FwdDir1_Dir2BwdDir2] += 3,2,1,0;
1056  quadVertMap[StdRegions::eDir1BwdDir1_Dir2FwdDir2] += 1,0,3,2;
1057  quadVertMap[StdRegions::eDir1BwdDir1_Dir2BwdDir2] += 2,3,0,1;
1058  quadVertMap[StdRegions::eDir1FwdDir2_Dir2FwdDir1] += 0,3,2,1;
1059  quadVertMap[StdRegions::eDir1FwdDir2_Dir2BwdDir1] += 1,2,3,0;
1060  quadVertMap[StdRegions::eDir1BwdDir2_Dir2FwdDir1] += 3,0,1,2;
1061  quadVertMap[StdRegions::eDir1BwdDir2_Dir2BwdDir1] += 2,1,0,3;
1062 
1063  map<StdRegions::Orientation, vector<int> > quadEdgeMap;
1064  quadEdgeMap[StdRegions::eDir1FwdDir1_Dir2FwdDir2] += 0,1,2,3;
1065  quadEdgeMap[StdRegions::eDir1FwdDir1_Dir2BwdDir2] += 2,1,0,3;
1066  quadEdgeMap[StdRegions::eDir1BwdDir1_Dir2FwdDir2] += 0,3,2,1;
1067  quadEdgeMap[StdRegions::eDir1BwdDir1_Dir2BwdDir2] += 2,3,0,1;
1068  quadEdgeMap[StdRegions::eDir1FwdDir2_Dir2FwdDir1] += 3,2,1,0;
1069  quadEdgeMap[StdRegions::eDir1FwdDir2_Dir2BwdDir1] += 1,2,3,0;
1070  quadEdgeMap[StdRegions::eDir1BwdDir2_Dir2FwdDir1] += 3,0,1,2;
1071  quadEdgeMap[StdRegions::eDir1BwdDir2_Dir2BwdDir1] += 1,0,3,2;
1072 
1073  map<StdRegions::Orientation, vector<int> > triVertMap;
1074  triVertMap[StdRegions::eDir1FwdDir1_Dir2FwdDir2] += 0,1,2;
1075  triVertMap[StdRegions::eDir1BwdDir1_Dir2FwdDir2] += 1,0,2;
1076 
1077  map<StdRegions::Orientation, vector<int> > triEdgeMap;
1078  triEdgeMap[StdRegions::eDir1FwdDir1_Dir2FwdDir2] += 0,1,2;
1079  triEdgeMap[StdRegions::eDir1BwdDir1_Dir2FwdDir2] += 0,2,1;
1080 
1081  vmap[3] = triVertMap;
1082  vmap[4] = quadVertMap;
1083  emap[3] = triEdgeMap;
1084  emap[4] = quadEdgeMap;
1085 
1086  map<int,int> allCompPairs;
1087 
1088  // Finally we have enough information to populate the periodic
1089  // vertex, edge and face maps. Begin by looping over all pairs of
1090  // periodic composites to determine pairs of periodic faces.
1091  for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
1092  {
1094  const int id1 = cIt->first;
1095  const int id2 = cIt->second;
1096  std::string id1s = boost::lexical_cast<string>(id1);
1097  std::string id2s = boost::lexical_cast<string>(id2);
1098 
1099  if (compMap.count(id1) > 0)
1100  {
1101  c[0] = compMap[id1];
1102  }
1103 
1104  if (compMap.count(id2) > 0)
1105  {
1106  c[1] = compMap[id2];
1107  }
1108 
1109  ASSERTL0(c[0] || c[1],
1110  "Neither composite not found on this process!");
1111 
1112  // Loop over composite ordering to construct list of all
1113  // periodic faces, regardless of whether they are on this
1114  // process.
1115  map<int,int> compPairs;
1116 
1117  ASSERTL0(compOrder.count(id1) > 0,
1118  "Unable to find composite "+id1s+" in order map.");
1119  ASSERTL0(compOrder.count(id2) > 0,
1120  "Unable to find composite "+id2s+" in order map.");
1121  ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
1122  "Periodic composites "+id1s+" and "+id2s+
1123  " should have the same number of elements.");
1124  ASSERTL0(compOrder[id1].size() > 0,
1125  "Periodic composites "+id1s+" and "+id2s+
1126  " are empty!");
1127 
1128  // Look up composite ordering to determine pairs.
1129  for (i = 0; i < compOrder[id1].size(); ++i)
1130  {
1131  int eId1 = compOrder[id1][i];
1132  int eId2 = compOrder[id2][i];
1133 
1134  ASSERTL0(compPairs.count(eId1) == 0,
1135  "Already paired.");
1136 
1137  // Sanity check that the faces are mutually periodic.
1138  if (compPairs.count(eId2) != 0)
1139  {
1140  ASSERTL0(compPairs[eId2] == eId1, "Pairing incorrect");
1141  }
1142  compPairs[eId1] = eId2;
1143  }
1144 
1145  // Now that we have all pairs of periodic faces, loop over the
1146  // ones local to this process and populate face/edge/vertex
1147  // maps.
1148  for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1149  {
1150  int ids [2] = {pIt->first, pIt->second};
1151  bool local[2] = {locFaces.count(pIt->first) > 0,
1152  locFaces.count(pIt->second) > 0};
1153 
1154  ASSERTL0(coordMap.count(ids[0]) > 0 &&
1155  coordMap.count(ids[1]) > 0,
1156  "Unable to find face in coordinate map");
1157 
1158  allCompPairs[pIt->first ] = pIt->second;
1159  allCompPairs[pIt->second] = pIt->first;
1160 
1161  // Loop up coordinates of the faces, check they have the
1162  // same number of vertices.
1164  = { coordMap[ids[0]], coordMap[ids[1]] };
1165 
1166  ASSERTL0(tmpVec[0].size() == tmpVec[1].size(),
1167  "Two periodic faces have different number "
1168  "of vertices!");
1169 
1170  // o will store relative orientation of faces. Note that in
1171  // some transpose cases (Dir1FwdDir2_Dir2BwdDir1 and
1172  // Dir1BwdDir1_Dir2FwdDir1) it seems orientation will be
1173  // different going from face1->face2 instead of face2->face1
1174  // (check this).
1176 
1177  // Record periodic faces.
1178  for (i = 0; i < 2; ++i)
1179  {
1180  if (!local[i])
1181  {
1182  continue;
1183  }
1184 
1185  // Reference to the other face.
1186  int other = (i+1) % 2;
1187 
1188  // Calculate relative face orientation.
1189  if (tmpVec[0].size() == 3)
1190  {
1192  tmpVec[i], tmpVec[other]);
1193  }
1194  else
1195  {
1197  tmpVec[i], tmpVec[other]);
1198  }
1199 
1200  // Record face ID, orientation and whether other face is
1201  // local.
1202  PeriodicEntity ent(ids [other], o,
1203  local[other]);
1204  m_periodicFaces[ids[i]].push_back(ent);
1205  }
1206 
1207  int nFaceVerts = vertMap[ids[0]].size();
1208 
1209  // Determine periodic vertices.
1210  for (i = 0; i < 2; ++i)
1211  {
1212  int other = (i+1) % 2;
1213 
1214  // Calculate relative face orientation.
1215  if (tmpVec[0].size() == 3)
1216  {
1218  tmpVec[i], tmpVec[other]);
1219  }
1220  else
1221  {
1223  tmpVec[i], tmpVec[other]);
1224  }
1225 
1226  if (nFaceVerts == 3)
1227  {
1228  ASSERTL0(
1231  "Unsupported face orientation for face "+
1232  boost::lexical_cast<string>(ids[i]));
1233  }
1234 
1235  // Look up vertices for this face.
1236  vector<int> per1 = vertMap[ids[i]];
1237  vector<int> per2 = vertMap[ids[other]];
1238 
1239  // tmpMap will hold the pairs of vertices which are
1240  // periodic.
1241  map<int, pair<int, bool> > tmpMap;
1242  map<int, pair<int, bool> >::iterator mIt;
1243 
1244  // Use vmap to determine which vertices connect given
1245  // the orientation o.
1246  for (j = 0; j < nFaceVerts; ++j)
1247  {
1248  int v = vmap[nFaceVerts][o][j];
1249  tmpMap[per1[j]] = make_pair(
1250  per2[v], locVerts.count(per2[v]) > 0);
1251  }
1252 
1253  // Now loop over tmpMap to associate periodic vertices.
1254  for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1255  {
1256  PeriodicEntity ent2(mIt->second.first,
1258  mIt->second.second);
1259 
1260  // See if this vertex has been recorded already.
1261  PeriodicMap::iterator perIt = periodicVerts.find(
1262  mIt->first);
1263 
1264  if (perIt == periodicVerts.end())
1265  {
1266  // Vertex is new - just record this entity as
1267  // usual.
1268  periodicVerts[mIt->first].push_back(ent2);
1269  perIt = periodicVerts.find(mIt->first);
1270  }
1271  else
1272  {
1273  // Vertex is known - loop over the vertices
1274  // inside the record and potentially add vertex
1275  // mIt->second to the list.
1276  for (k = 0; k < perIt->second.size(); ++k)
1277  {
1278  if (perIt->second[k].id == mIt->second.first)
1279  {
1280  break;
1281  }
1282  }
1283 
1284  if (k == perIt->second.size())
1285  {
1286  perIt->second.push_back(ent2);
1287  }
1288  }
1289  }
1290  }
1291 
1292  // Determine periodic edges. Logic is the same as above,
1293  // and perhaps should be condensed to avoid replication.
1294  for (i = 0; i < 2; ++i)
1295  {
1296  int other = (i+1) % 2;
1297 
1298  if (tmpVec[0].size() == 3)
1299  {
1301  tmpVec[i], tmpVec[other]);
1302  }
1303  else
1304  {
1306  tmpVec[i], tmpVec[other]);
1307  }
1308 
1309  vector<int> per1 = edgeMap[ids[i]];
1310  vector<int> per2 = edgeMap[ids[other]];
1311 
1312  map<int, pair<int, bool> > tmpMap;
1313  map<int, pair<int, bool> >::iterator mIt;
1314 
1315  for (j = 0; j < nFaceVerts; ++j)
1316  {
1317  int e = emap[nFaceVerts][o][j];
1318  tmpMap[per1[j]] = make_pair(
1319  per2[e], locEdges.count(per2[e]) > 0);
1320  }
1321 
1322  for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1323  {
1324  // Note we assume orientation of edges is forwards -
1325  // this may be reversed later.
1326  PeriodicEntity ent2(mIt->second.first,
1328  mIt->second.second);
1329  PeriodicMap::iterator perIt = periodicEdges.find(
1330  mIt->first);
1331 
1332  if (perIt == periodicEdges.end())
1333  {
1334  periodicEdges[mIt->first].push_back(ent2);
1335  perIt = periodicEdges.find(mIt->first);
1336  }
1337  else
1338  {
1339  for (k = 0; k < perIt->second.size(); ++k)
1340  {
1341  if (perIt->second[k].id == mIt->second.first)
1342  {
1343  break;
1344  }
1345  }
1346 
1347  if (k == perIt->second.size())
1348  {
1349  perIt->second.push_back(ent2);
1350  }
1351  }
1352  }
1353  }
1354  }
1355  }
1356 
1357  Array<OneD, int> pairSizes(n, 0);
1358  pairSizes[p] = allCompPairs.size();
1359  vComm->AllReduce(pairSizes, LibUtilities::ReduceSum);
1360 
1361  int totPairSizes = Vmath::Vsum(n, pairSizes, 1);
1362 
1363  Array<OneD, int> pairOffsets(n, 0);
1364  pairOffsets[0] = 0;
1365 
1366  for (i = 1; i < n; ++i)
1367  {
1368  pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1369  }
1370 
1371  Array<OneD, int> first (totPairSizes, 0);
1372  Array<OneD, int> second(totPairSizes, 0);
1373 
1374  cnt = pairOffsets[p];
1375 
1376  for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1377  {
1378  first [cnt ] = pIt->first;
1379  second[cnt++] = pIt->second;
1380  }
1381 
1382  vComm->AllReduce(first, LibUtilities::ReduceSum);
1383  vComm->AllReduce(second, LibUtilities::ReduceSum);
1384 
1385  allCompPairs.clear();
1386 
1387  for(cnt = 0; cnt < totPairSizes; ++cnt)
1388  {
1389  allCompPairs[first[cnt]] = second[cnt];
1390  }
1391 
1392  // Search for periodic vertices and edges which are not
1393  // in a periodic composite but lie in this process. First,
1394  // loop over all information we have from other
1395  // processors.
1396  for (cnt = i = 0; i < totFaces; ++i)
1397  {
1398  int faceId = faceIds[i];
1399 
1400  ASSERTL0(allCompPairs.count(faceId) > 0,
1401  "Unable to find matching periodic face.");
1402 
1403  int perFaceId = allCompPairs[faceId];
1404 
1405  for (j = 0; j < faceVerts[i]; ++j, ++cnt)
1406  {
1407  int vId = vertIds[cnt];
1408 
1409  PeriodicMap::iterator perId = periodicVerts.find(vId);
1410 
1411  if (perId == periodicVerts.end())
1412  {
1413 
1414  // This vertex is not included in the map. Figure out which
1415  // vertex it is supposed to be periodic with. perFaceId is
1416  // the face ID which is periodic with faceId. The logic is
1417  // much the same as the loop above.
1419  = { coordMap[faceId], coordMap[perFaceId] };
1420 
1421  int nFaceVerts = tmpVec[0].size();
1422  StdRegions::Orientation o = nFaceVerts == 3 ?
1424  tmpVec[0], tmpVec[1]) :
1425  SpatialDomains::QuadGeom::GetFaceOrientation(
1426  tmpVec[0], tmpVec[1]);
1427 
1428  // Use vmap to determine which vertex of the other face
1429  // should be periodic with this one.
1430  int perVertexId = vertMap[perFaceId][vmap[nFaceVerts][o][j]];
1431 
1432 
1433  PeriodicEntity ent(perVertexId,
1435  locVerts.count(perVertexId) > 0);
1436 
1437  periodicVerts[vId].push_back(ent);
1438  }
1439 
1440  int eId = edgeIds[cnt];
1441 
1442  perId = periodicEdges.find(eId);
1443 
1444  if (perId == periodicEdges.end())
1445  {
1446  // This edge is not included in the map. Figure
1447  // out which edge it is supposed to be periodic
1448  // with. perFaceId is the face ID which is
1449  // periodic with faceId. The logic is much the
1450  // same as the loop above.
1452  = { coordMap[faceId], coordMap[perFaceId] };
1453 
1454  int nFaceEdges = tmpVec[0].size();
1455  StdRegions::Orientation o = nFaceEdges == 3 ?
1457  tmpVec[0], tmpVec[1]) :
1458  SpatialDomains::QuadGeom::GetFaceOrientation(
1459  tmpVec[0], tmpVec[1]);
1460 
1461  // Use emap to determine which edge of the other
1462  // face should be periodic with this one.
1463  int perEdgeId = edgeMap[perFaceId][emap[nFaceEdges][o][j]];
1464 
1465 
1466  PeriodicEntity ent(perEdgeId,
1468  locEdges.count(perEdgeId) > 0);
1469 
1470  periodicEdges[eId].push_back(ent);
1471  }
1472  }
1473  }
1474 
1475  // Finally, we must loop over the periodicVerts and periodicEdges
1476  // map to complete connectivity information.
1477  PeriodicMap::iterator perIt, perIt2;
1478  for (perIt = periodicVerts.begin();
1479  perIt != periodicVerts.end(); ++perIt)
1480  {
1481  // For each vertex that is periodic with this one...
1482  for (i = 0; i < perIt->second.size(); ++i)
1483  {
1484  // Find the vertex in the periodicVerts map...
1485  perIt2 = periodicVerts.find(perIt->second[i].id);
1486  ASSERTL0(perIt2 != periodicVerts.end(),
1487  "Couldn't find periodic vertex.");
1488 
1489  // Now search through this vertex's list and make sure that
1490  // we have a record of any vertices which aren't in the
1491  // original list.
1492  for (j = 0; j < perIt2->second.size(); ++j)
1493  {
1494  if (perIt2->second[j].id == perIt->first)
1495  {
1496  continue;
1497  }
1498 
1499  for (k = 0; k < perIt->second.size(); ++k)
1500  {
1501  if (perIt2->second[j].id == perIt->second[k].id)
1502  {
1503  break;
1504  }
1505  }
1506 
1507  if (k == perIt->second.size())
1508  {
1509  perIt->second.push_back(perIt2->second[j]);
1510  }
1511  }
1512  }
1513  }
1514 
1515  for (perIt = periodicEdges.begin();
1516  perIt != periodicEdges.end(); ++perIt)
1517  {
1518  for (i = 0; i < perIt->second.size(); ++i)
1519  {
1520  perIt2 = periodicEdges.find(perIt->second[i].id);
1521  ASSERTL0(perIt2 != periodicEdges.end(),
1522  "Couldn't find periodic edge.");
1523 
1524  for (j = 0; j < perIt2->second.size(); ++j)
1525  {
1526  if (perIt2->second[j].id == perIt->first)
1527  {
1528  continue;
1529  }
1530 
1531  for (k = 0; k < perIt->second.size(); ++k)
1532  {
1533  if (perIt2->second[j].id == perIt->second[k].id)
1534  {
1535  break;
1536  }
1537  }
1538 
1539  if (k == perIt->second.size())
1540  {
1541  perIt->second.push_back(perIt2->second[j]);
1542  }
1543  }
1544  }
1545  }
1546 
1547  // Loop over periodic edges to determine relative edge orientations.
1548  for (perIt = periodicEdges.begin();
1549  perIt != periodicEdges.end(); perIt++)
1550  {
1551  // Find edge coordinates
1552  map<int, pair<int, int> >::iterator eIt
1553  = eIdMap.find(perIt->first);
1554  SpatialDomains::PointGeom v[2] = {
1555  *vCoMap[eIt->second.first],
1556  *vCoMap[eIt->second.second]
1557  };
1558 
1559  // Loop over each edge, and construct a vector that takes us
1560  // from one vertex to another. Use this to figure out which
1561  // vertex maps to which.
1562  for (i = 0; i < perIt->second.size(); ++i)
1563  {
1564  eIt = eIdMap.find(perIt->second[i].id);
1565 
1566  SpatialDomains::PointGeom w[2] = {
1567  *vCoMap[eIt->second.first],
1568  *vCoMap[eIt->second.second]
1569  };
1570 
1571  NekDouble cx = 0.5*(w[0](0)-v[0](0)+w[1](0)-v[1](0));
1572  NekDouble cy = 0.5*(w[0](1)-v[0](1)+w[1](1)-v[1](1));
1573  NekDouble cz = 0.5*(w[0](2)-v[0](2)+w[1](2)-v[1](2));
1574 
1575  int vMap[2] = {-1,-1};
1576  for (j = 0; j < 2; ++j)
1577  {
1578  NekDouble x = v[j](0);
1579  NekDouble y = v[j](1);
1580  NekDouble z = v[j](2);
1581  for (k = 0; k < 2; ++k)
1582  {
1583  NekDouble x1 = w[k](0)-cx;
1584  NekDouble y1 = w[k](1)-cy;
1585  NekDouble z1 = w[k](2)-cz;
1586 
1587  if (sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)+(z1-z)*(z1-z))
1588  < 1e-8)
1589  {
1590  vMap[k] = j;
1591  break;
1592  }
1593  }
1594  }
1595 
1596  // Sanity check the map.
1597  ASSERTL0(vMap[0] >= 0 && vMap[1] >= 0,
1598  "Unable to align periodic vertices.");
1599  ASSERTL0((vMap[0] == 0 || vMap[0] == 1) &&
1600  (vMap[1] == 0 || vMap[1] == 1) &&
1601  (vMap[0] != vMap[1]),
1602  "Unable to align periodic vertices.");
1603 
1604  // If 0 -> 0 then edges are aligned already; otherwise
1605  // reverse the orientation.
1606  if (vMap[0] != 0)
1607  {
1608  perIt->second[i].orient = StdRegions::eBackwards;
1609  }
1610  }
1611  }
1612 
1613  // Do one final loop over periodic vertices/edges to remove
1614  // non-local vertices/edges from map.
1615  for (perIt = periodicVerts.begin();
1616  perIt != periodicVerts.end(); ++perIt)
1617  {
1618  if (locVerts.count(perIt->first) > 0)
1619  {
1620  m_periodicVerts.insert(*perIt);
1621  }
1622  }
1623 
1624  for (perIt = periodicEdges.begin();
1625  perIt != periodicEdges.end(); ++perIt)
1626  {
1627  if (locEdges.count(perIt->first) > 0)
1628  {
1629  m_periodicEdges.insert(*perIt);
1630  }
1631  }
1632  }
boost::shared_ptr< MeshGraph3D > MeshGraph3DSharedPtr
Definition: MeshGraph3D.h:224
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::vector< PointGeomSharedPtr > PointGeomVector
Definition: Geometry3D.h:61
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
std::map< int, std::vector< unsigned int > > BndRegionOrdering
Definition: MeshPartition.h:54
std::map< int, std::vector< unsigned int > > CompositeOrdering
Definition: MeshPartition.h:53
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
static StdRegions::Orientation GetFaceOrientation(const QuadGeom &face1, const QuadGeom &face2)
Get the orientation of face1.
Definition: QuadGeom.cpp:254
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
Definition: Conditions.h:217
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
Definition: ExpList.h:972
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: ExpList.h:969
double NekDouble
std::map< int, BoundaryConditionMapShPtr > BoundaryConditionCollection
Definition: Conditions.h:226
boost::shared_ptr< GeometryVector > Composite
Definition: MeshGraph.h:114
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
std::map< int, Composite > CompositeMap
Definition: MeshGraph.h:115
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry2D.h:59
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
static SpatialDomains::BoundaryConditionShPtr GetBoundaryCondition(const SpatialDomains::BoundaryConditionCollection &collection, unsigned int index, const std::string &variable)
Definition: ExpList.cpp:3037
static StdRegions::Orientation GetFaceOrientation(const TriGeom &face1, const TriGeom &face2)
Definition: TriGeom.cpp:237
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:219
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
Definition: Vmath.cpp:737
struct Nektar::MultiRegions::_PeriodicEntity PeriodicEntity
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
void Nektar::MultiRegions::DisContField3D::GenerateBoundaryConditionExpansion ( const SpatialDomains::MeshGraphSharedPtr graph3D,
const SpatialDomains::BoundaryConditions bcs,
const std::string &  variable 
)
protected

According to their boundary region, the separate segmental boundary expansions are bundled together in an object of the class MultiRegions::ExpList2D.

Parameters
graph3DA mesh, containing information about the domain and the spectral/hp element expansion.
bcsAn entity containing information about the boundaries and boundary conditions.
variableAn optional parameter to indicate for which variable the boundary conditions should be discretised.

Definition at line 608 of file DisContField3D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::eDirichlet, Nektar::SpatialDomains::ePeriodic, Nektar::MultiRegions::ExpList::GetBoundaryCondition(), Nektar::SpatialDomains::BoundaryConditions::GetBoundaryConditions(), Nektar::SpatialDomains::BoundaryConditions::GetBoundaryRegions(), m_bndCondExpansions, m_bndConditions, Nektar::MultiRegions::ExpList::m_session, and Nektar::MultiRegions::ExpList::SetUpPhysNormals().

Referenced by DisContField3D().

612  {
613  int cnt = 0;
616 
618  bcs.GetBoundaryRegions();
619  const SpatialDomains::BoundaryConditionCollection &bconditions =
620  bcs.GetBoundaryConditions();
621  SpatialDomains::BoundaryRegionCollection::const_iterator it;
622 
623  // count the number of non-periodic boundary regions
624  for (it = bregions.begin(); it != bregions.end(); ++it)
625  {
626  SpatialDomains::BoundaryConditionShPtr boundaryCondition =
627  GetBoundaryCondition(bconditions, it->first, variable);
628  if (boundaryCondition->GetBoundaryConditionType() !=
630  {
631  cnt++;
632  }
633  }
634 
635  m_bndCondExpansions = Array<OneD,MultiRegions::ExpListSharedPtr>(cnt);
636  m_bndConditions = Array<OneD,SpatialDomains::BoundaryConditionShPtr>(cnt);
637 
638  cnt = 0;
639 
640  // list Dirichlet boundaries first
641  for (it = bregions.begin(); it != bregions.end(); ++it)
642  {
643  locBCond = GetBoundaryCondition(
644  bconditions, it->first, variable);
645 
646  if(locBCond->GetBoundaryConditionType()
648  {
650  ::AllocateSharedPtr(m_session, *(it->second),
651  graph3D, variable);
652 
653  // Set up normals on non-Dirichlet boundary conditions
654  if(locBCond->GetBoundaryConditionType() !=
656  {
658  }
659 
660  m_bndCondExpansions[cnt] = locExpList;
661  m_bndConditions[cnt++] = locBCond;
662  }
663  }
664  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
Definition: Conditions.h:217
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: ExpList.h:969
std::map< int, BoundaryConditionMapShPtr > BoundaryConditionCollection
Definition: Conditions.h:226
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Definition: ExpList2D.h:49
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
static SpatialDomains::BoundaryConditionShPtr GetBoundaryCondition(const SpatialDomains::BoundaryConditionCollection &collection, unsigned int index, const std::string &variable)
Definition: ExpList.cpp:3037
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:219
GlobalLinSysSharedPtr Nektar::MultiRegions::DisContField3D::GetGlobalBndLinSys ( const GlobalLinSysKey mkey)

Definition at line 278 of file DisContField3D.cpp.

References ASSERTL0, ASSERTL1, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::MultiRegions::ExpList::GenGlobalBndLinSys(), Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::iterator, m_globalBndMat, and m_traceMap.

Referenced by v_HelmSolve().

280  {
281  ASSERTL0(mkey.GetMatrixType() == StdRegions::eHybridDGHelmBndLam,
282  "Routine currently only tested for HybridDGHelmholtz");
283  ASSERTL1(mkey.GetGlobalSysSolnType() ==
284  m_traceMap->GetGlobalSysSolnType(),
285  "The local to global map is not set up for the requested "
286  "solution type");
287 
288  GlobalLinSysSharedPtr glo_matrix;
289  GlobalLinSysMap::iterator matrixIter = m_globalBndMat->find(mkey);
290 
291  if (matrixIter == m_globalBndMat->end())
292  {
293  glo_matrix = GenGlobalBndLinSys(mkey, m_traceMap);
294  (*m_globalBndMat)[mkey] = glo_matrix;
295  }
296  else
297  {
298  glo_matrix = matrixIter->second;
299  }
300 
301  return glo_matrix;
302  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
boost::shared_ptr< GlobalLinSys > GenGlobalBndLinSys(const GlobalLinSysKey &mkey, const AssemblyMapSharedPtr &locToGloMap)
Generate a GlobalLinSys from information provided by the key "mkey" and the mapping provided in LocTo...
Definition: ExpList.cpp:1270
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:52
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
bool Nektar::MultiRegions::DisContField3D::GetLeftAdjacentFaces ( int  cnt)
inline

Definition at line 86 of file DisContField3D.h.

References m_leftAdjacentFaces.

87  {
88  return m_leftAdjacentFaces[cnt];
89  }
bool Nektar::MultiRegions::DisContField3D::IsLeftAdjacentFace ( const int  n,
const int  e 
)
protected

Definition at line 1634 of file DisContField3D.cpp.

References ASSERTL2, Nektar::iterator, m_boundaryFaces, Nektar::MultiRegions::ExpList::m_exp, m_periodicFaces, m_trace, and m_traceMap.

Referenced by SetUpDG().

1635  {
1636  set<int>::iterator it;
1638  m_traceMap->GetElmtToTrace()[n][e]->
1639  as<LocalRegions::Expansion2D>();
1640 
1641  int offset = m_trace->GetPhys_Offset(traceEl->GetElmtId());
1642 
1643  bool fwd = true;
1644  if (traceEl->GetLeftAdjacentElementFace () == -1 ||
1645  traceEl->GetRightAdjacentElementFace() == -1)
1646  {
1647  // Boundary edge (1 connected element). Do nothing in
1648  // serial.
1649  it = m_boundaryFaces.find(traceEl->GetElmtId());
1650 
1651  // If the edge does not have a boundary condition set on
1652  // it, then assume it is a partition edge.
1653  if (it == m_boundaryFaces.end())
1654  {
1655  int traceGeomId = traceEl->GetGeom2D()->GetGlobalID();
1657  traceGeomId);
1658 
1659  if (pIt != m_periodicFaces.end() && !pIt->second[0].isLocal)
1660  {
1661  fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1662  }
1663  else
1664  {
1665  fwd = m_traceMap->
1666  GetTraceToUniversalMapUnique(offset) >= 0;
1667  }
1668  }
1669  }
1670  else if (traceEl->GetLeftAdjacentElementFace () != -1 &&
1671  traceEl->GetRightAdjacentElementFace() != -1)
1672  {
1673  // Non-boundary edge (2 connected elements).
1674  fwd = dynamic_cast<Nektar::StdRegions::StdExpansion*>
1675  (traceEl->GetLeftAdjacentElementExp().get()) ==
1676  (*m_exp)[n].get();
1677  }
1678  else
1679  {
1680  ASSERTL2(false, "Unconnected trace element!");
1681  }
1682 
1683  return fwd;
1684  }
std::set< int > m_boundaryFaces
A set storing the global IDs of any boundary faces.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
The base class for all shapes.
Definition: StdExpansion.h:69
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
Definition: ExpList.h:1036
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
bool Nektar::MultiRegions::DisContField3D::SameTypeOfBoundaryConditions ( const DisContField3D In)
protected

For each boundary region, checks that the types and number of boundary expansions in that region match.

Parameters
InContField3D to compare with.
Returns
true if boundary conditions match.

Definition at line 566 of file DisContField3D.cpp.

References Nektar::MultiRegions::ExpList::GetExpSize(), m_bndCondExpansions, m_bndConditions, Nektar::MultiRegions::ExpList::m_comm, and Nektar::LibUtilities::ReduceMin.

Referenced by Nektar::MultiRegions::ContField3D::ContField3D(), and DisContField3D().

568  {
569  int i;
570  bool returnval = true;
571 
572  for(i = 0; i < m_bndConditions.num_elements(); ++i)
573  {
574 
575  // check to see if boundary condition type is the same
576  // and there are the same number of boundary
577  // conditions in the boundary definition.
578  if((m_bndConditions[i]->GetBoundaryConditionType()
579  != In.m_bndConditions[i]->GetBoundaryConditionType())||
581  != In.m_bndCondExpansions[i]->GetExpSize()))
582  {
583  returnval = false;
584  break;
585  }
586  }
587 
588  // Compare with all other processes. Return true only if all
589  // processes report having the same boundary conditions.
590  int vSame = returnval ? 1 : 0;
591  m_comm->AllReduce(vSame, LibUtilities::ReduceMin);
592 
593  return (vSame == 1);
594  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
int GetExpSize(void)
This function returns the number of elements in the expansion.
Definition: ExpList.h:2054
LibUtilities::CommSharedPtr m_comm
Communicator.
Definition: ExpList.h:966
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
void Nektar::MultiRegions::DisContField3D::SetUpDG ( const std::string  variable = "DefaultVar")
protected

Set up all DG member variables and maps.

Definition at line 307 of file DisContField3D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL1, Nektar::StdRegions::eDir1BwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1BwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1BwdDir2_Dir2FwdDir1, Nektar::StdRegions::eDir1FwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1FwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, Nektar::SpatialDomains::ePeriodic, Nektar::LocalRegions::Expansion3D::GetGeom3D(), Nektar::MultiRegions::_PeriodicEntity::id, IsLeftAdjacentFace(), Nektar::MultiRegions::_PeriodicEntity::isLocal, Nektar::iterator, m_bndCondExpansions, m_bndConditions, m_boundaryFaces, Nektar::MultiRegions::ExpList::m_exp, m_globalBndMat, Nektar::MultiRegions::ExpList::m_graph, m_leftAdjacentFaces, m_locTraceToTraceMap, m_periodicBwdCopy, m_periodicFaces, m_periodicFwdCopy, Nektar::MultiRegions::ExpList::m_session, m_trace, m_traceMap, Nektar::MultiRegions::NullExpListSharedPtr, Nektar::MultiRegions::_PeriodicEntity::orient, Nektar::LocalRegions::Expansion2D::SetAdjacentElementExp(), and Nektar::MultiRegions::ExpList::SetUpPhysNormals().

Referenced by DisContField3D(), and v_GetTrace().

308  {
310  {
311  return;
312  }
313 
314  ExpList2DSharedPtr trace;
315 
317  boost::dynamic_pointer_cast<SpatialDomains::MeshGraph3D>(
318  m_graph);
319 
320  // Set up matrix map
323 
324  // Set up Trace space
325  bool UseGenSegExp = true;
328  *m_exp,graph3D, m_periodicFaces, UseGenSegExp);
329 
330  m_trace = trace;
331 
333  m_session,graph3D,trace,*this,m_bndCondExpansions,
334  m_bndConditions, m_periodicFaces,variable);
335 
336  if (m_session->DefinesCmdLineArgument("verbose"))
337  {
338  m_traceMap->PrintStats(std::cout, variable);
339  }
340 
341  Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >
342  &elmtToTrace = m_traceMap->GetElmtToTrace();
343 
344  // Scatter trace segments to 3D elements. For each element, we
345  // find the trace segment associated to each edge. The element
346  // then retains a pointer to the trace space segments, to ensure
347  // uniqueness of normals when retrieving from two adjoining
348  // elements which do not lie in a plane.
349  for (int i = 0; i < m_exp->size(); ++i)
350  {
351  for (int j = 0; j < (*m_exp)[i]->GetNfaces(); ++j)
352  {
354  (*m_exp)[i]->as<LocalRegions::Expansion3D>();
356  elmtToTrace[i][j]->as<LocalRegions::Expansion2D>();
357  exp3d->SetFaceExp (j, exp2d);
358  exp2d->SetAdjacentElementExp(j, exp3d);
359  }
360  }
361 
362  // Set up physical normals
364 
365  // Set up information for parallel jobs.
366  for (int i = 0; i < m_trace->GetExpSize(); ++i)
367  {
369  m_trace->GetExp(i)->as<LocalRegions::Expansion2D>();
370 
371  int offset = m_trace->GetPhys_Offset(i);
372  int traceGeomId = traceEl->GetGeom2D()->GetGlobalID();
374  traceGeomId);
375 
376  if (pIt != m_periodicFaces.end() && !pIt->second[0].isLocal)
377  {
378  if (traceGeomId != min(pIt->second[0].id, traceGeomId))
379  {
380  traceEl->GetLeftAdjacentElementExp()->NegateFaceNormal(
381  traceEl->GetLeftAdjacentElementFace());
382  }
383  }
384  else if (m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
385  {
386  traceEl->GetLeftAdjacentElementExp()->NegateFaceNormal(
387  traceEl->GetLeftAdjacentElementFace());
388  }
389  }
390 
391  int cnt, n, e;
392 
393  // Identify boundary faces
394  for(cnt = 0, n = 0; n < m_bndCondExpansions.num_elements(); ++n)
395  {
396  if (m_bndConditions[n]->GetBoundaryConditionType() !=
398  {
399  for(e = 0; e < m_bndCondExpansions[n]->GetExpSize(); ++e)
400  {
401  m_boundaryFaces.insert(
402  m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
403  }
404  }
405  cnt += m_bndCondExpansions[n]->GetExpSize();
406  }
407 
408  // Set up information for periodic boundary conditions.
409  boost::unordered_map<int,pair<int,int> > perFaceToExpMap;
410  boost::unordered_map<int,pair<int,int> >::iterator it2;
411  cnt = 0;
413  for (int n = 0; n < m_exp->size(); ++n)
414  {
415  exp3d = (*m_exp)[n]->as<LocalRegions::Expansion3D>();
416  for (int e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
417  {
419  exp3d->GetGeom3D()->GetFid(e));
420 
421  if (it != m_periodicFaces.end())
422  {
423  perFaceToExpMap[it->first] = make_pair(n, e);
424  }
425  }
426  }
427 
428  // Set up left-adjacent face list.
429  m_leftAdjacentFaces.resize(cnt);
430  cnt = 0;
431  for (int i = 0; i < m_exp->size(); ++i)
432  {
433  for (int j = 0; j < (*m_exp)[i]->GetNfaces(); ++j, ++cnt)
434  {
436  }
437  }
438 
439  // Set up mapping to copy Fwd of periodic bcs to Bwd of other edge.
440  cnt = 0;
441  for (int n = 0; n < m_exp->size(); ++n)
442  {
443  exp3d = (*m_exp)[n]->as<LocalRegions::Expansion3D>();
444  for (int e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
445  {
446  int faceGeomId = exp3d->GetGeom3D()->GetFid(e);
447  int offset = m_trace->GetPhys_Offset(
448  elmtToTrace[n][e]->GetElmtId());
449 
450  // Check to see if this face is periodic.
451  PeriodicMap::iterator it = m_periodicFaces.find(faceGeomId);
452 
453  if (it != m_periodicFaces.end())
454  {
455  const PeriodicEntity &ent = it->second[0];
456  it2 = perFaceToExpMap.find(ent.id);
457 
458  if (it2 == perFaceToExpMap.end())
459  {
460  if (m_session->GetComm()->GetSize() > 1 &&
461  !ent.isLocal)
462  {
463  continue;
464  }
465  else
466  {
467  ASSERTL1(false, "Periodic edge not found!");
468  }
469  }
470 
472  "Periodic face in non-forward space?");
473 
474  int offset2 = m_trace->GetPhys_Offset(
475  elmtToTrace[it2->second.first][it2->second.second]->
476  GetElmtId());
477 
478  // Calculate relative orientations between faces to
479  // calculate copying map.
480  int nquad1 = elmtToTrace[n][e]->GetNumPoints(0);
481  int nquad2 = elmtToTrace[n][e]->GetNumPoints(1);
482 
483  vector<int> tmpBwd(nquad1*nquad2);
484  vector<int> tmpFwd(nquad1*nquad2);
485 
486  if (ent.orient == StdRegions::eDir1FwdDir2_Dir2FwdDir1 ||
487  ent.orient == StdRegions::eDir1BwdDir2_Dir2FwdDir1 ||
488  ent.orient == StdRegions::eDir1FwdDir2_Dir2BwdDir1 ||
490  {
491  for (int i = 0; i < nquad2; ++i)
492  {
493  for (int j = 0; j < nquad1; ++j)
494  {
495  tmpBwd[i*nquad1+j] = offset2 + i*nquad1+j;
496  tmpFwd[i*nquad1+j] = offset + j*nquad2+i;
497  }
498  }
499  }
500  else
501  {
502  for (int i = 0; i < nquad2; ++i)
503  {
504  for (int j = 0; j < nquad1; ++j)
505  {
506  tmpBwd[i*nquad1+j] = offset2 + i*nquad1+j;
507  tmpFwd[i*nquad1+j] = offset + i*nquad1+j;
508  }
509  }
510  }
511 
512  if (ent.orient == StdRegions::eDir1BwdDir1_Dir2FwdDir2 ||
513  ent.orient == StdRegions::eDir1BwdDir1_Dir2BwdDir2 ||
514  ent.orient == StdRegions::eDir1FwdDir2_Dir2BwdDir1 ||
516  {
517  // Reverse x direction
518  for (int i = 0; i < nquad2; ++i)
519  {
520  for (int j = 0; j < nquad1/2; ++j)
521  {
522  swap(tmpFwd[i*nquad1 + j],
523  tmpFwd[i*nquad1 + nquad1-j-1]);
524  }
525  }
526  }
527 
528  if (ent.orient == StdRegions::eDir1FwdDir1_Dir2BwdDir2 ||
529  ent.orient == StdRegions::eDir1BwdDir1_Dir2BwdDir2 ||
530  ent.orient == StdRegions::eDir1BwdDir2_Dir2FwdDir1 ||
532  {
533  // Reverse y direction
534  for (int j = 0; j < nquad1; ++j)
535  {
536  for (int i = 0; i < nquad2/2; ++i)
537  {
538  swap(tmpFwd[i*nquad1 + j],
539  tmpFwd[(nquad2-i-1)*nquad1 + j]);
540  }
541  }
542  }
543 
544  for (int i = 0; i < nquad1*nquad2; ++i)
545  {
546  m_periodicFwdCopy.push_back(tmpFwd[i]);
547  m_periodicBwdCopy.push_back(tmpBwd[i]);
548  }
549  }
550  }
551  }
552 
554  AllocateSharedPtr(*this, m_trace, elmtToTrace,
556 
557  }
boost::shared_ptr< MeshGraph3D > MeshGraph3DSharedPtr
Definition: MeshGraph3D.h:224
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1485
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
bool IsLeftAdjacentFace(const int n, const int e)
std::set< int > m_boundaryFaces
A set storing the global IDs of any boundary faces.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
Definition: ExpList.h:1036
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
Definition: ExpList.h:972
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: ExpList.h:969
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Definition: ExpList2D.h:49
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
struct Nektar::MultiRegions::_PeriodicEntity PeriodicEntity
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
void Nektar::MultiRegions::DisContField3D::v_AddFwdBwdTraceIntegral ( const Array< OneD, const NekDouble > &  Fwd,
const Array< OneD, const NekDouble > &  Bwd,
Array< OneD, NekDouble > &  outarray 
)
protectedvirtual

Add trace contributions into elemental coefficient spaces.

Given some quantity $ \vec{Fn} $, which conatins this routine calculates the integral

\[ \int_{\Omega^e} \vec{Fn}, \mathrm{d}S \]

and adds this to the coefficient space provided by outarray. The value of q is determined from the routine IsLeftAdjacentFace() which if true we use Fwd else we use Bwd

See also
Expansion3D::AddFaceNormBoundaryInt
Parameters
FwdThe trace quantities associated with left (fwd) adjancent elmt.
BwdThe trace quantities associated with right (bwd) adjacent elet.
outarrayResulting 3D coefficient space.

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1883 of file DisContField3D.cpp.

References m_locTraceToTraceMap, and m_trace.

1887  {
1888  Array<OneD, NekDouble> Coeffs(m_trace->GetNcoeffs());
1889 
1890  m_trace->IProductWRTBase(Fwd,Coeffs);
1891  m_locTraceToTraceMap->AddTraceCoeffsToFieldCoeffs(0,Coeffs,outarray);
1892  m_trace->IProductWRTBase(Bwd,Coeffs);
1893  m_locTraceToTraceMap->AddTraceCoeffsToFieldCoeffs(1,Coeffs,outarray);
1894  }
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
void Nektar::MultiRegions::DisContField3D::v_AddTraceIntegral ( const Array< OneD, const NekDouble > &  Fn,
Array< OneD, NekDouble > &  outarray 
)
protectedvirtual

Add trace contributions into elemental coefficient spaces.

Given some quantity $ \vec{Fn} $, which conatins this routine calculates the integral

\[ \int_{\Omega^e} \vec{Fn}, \mathrm{d}S \]

and adds this to the coefficient space provided by outarray.

See also
Expansion3D::AddFaceNormBoundaryInt
Parameters
FnThe trace quantities.
outarrayResulting 3D coefficient space.

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1849 of file DisContField3D.cpp.

References m_locTraceToTraceMap, and m_trace.

1852  {
1853 
1854  Array<OneD, NekDouble> Fcoeffs(m_trace->GetNcoeffs());
1855  m_trace->IProductWRTBase(Fn, Fcoeffs);
1856 
1857  m_locTraceToTraceMap->AddTraceCoeffsToFieldCoeffs(Fcoeffs,
1858  outarray);
1859  }
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
void Nektar::MultiRegions::DisContField3D::v_EvaluateBoundaryConditions ( const NekDouble  time = 0.0,
const std::string  varName = "",
const NekDouble  x2_in = NekConstants::kNekUnsetDouble,
const NekDouble  x3_in = NekConstants::kNekUnsetDouble 
)
protectedvirtual

This function evaluates the boundary conditions at a certain time-level.

Based on the boundary condition $g(\boldsymbol{x},t)$ evaluated at a given time-level t, this function transforms the boundary conditions onto the coefficients of the (one-dimensional) boundary expansion. Depending on the type of boundary conditions, these expansion coefficients are calculated in different ways:

  • Dirichlet boundary conditions
    In order to ensure global $C^0$ continuity of the spectral/hp approximation, the Dirichlet boundary conditions are projected onto the boundary expansion by means of a modified $C^0$ continuous Galerkin projection. This projection can be viewed as a collocation projection at the vertices, followed by an $L^2$ projection on the interior modes of the edges. The resulting coefficients $\boldsymbol{\hat{u}}^{\mathcal{D}}$ will be stored for the boundary expansion.
  • Neumann boundary conditions In the discrete Galerkin formulation of the problem to be solved, the Neumann boundary conditions appear as the set of surface integrals:

    \[\boldsymbol{\hat{g}}=\int_{\Gamma} \phi^e_n(\boldsymbol{x})g(\boldsymbol{x})d(\boldsymbol{x})\quad \forall n \]

    As a result, it are the coefficients $\boldsymbol{\hat{g}}$ that will be stored in the boundary expansion
Parameters
timeThe time at which the boundary conditions should be evaluated.
bndCondExpansionsList of boundary conditions.
bndConditionsInformation about the boundary conditions.

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 2447 of file DisContField3D.cpp.

References ASSERTL0, Nektar::SpatialDomains::eDirichlet, Nektar::SpatialDomains::eNeumann, Nektar::SpatialDomains::eRobin, Nektar::LibUtilities::Equation::Evaluate(), Nektar::MultiRegions::ExpList::ExtractFileBCs(), m_bndCondExpansions, m_bndConditions, Nektar::SpatialDomains::DirichletBoundaryCondition::m_filename, Nektar::SpatialDomains::NeumannBoundaryCondition::m_filename, Nektar::SpatialDomains::RobinBoundaryCondition::m_filename, and Vmath::Vmul().

2452  {
2453  int i;
2454  int npoints;
2455  int nbnd = m_bndCondExpansions.num_elements();
2456  MultiRegions::ExpListSharedPtr locExpList;
2457 
2458  for (i = 0; i < nbnd; ++i)
2459  {
2460  if (time == 0.0 || m_bndConditions[i]->IsTimeDependent())
2461  {
2462  locExpList = m_bndCondExpansions[i];
2463  npoints = locExpList->GetNpoints();
2464 
2465  Array<OneD, NekDouble> x0(npoints, 0.0);
2466  Array<OneD, NekDouble> x1(npoints, 0.0);
2467  Array<OneD, NekDouble> x2(npoints, 0.0);
2468  Array<OneD, NekDouble> valuesFile(npoints, 1.0), valuesExp(npoints, 1.0);
2469 
2470  locExpList->GetCoords(x0, x1, x2);
2471 
2472  if (m_bndConditions[i]->GetBoundaryConditionType()
2474  {
2475  SpatialDomains::DirichletBCShPtr bcPtr = boost::static_pointer_cast<
2476  SpatialDomains::DirichletBoundaryCondition>(
2477  m_bndConditions[i]);
2478  string filebcs = bcPtr->m_filename;
2479  string exprbcs = bcPtr->m_expr;
2480 
2481  if (filebcs != "")
2482  {
2483  ExtractFileBCs(filebcs, bcPtr->m_comm, varName, locExpList);
2484  valuesFile = locExpList->GetPhys();
2485  }
2486 
2487  if (exprbcs != "")
2488  {
2489  LibUtilities::Equation condition = boost::static_pointer_cast<SpatialDomains::
2490  DirichletBoundaryCondition >(
2491  m_bndConditions[i])->m_dirichletCondition;
2492 
2493  condition.Evaluate(x0, x1, x2, time, valuesExp);
2494  }
2495 
2496  Vmath::Vmul(npoints, valuesExp, 1, valuesFile, 1, locExpList->UpdatePhys(), 1);
2497 
2498  locExpList->FwdTrans_BndConstrained(
2499  locExpList->GetPhys(),
2500  locExpList->UpdateCoeffs());
2501  }
2502  else if (m_bndConditions[i]->GetBoundaryConditionType()
2504  {
2505  SpatialDomains::NeumannBCShPtr bcPtr = boost::static_pointer_cast<
2506  SpatialDomains::NeumannBoundaryCondition>(
2507  m_bndConditions[i]);
2508  string filebcs = bcPtr->m_filename;
2509 
2510  if (filebcs != "")
2511  {
2512  ExtractFileBCs(filebcs, bcPtr->m_comm, varName, locExpList);
2513  }
2514  else
2515  {
2516 
2517  LibUtilities::Equation condition = boost::
2518  static_pointer_cast<SpatialDomains::
2519  NeumannBoundaryCondition>(
2520  m_bndConditions[i])->m_neumannCondition;
2521 
2522  condition.Evaluate(x0, x1, x2, time,
2523  locExpList->UpdatePhys());
2524 
2525  locExpList->IProductWRTBase(locExpList->GetPhys(),
2526  locExpList->UpdateCoeffs());
2527  }
2528  }
2529  else if (m_bndConditions[i]->GetBoundaryConditionType()
2531  {
2532  SpatialDomains::RobinBCShPtr bcPtr = boost::static_pointer_cast<
2533  SpatialDomains::RobinBoundaryCondition>(
2534  m_bndConditions[i]);
2535  string filebcs = bcPtr->m_filename;
2536 
2537  if (filebcs != "")
2538  {
2539  ExtractFileBCs(filebcs, bcPtr->m_comm, varName, locExpList);
2540  }
2541  else
2542  {
2543  LibUtilities::Equation condition = boost::
2544  static_pointer_cast<SpatialDomains::
2545  RobinBoundaryCondition>(
2546  m_bndConditions[i])->m_robinFunction;
2547 
2548  condition.Evaluate(x0, x1, x2, time,
2549  locExpList->UpdatePhys());
2550 
2551  }
2552 
2553  locExpList->IProductWRTBase(locExpList->GetPhys(),
2554  locExpList->UpdateCoeffs());
2555 
2556  }
2557  else
2558  {
2559  ASSERTL0(false, "This type of BC not implemented yet");
2560  }
2561  }
2562  }
2563  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
void ExtractFileBCs(const std::string &fileName, LibUtilities::CommSharedPtr comm, const std::string &varName, const boost::shared_ptr< ExpList > locExpList)
Definition: ExpList.cpp:1987
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
boost::shared_ptr< NeumannBoundaryCondition > NeumannBCShPtr
Definition: Conditions.h:221
boost::shared_ptr< DirichletBoundaryCondition > DirichletBCShPtr
Definition: Conditions.h:220
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
boost::shared_ptr< RobinBoundaryCondition > RobinBCShPtr
Definition: Conditions.h:222
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:183
void Nektar::MultiRegions::DisContField3D::v_ExtractTracePhys ( Array< OneD, NekDouble > &  outarray)
protectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1805 of file DisContField3D.cpp.

References ASSERTL1, Nektar::MultiRegions::ExpList::m_phys, and Nektar::MultiRegions::ExpList::m_physState.

1807  {
1808  ASSERTL1(m_physState == true,
1809  "Field is not in physical space.");
1810 
1811  v_ExtractTracePhys(m_phys, outarray);
1812  }
virtual void v_ExtractTracePhys(Array< OneD, NekDouble > &outarray)
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
Definition: ExpList.h:1015
bool m_physState
The state of the array m_phys.
Definition: ExpList.h:1024
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Nektar::MultiRegions::DisContField3D::v_ExtractTracePhys ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray 
)
protectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1814 of file DisContField3D.cpp.

References m_locTraceToTraceMap, m_traceMap, and Vmath::Zero().

1817  {
1818 
1819  Vmath::Zero(outarray.num_elements(), outarray, 1);
1820 
1821  Array<OneD, NekDouble> facevals(m_locTraceToTraceMap->GetNFwdLocTracePts());
1822  m_locTraceToTraceMap->FwdLocTracesFromField(inarray,facevals);
1823  m_locTraceToTraceMap->InterpLocFacesToTrace(0,facevals,outarray);
1824 
1825  // gather entries along parallel partitions which have
1826  // only filled in Fwd part on their own partition
1827  m_traceMap->UniversalTraceAssemble(outarray);
1828 
1829  }
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
void Nektar::MultiRegions::DisContField3D::v_GeneralMatrixOp ( const GlobalMatrixKey gkey,
const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
CoeffState  coeffstate = eLocal 
)
protectedvirtual

Calculates the result of the multiplication of a global matrix of type specified by mkey with a vector given by inarray.

Parameters
mkeyKey representing desired matrix multiplication.
inarrayInput vector.
outarrayResulting multiplication.

Reimplemented from Nektar::MultiRegions::ExpList.

Reimplemented in Nektar::MultiRegions::ContField3D.

Definition at line 2163 of file DisContField3D.cpp.

References Nektar::eWrapper, Nektar::MultiRegions::ExpList::GetBlockMatrix(), and m_traceMap.

2168  {
2169  int LocBndCoeffs = m_traceMap->GetNumLocalBndCoeffs();
2170  Array<OneD, NekDouble> loc_lambda(LocBndCoeffs);
2171  DNekVec LocLambda(LocBndCoeffs,loc_lambda,eWrapper);
2172  const DNekScalBlkMatSharedPtr& HDGHelm = GetBlockMatrix(gkey);
2173 
2174  m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
2175  LocLambda = (*HDGHelm) * LocLambda;
2176  m_traceMap->AssembleBnd(loc_lambda,outarray);
2177  }
const DNekScalBlkMatSharedPtr & GetBlockMatrix(const GlobalMatrixKey &gkey)
Definition: ExpList.cpp:890
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:74
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:49
virtual const Array<OneD,const MultiRegions::ExpListSharedPtr>& Nektar::MultiRegions::DisContField3D::v_GetBndCondExpansions ( void  )
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 238 of file DisContField3D.h.

References m_bndCondExpansions.

239  {
240  return m_bndCondExpansions;
241  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
virtual const Array<OneD,const SpatialDomains::BoundaryConditionShPtr>& Nektar::MultiRegions::DisContField3D::v_GetBndConditions ( void  )
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 245 of file DisContField3D.h.

References m_bndConditions.

246  {
247  return m_bndConditions;
248  }
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
void Nektar::MultiRegions::DisContField3D::v_GetBndElmtExpansion ( int  i,
boost::shared_ptr< ExpList > &  result,
const bool  DeclareCoeffPhysArrays 
)
protectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1955 of file DisContField3D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::MultiRegions::ExpList::GetBoundaryToElmtMap(), Nektar::MultiRegions::ExpList::GetCoeff_Offset(), Nektar::MultiRegions::ExpList::GetCoeffs(), Nektar::MultiRegions::ExpList::GetExp(), Nektar::MultiRegions::ExpList::GetPhys(), Nektar::MultiRegions::ExpList::GetPhys_Offset(), m_bndCondExpansions, and Vmath::Vcopy().

1958  {
1959  int n, cnt, nq;
1960  int offsetOld, offsetNew;
1961  std::vector<unsigned int> eIDs;
1962 
1963  Array<OneD, int> ElmtID,EdgeID;
1964  GetBoundaryToElmtMap(ElmtID,EdgeID);
1965 
1966  // Skip other boundary regions
1967  for (cnt = n = 0; n < i; ++n)
1968  {
1969  cnt += m_bndCondExpansions[n]->GetExpSize();
1970  }
1971 
1972  // Populate eIDs with information from BoundaryToElmtMap
1973  for (n = 0; n < m_bndCondExpansions[i]->GetExpSize(); ++n)
1974  {
1975  eIDs.push_back(ElmtID[cnt+n]);
1976  }
1977 
1978  // Create expansion list
1979  result =
1981  (*this, eIDs, DeclareCoeffPhysArrays);
1982 
1983  // Copy phys and coeffs to new explist
1984  if (DeclareCoeffPhysArrays)
1985  {
1986  Array<OneD, NekDouble> tmp1, tmp2;
1987  for (n = 0; n < result->GetExpSize(); ++n)
1988  {
1989  nq = GetExp(ElmtID[cnt+n])->GetTotPoints();
1990  offsetOld = GetPhys_Offset(ElmtID[cnt+n]);
1991  offsetNew = result->GetPhys_Offset(n);
1992  Vmath::Vcopy(nq, tmp1 = GetPhys()+ offsetOld, 1,
1993  tmp2 = result->UpdatePhys()+ offsetNew, 1);
1994 
1995  nq = GetExp(ElmtID[cnt+n])->GetNcoeffs();
1996  offsetOld = GetCoeff_Offset(ElmtID[cnt+n]);
1997  offsetNew = result->GetCoeff_Offset(n);
1998  Vmath::Vcopy(nq, tmp1 = GetCoeffs()+ offsetOld, 1,
1999  tmp2 = result->UpdateCoeffs()+ offsetNew, 1);
2000  }
2001  }
2002  }
const Array< OneD, const NekDouble > & GetCoeffs() const
This function returns (a reference to) the array (implemented as m_coeffs) containing all local expa...
Definition: ExpList.h:1946
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
int GetCoeff_Offset(int n) const
Get the start offset position for a global list of m_coeffs correspoinding to element n...
Definition: ExpList.h:2084
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
int GetPhys_Offset(int n) const
Get the start offset position for a global list of m_phys correspoinding to element n...
Definition: ExpList.h:2092
const boost::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
Definition: ExpList.h:2075
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Definition: ExpList.h:2302
const Array< OneD, const NekDouble > & GetPhys() const
This function returns (a reference to) the array (implemented as m_phys) containing the function ev...
Definition: ExpList.h:2045
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
void Nektar::MultiRegions::DisContField3D::v_GetBoundaryToElmtMap ( Array< OneD, int > &  ElmtID,
Array< OneD, int > &  FaceID 
)
protectedvirtual

Set up a list of elemeent IDs and edge IDs that link to the boundary conditions.

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1900 of file DisContField3D.cpp.

References Nektar::MultiRegions::ExpList::GetExpSize(), m_BCtoElmMap, m_BCtoFaceMap, m_bndCondExpansions, m_bndConditions, and Nektar::MultiRegions::ExpList::m_graph.

1903  {
1904  if (m_BCtoElmMap.num_elements() == 0)
1905  {
1906  map<int,int> globalIdMap;
1907  int i, n;
1908  int cnt;
1909  int nbcs = 0;
1910 
1912  boost::dynamic_pointer_cast<SpatialDomains::MeshGraph3D>(
1913  m_graph);
1914 
1915  // Populate global ID map (takes global geometry ID to local
1916  // expansion list ID).
1918  for (i = 0; i < GetExpSize(); ++i)
1919  {
1920  exp3d = (*m_exp)[i]->as<LocalRegions::Expansion3D>();
1921  globalIdMap[exp3d->GetGeom3D()->GetGlobalID()] = i;
1922  }
1923 
1924  // Determine number of boundary condition expansions.
1925  for(i = 0; i < m_bndConditions.num_elements(); ++i)
1926  {
1927  nbcs += m_bndCondExpansions[i]->GetExpSize();
1928  }
1929 
1930  // Initialize arrays
1931  m_BCtoElmMap = Array<OneD, int>(nbcs);
1932  m_BCtoFaceMap = Array<OneD, int>(nbcs);
1933 
1935  for(cnt = n = 0; n < m_bndCondExpansions.num_elements(); ++n)
1936  {
1937  for(i = 0; i < m_bndCondExpansions[n]->GetExpSize(); ++i, ++cnt)
1938  {
1939  exp2d = m_bndCondExpansions[n]->GetExp(i)->
1940  as<LocalRegions::Expansion2D>();
1941  // Use face to element map from MeshGraph3D.
1943  graph3D->GetElementsFromFace(exp2d->GetGeom2D());
1944 
1945  m_BCtoElmMap[cnt] = globalIdMap[(*tmp)[0]->
1946  m_Element->GetGlobalID()];
1947  m_BCtoFaceMap[cnt] = (*tmp)[0]->m_FaceIndx;
1948  }
1949  }
1950  }
1951  ElmtID = m_BCtoElmMap;
1952  FaceID = m_BCtoFaceMap;
1953  }
boost::shared_ptr< MeshGraph3D > MeshGraph3DSharedPtr
Definition: MeshGraph3D.h:224
boost::shared_ptr< ElementFaceVector > ElementFaceVectorSharedPtr
Definition: MeshGraph.h:138
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
int GetExpSize(void)
This function returns the number of elements in the expansion.
Definition: ExpList.h:2054
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:48
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
Definition: ExpList.h:972
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
void Nektar::MultiRegions::DisContField3D::v_GetFwdBwdTracePhys ( Array< OneD, NekDouble > &  Fwd,
Array< OneD, NekDouble > &  Bwd 
)
protectedvirtual

This method extracts the "forward" and "backward" trace data from the array field and puts the data into output vectors Fwd and Bwd.

We first define the convention which defines "forwards" and "backwards". First an association is made between the face of each element and its corresponding face in the trace space using the mapping m_traceMap. The element can either be left-adjacent or right-adjacent to this trace face (see Expansion2D::GetLeftAdjacentElementExp). Boundary faces are always left-adjacent since left-adjacency is populated first.

If the element is left-adjacent we extract the face trace data from field into the forward trace space Fwd; otherwise, we place it in the backwards trace space Bwd. In this way, we form a unique set of trace normals since these are always extracted from left-adjacent elements.

Parameters
fieldis a NekDouble array which contains the 3D data from which we wish to extract the backward and forward orientated trace/face arrays.
Returns
Updates a NekDouble array Fwd and Bwd

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1711 of file DisContField3D.cpp.

References Nektar::MultiRegions::ExpList::m_phys.

1713  {
1714  v_GetFwdBwdTracePhys(m_phys, Fwd, Bwd);
1715  }
virtual void v_GetFwdBwdTracePhys(Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
This method extracts the "forward" and "backward" trace data from the array field and puts the data i...
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
Definition: ExpList.h:1015
void Nektar::MultiRegions::DisContField3D::v_GetFwdBwdTracePhys ( const Array< OneD, const NekDouble > &  field,
Array< OneD, NekDouble > &  Fwd,
Array< OneD, NekDouble > &  Bwd 
)
protectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1717 of file DisContField3D.cpp.

References ASSERTL0, Nektar::SpatialDomains::eDirichlet, Nektar::SpatialDomains::eNeumann, Nektar::SpatialDomains::eRobin, Nektar::MultiRegions::ExpList::GetPhys(), m_bndCondExpansions, m_bndConditions, m_locTraceToTraceMap, m_periodicBwdCopy, m_periodicFwdCopy, m_trace, m_traceMap, npts, Vmath::Vcopy(), and Vmath::Zero().

1721  {
1722  int n, cnt, npts, e;
1723 
1724  // Zero vectors.
1725  Vmath::Zero(Fwd.num_elements(), Fwd, 1);
1726  Vmath::Zero(Bwd.num_elements(), Bwd, 1);
1727 
1728  Array<OneD, NekDouble> facevals(m_locTraceToTraceMap->
1729  GetNLocTracePts());
1730  m_locTraceToTraceMap->LocTracesFromField(field,facevals);
1731  m_locTraceToTraceMap->InterpLocFacesToTrace(0, facevals, Fwd);
1732 
1733  Array<OneD, NekDouble> invals = facevals + m_locTraceToTraceMap->
1734  GetNFwdLocTracePts();
1735  m_locTraceToTraceMap->InterpLocFacesToTrace(1, invals, Bwd);
1736 
1737  // Fill boundary conditions into missing elements
1738  int id1, id2 = 0;
1739  cnt = 0;
1740 
1741  for(n = 0; n < m_bndCondExpansions.num_elements(); ++n)
1742  {
1743  if(m_bndConditions[n]->GetBoundaryConditionType() ==
1745  {
1746  for(e = 0; e < m_bndCondExpansions[n]->GetExpSize(); ++e)
1747  {
1748  npts = m_bndCondExpansions[n]->GetExp(e)->GetTotPoints();
1749  id1 = m_bndCondExpansions[n]->GetPhys_Offset(e);
1750  id2 = m_trace->GetPhys_Offset(
1751  m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1752  Vmath::Vcopy(npts,
1753  &(m_bndCondExpansions[n]->GetPhys())[id1], 1,
1754  &Bwd[id2], 1);
1755  }
1756 
1757  cnt += e;
1758  }
1759  else if (m_bndConditions[n]->GetBoundaryConditionType() ==
1761  m_bndConditions[n]->GetBoundaryConditionType() ==
1763  {
1764  for(e = 0; e < m_bndCondExpansions[n]->GetExpSize(); ++e)
1765  {
1766  npts = m_bndCondExpansions[n]->GetExp(e)->GetTotPoints();
1767  id1 = m_bndCondExpansions[n]->GetPhys_Offset(e);
1768  id2 = m_trace->GetPhys_Offset(
1769  m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1770 
1771  // Turning this off since we can have non-zero
1772  //Neumann in mixed CG-DG method
1773  //ASSERTL1((m_bndCondExpansions[n]->GetPhys())[id1]
1774  //== 0.0, "method not set up for non-zero
1775  //Neumann " "boundary condition");
1776 
1777  Vmath::Vcopy(npts,&Fwd[id2],1,&Bwd[id2],1);
1778  }
1779 
1780  cnt += e;
1781  }
1782  else
1783  {
1784  ASSERTL0(false, "Method only set up for Dirichlet, Neumann "
1785  "and Robin conditions.");
1786  }
1787  }
1788 
1789  // Copy any periodic boundary conditions.
1790  for (n = 0; n < m_periodicFwdCopy.size(); ++n)
1791  {
1792  Bwd[m_periodicBwdCopy[n]] = Fwd[m_periodicFwdCopy[n]];
1793  }
1794 
1795  // Do parallel exchange for forwards/backwards spaces.
1796  m_traceMap->UniversalTraceAssemble(Fwd);
1797  m_traceMap->UniversalTraceAssemble(Bwd);
1798  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
static std::string npts
Definition: InputFld.cpp:43
const Array< OneD, const NekDouble > & GetPhys() const
This function returns (a reference to) the array (implemented as m_phys) containing the function ev...
Definition: ExpList.h:2045
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
const vector< bool > & Nektar::MultiRegions::DisContField3D::v_GetLeftAdjacentFaces ( void  ) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 1800 of file DisContField3D.cpp.

References m_leftAdjacentFaces.

1801  {
1802  return m_leftAdjacentFaces;
1803  }
virtual void Nektar::MultiRegions::DisContField3D::v_GetPeriodicEntities ( PeriodicMap periodicVerts,
PeriodicMap periodicEdges,
PeriodicMap periodicFaces 
)
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 212 of file DisContField3D.h.

References m_periodicEdges, m_periodicFaces, and m_periodicVerts.

216  {
217  periodicVerts = m_periodicVerts;
218  periodicEdges = m_periodicEdges;
219  periodicFaces = m_periodicFaces;
220  }
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
map< int, RobinBCInfoSharedPtr > Nektar::MultiRegions::DisContField3D::v_GetRobinBCInfo ( void  )
protectedvirtual

Search through the edge expansions and identify which ones have Robin/Mixed type boundary conditions. If find a Robin boundary then store the edge id of the boundary condition and the array of points of the physical space boundary condition which are hold the boundary condition primitive variable coefficient at the quatrature points

Returns
std map containing the robin boundary condition info using a key of the element id

There is a next member to allow for more than one Robin boundary condition per element

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 2192 of file DisContField3D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::eRobin, Nektar::LibUtilities::Equation::Evaluate(), Nektar::MultiRegions::ExpList::GetBoundaryToElmtMap(), m_bndCondExpansions, and m_bndConditions.

2193  {
2194  int i,cnt;
2195  map<int, RobinBCInfoSharedPtr> returnval;
2196  Array<OneD, int> ElmtID,FaceID;
2197  GetBoundaryToElmtMap(ElmtID,FaceID);
2198 
2199  for(cnt = i = 0; i < m_bndCondExpansions.num_elements(); ++i)
2200  {
2201  MultiRegions::ExpListSharedPtr locExpList;
2202 
2203  if(m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eRobin)
2204  {
2205  int e,elmtid;
2206  Array<OneD, NekDouble> Array_tmp;
2207 
2208  locExpList = m_bndCondExpansions[i];
2209 
2210  int npoints = locExpList->GetNpoints();
2211  Array<OneD, NekDouble> x0(npoints, 0.0);
2212  Array<OneD, NekDouble> x1(npoints, 0.0);
2213  Array<OneD, NekDouble> x2(npoints, 0.0);
2214  Array<OneD, NekDouble> coeffphys(npoints);
2215 
2216  locExpList->GetCoords(x0, x1, x2);
2217 
2218  LibUtilities::Equation coeffeqn =
2219  boost::static_pointer_cast<
2220  SpatialDomains::RobinBoundaryCondition>
2221  (m_bndConditions[i])->m_robinPrimitiveCoeff;
2222 
2223  // evalaute coefficient
2224  coeffeqn.Evaluate(x0, x1, x2, 0.0, coeffphys);
2225 
2226  for(e = 0; e < locExpList->GetExpSize(); ++e)
2227  {
2228  RobinBCInfoSharedPtr rInfo =
2230  ::AllocateSharedPtr(FaceID[cnt+e],
2231  Array_tmp = coeffphys +
2232  locExpList->GetPhys_Offset(e));
2233 
2234  elmtid = ElmtID[cnt+e];
2235  // make link list if necessary
2236  if(returnval.count(elmtid) != 0)
2237  {
2238  rInfo->next = returnval.find(elmtid)->second;
2239  }
2240  returnval[elmtid] = rInfo;
2241  }
2242  }
2243  cnt += m_bndCondExpansions[i]->GetExpSize();
2244  }
2245 
2246  return returnval;
2247  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Definition: ExpList.h:2302
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
virtual ExpListSharedPtr& Nektar::MultiRegions::DisContField3D::v_GetTrace ( )
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 222 of file DisContField3D.h.

References m_trace, Nektar::MultiRegions::NullExpListSharedPtr, and SetUpDG().

223  {
225  {
226  SetUpDG();
227  }
228 
229  return m_trace;
230  }
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1485
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
virtual AssemblyMapDGSharedPtr& Nektar::MultiRegions::DisContField3D::v_GetTraceMap ( void  )
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 232 of file DisContField3D.h.

References m_traceMap.

233  {
234  return m_traceMap;
235  }
void Nektar::MultiRegions::DisContField3D::v_HelmSolve ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
const FlagList flags,
const StdRegions::ConstFactorMap factors,
const StdRegions::VarCoeffMap varcoeff,
const Array< OneD, const NekDouble > &  dirForcing,
const bool  PhysSpaceForcing 
)
protectedvirtual

Solving Helmholtz Equation in 3D

Reimplemented from Nektar::MultiRegions::ExpList.

Reimplemented in Nektar::MultiRegions::ContField3D.

Definition at line 2021 of file DisContField3D.cpp.

References Nektar::SpatialDomains::eDirichlet, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::StdRegions::eHybridDGLamToU, Nektar::StdRegions::eInvHybridDGHelmholtz, Nektar::eWrapper, Nektar::MultiRegions::ExpList::GetBlockMatrix(), Nektar::MultiRegions::ExpList::GetExpSize(), GetGlobalBndLinSys(), Nektar::MultiRegions::ExpList::GetNcoeffs(), Nektar::MultiRegions::ExpList::IProductWRTBase(), m_bndCondExpansions, m_bndConditions, Nektar::MultiRegions::ExpList::m_ncoeffs, Nektar::MultiRegions::ExpList::m_offset_elmt_id, m_trace, m_traceMap, Vmath::Neg(), Nektar::MultiRegions::NullAssemblyMapSharedPtr, Vmath::Smul(), Nektar::Transpose(), and Vmath::Zero().

2029  {
2030  int i,j,n,cnt,cnt1,nbndry;
2031  int nexp = GetExpSize();
2033 
2034  Array<OneD,NekDouble> f(m_ncoeffs);
2035  DNekVec F(m_ncoeffs,f,eWrapper);
2036  Array<OneD,NekDouble> e_f, e_l;
2037 
2038  //----------------------------------
2039  // Setup RHS Inner product
2040  //----------------------------------
2041  if(PhysSpaceForcing)
2042  {
2043  IProductWRTBase(inarray,f);
2044  Vmath::Neg(m_ncoeffs,f,1);
2045  }
2046  else
2047  {
2048  Vmath::Smul(m_ncoeffs,-1.0,inarray,1,f,1);
2049  }
2050 
2051  //----------------------------------
2052  // Solve continuous flux System
2053  //----------------------------------
2054  int GloBndDofs = m_traceMap->GetNumGlobalBndCoeffs();
2055  int NumDirichlet = m_traceMap->GetNumLocalDirBndCoeffs();
2056  int e_ncoeffs,id;
2057 
2058  // Retrieve block matrix of U^e
2059  GlobalMatrixKey HDGLamToUKey(StdRegions::eHybridDGLamToU,NullAssemblyMapSharedPtr,factors,varcoeff);
2060  const DNekScalBlkMatSharedPtr &HDGLamToU = GetBlockMatrix(HDGLamToUKey);
2061 
2062  // Retrieve global trace space storage, \Lambda, from trace expansion
2063  Array<OneD,NekDouble> BndSol = m_trace->UpdateCoeffs();
2064 
2065  // Create trace space forcing, F
2066  Array<OneD,NekDouble> BndRhs(GloBndDofs,0.0);
2067 
2068  // Zero \Lambda
2069  Vmath::Zero(GloBndDofs,BndSol,1);
2070 
2071  // Retrieve number of local trace space coefficients N_{\lambda},
2072  // and set up local elemental trace solution \lambda^e.
2073  int LocBndCoeffs = m_traceMap->GetNumLocalBndCoeffs();
2074  Array<OneD, NekDouble> loc_lambda(LocBndCoeffs);
2075  DNekVec LocLambda(LocBndCoeffs,loc_lambda,eWrapper);
2076 
2077  //----------------------------------
2078  // Evaluate Trace Forcing vector F
2079  // Kirby et al, 2010, P23, Step 5.
2080  //----------------------------------
2081  // Loop over all expansions in the domain
2082  for(cnt = cnt1 = n = 0; n < nexp; ++n)
2083  {
2084  nbndry = (*m_exp)[m_offset_elmt_id[n]]->NumDGBndryCoeffs();
2085 
2086  e_ncoeffs = (*m_exp)[m_offset_elmt_id[n]]->GetNcoeffs();
2087  e_f = f + cnt;
2088  e_l = loc_lambda + cnt1;
2089 
2090  // Local trace space \lambda^e
2091  DNekVec Floc (nbndry, e_l, eWrapper);
2092  // Local forcing f^e
2093  DNekVec ElmtFce (e_ncoeffs, e_f, eWrapper);
2094  // Compute local (U^e)^{\top} f^e
2095  Floc = Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
2096 
2097  cnt += e_ncoeffs;
2098  cnt1 += nbndry;
2099  }
2100 
2101  // Assemble local \lambda_e into global \Lambda
2102  m_traceMap->AssembleBnd(loc_lambda,BndRhs);
2103 
2104  // Copy Dirichlet boundary conditions and weak forcing into trace
2105  // space
2106  cnt = 0;
2107  for(i = 0; i < m_bndCondExpansions.num_elements(); ++i)
2108  {
2109  if(m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eDirichlet)
2110  {
2111  for(j = 0; j < (m_bndCondExpansions[i])->GetNcoeffs(); ++j)
2112  {
2113  id = m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
2114  BndSol[id] = m_bndCondExpansions[i]->GetCoeffs()[j];
2115  }
2116  }
2117  else
2118  {
2119  //Add weak boundary condition to trace forcing
2120  for(j = 0; j < (m_bndCondExpansions[i])->GetNcoeffs(); ++j)
2121  {
2122  id = m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
2123  BndRhs[id] += m_bndCondExpansions[i]->GetCoeffs()[j];
2124  }
2125  }
2126  }
2127 
2128  //----------------------------------
2129  // Solve trace problem: \Lambda = K^{-1} F
2130  // K is the HybridDGHelmBndLam matrix.
2131  //----------------------------------
2132  if(GloBndDofs - NumDirichlet > 0)
2133  {
2134  GlobalLinSysKey key(StdRegions::eHybridDGHelmBndLam,
2135  m_traceMap,factors,varcoeff);
2137  LinSys->Solve(BndRhs,BndSol,m_traceMap);
2138  }
2139 
2140  //----------------------------------
2141  // Internal element solves
2142  //----------------------------------
2143  GlobalMatrixKey invHDGhelmkey(StdRegions::eInvHybridDGHelmholtz,NullAssemblyMapSharedPtr,factors,varcoeff);
2144  const DNekScalBlkMatSharedPtr& InvHDGHelm = GetBlockMatrix(invHDGhelmkey);
2145  DNekVec out(m_ncoeffs,outarray,eWrapper);
2146  Vmath::Zero(m_ncoeffs,outarray,1);
2147 
2148  // get local trace solution from BndSol
2149  m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
2150 
2151  // out = u_f + u_lam = (*InvHDGHelm)*f + (LamtoU)*Lam
2152  out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
2153  }
const DNekScalBlkMatSharedPtr & GetBlockMatrix(const GlobalMatrixKey &gkey)
Definition: ExpList.cpp:890
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
int GetExpSize(void)
This function returns the number of elements in the expansion.
Definition: ExpList.h:2054
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:213
int m_ncoeffs
The total number of local degrees of freedom. m_ncoeffs .
Definition: ExpList.h:976
Array< OneD, int > m_offset_elmt_id
Array containing the element id m_offset_elmt_id[n] that the n^th consecutive block of data in m_coef...
Definition: ExpList.h:1058
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:74
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:396
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
Definition: AssemblyMap.h:55
NekVector< NekDouble > DNekVec
Definition: NekTypeDefs.hpp:49
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Definition: ExpList.h:1649
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
Definition: ExpList.h:1493
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:52
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Nektar::MultiRegions::DisContField3D::v_Reset ( )
protectedvirtual

Reset this field, so that geometry information can be updated.

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 2007 of file DisContField3D.cpp.

References m_bndCondExpansions, and Nektar::MultiRegions::ExpList::v_Reset().

2008  {
2009  ExpList::v_Reset();
2010 
2011  // Reset boundary condition expansions.
2012  for (int n = 0; n < m_bndCondExpansions.num_elements(); ++n)
2013  {
2014  m_bndCondExpansions[n]->Reset();
2015  }
2016  }
virtual void v_Reset()
Reset geometry information, metrics, matrix managers and geometry information.
Definition: ExpList.cpp:1513
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
virtual MultiRegions::ExpListSharedPtr& Nektar::MultiRegions::DisContField3D::v_UpdateBndCondExpansion ( int  i)
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 251 of file DisContField3D.h.

252  {
253  return m_bndCondExpansions[i];
254  }
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
virtual Array<OneD, SpatialDomains::BoundaryConditionShPtr>& Nektar::MultiRegions::DisContField3D::v_UpdateBndConditions ( )
inlineprotectedvirtual

Reimplemented from Nektar::MultiRegions::ExpList.

Definition at line 257 of file DisContField3D.h.

References m_bndConditions.

258  {
259  return m_bndConditions;
260  }
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...

Member Data Documentation

Array<OneD, int> Nektar::MultiRegions::DisContField3D::m_BCtoElmMap

Definition at line 91 of file DisContField3D.h.

Referenced by v_GetBoundaryToElmtMap().

Array<OneD, int> Nektar::MultiRegions::DisContField3D::m_BCtoFaceMap

Definition at line 92 of file DisContField3D.h.

Referenced by v_GetBoundaryToElmtMap().

Array<OneD,MultiRegions::ExpListSharedPtr> Nektar::MultiRegions::DisContField3D::m_bndCondExpansions
protected
Array<OneD,SpatialDomains::BoundaryConditionShPtr> Nektar::MultiRegions::DisContField3D::m_bndConditions
protected
std::set<int> Nektar::MultiRegions::DisContField3D::m_boundaryFaces
protected

A set storing the global IDs of any boundary faces.

Definition at line 123 of file DisContField3D.h.

Referenced by IsLeftAdjacentFace(), and SetUpDG().

GlobalLinSysMapShPtr Nektar::MultiRegions::DisContField3D::m_globalBndMat
protected

Definition at line 113 of file DisContField3D.h.

Referenced by DisContField3D(), GetGlobalBndLinSys(), and SetUpDG().

std::vector<bool> Nektar::MultiRegions::DisContField3D::m_leftAdjacentFaces
protected

Definition at line 144 of file DisContField3D.h.

Referenced by GetLeftAdjacentFaces(), SetUpDG(), and v_GetLeftAdjacentFaces().

LocTraceToTraceMapSharedPtr Nektar::MultiRegions::DisContField3D::m_locTraceToTraceMap
protected

Map of local trace (the points at the face of the element) to the trace space discretisation.

Definition at line 118 of file DisContField3D.h.

Referenced by DisContField3D(), SetUpDG(), v_AddFwdBwdTraceIntegral(), v_AddTraceIntegral(), v_ExtractTracePhys(), and v_GetFwdBwdTracePhys().

std::vector<int> Nektar::MultiRegions::DisContField3D::m_periodicBwdCopy
protected

Definition at line 152 of file DisContField3D.h.

Referenced by SetUpDG(), and v_GetFwdBwdTracePhys().

PeriodicMap Nektar::MultiRegions::DisContField3D::m_periodicEdges
protected

A map which identifies groups of periodic edges.

Definition at line 133 of file DisContField3D.h.

Referenced by Nektar::MultiRegions::ContField3D::ContField3D(), DisContField3D(), FindPeriodicFaces(), and v_GetPeriodicEntities().

PeriodicMap Nektar::MultiRegions::DisContField3D::m_periodicFaces
protected

A map which identifies pairs of periodic faces.

Definition at line 128 of file DisContField3D.h.

Referenced by Nektar::MultiRegions::ContField3D::ContField3D(), DisContField3D(), FindPeriodicFaces(), IsLeftAdjacentFace(), SetUpDG(), and v_GetPeriodicEntities().

std::vector<int> Nektar::MultiRegions::DisContField3D::m_periodicFwdCopy
protected

A vector indicating degress of freedom which need to be copied from forwards to backwards space in case of a periodic boundary condition.

Definition at line 151 of file DisContField3D.h.

Referenced by SetUpDG(), and v_GetFwdBwdTracePhys().

PeriodicMap Nektar::MultiRegions::DisContField3D::m_periodicVerts
protected

A map which identifies groups of periodic vertices.

Definition at line 138 of file DisContField3D.h.

Referenced by Nektar::MultiRegions::ContField3D::ContField3D(), DisContField3D(), FindPeriodicFaces(), and v_GetPeriodicEntities().

ExpListSharedPtr Nektar::MultiRegions::DisContField3D::m_trace
protected
AssemblyMapDGSharedPtr Nektar::MultiRegions::DisContField3D::m_traceMap
protected