Nektar++
Expansion2D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Expansion2D.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Header file for Expansion2D routines
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef EXPANSION2D_H
36 #define EXPANSION2D_H
37 
38 #include <boost/core/ignore_unused.hpp>
39 
44 
45 namespace Nektar
46 {
47  namespace LocalRegions
48  {
49  class Expansion3D;
50  typedef std::shared_ptr<Expansion3D> Expansion3DSharedPtr;
51  typedef std::weak_ptr<Expansion3D> Expansion3DWeakPtr;
52 
53  class Expansion2D;
54  typedef std::shared_ptr<Expansion2D> Expansion2DSharedPtr;
55  typedef std::weak_ptr<Expansion2D> Expansion2DWeakPtr;
56  typedef std::vector< Expansion2DSharedPtr > Expansion2DVector;
57 
58  class Expansion2D: virtual public Expansion,
59  virtual public StdRegions::StdExpansion2D
60  {
61  public:
62  LOCAL_REGIONS_EXPORT Expansion2D(SpatialDomains::
63  Geometry2DSharedPtr pGeom);
64 
66 
69  Array<OneD, NekDouble> &inout);
70 
71  LOCAL_REGIONS_EXPORT Expansion1DSharedPtr GetEdgeExp(int edge, bool SetUpNormal = true);
72 
73  void SetEdgeExp(const int edge, Expansion1DSharedPtr &e);
74 
75  inline void AddNormTraceInt(
76  const int dir,
78  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
79  Array<OneD, NekDouble> &outarray);
80 
81  inline void AddNormTraceInt(
82  const int dir,
85  Array<OneD, NekDouble> &outarray,
86  const StdRegions::VarCoeffMap &varcoeffs);
87 
88  inline void AddEdgeBoundaryInt(
89  const int edge,
90  ExpansionSharedPtr &EdgeExp,
91  Array<OneD, NekDouble> &edgePhys,
92  Array<OneD, NekDouble> &outarray,
93  const StdRegions::VarCoeffMap &varcoeffs = StdRegions::
95 
96  inline void AddHDGHelmholtzEdgeTerms(
97  const NekDouble tau,
98  const int edge,
100  Array<OneD, NekDouble> &edgePhys,
101  const StdRegions::VarCoeffMap &dirForcing,
102  Array<OneD, NekDouble> &outarray);
103 
104  inline void AddHDGHelmholtzTraceTerms(
105  const NekDouble tau,
106  const Array<OneD, const NekDouble> &inarray,
108  const StdRegions::VarCoeffMap &dirForcing,
109  Array<OneD, NekDouble> &outarray);
110 
111  inline Expansion3DSharedPtr GetLeftAdjacentElementExp() const;
112 
113  inline Expansion3DSharedPtr GetRightAdjacentElementExp() const;
114 
115  inline int GetLeftAdjacentElementFace() const;
116 
117  inline int GetRightAdjacentElementFace() const;
118 
119  inline void SetAdjacentElementExp(
120  int face,
121  Expansion3DSharedPtr &f);
122 
124 
126  const int nvert,
127  const StdRegions::Orientation orient,
128  const int nq0,
129  Array<OneD, int> &idmap);
130 
131  protected:
132  std::vector<Expansion1DWeakPtr> m_edgeExp;
133  std::vector<bool> m_requireNeg;
134  std::map<int, StdRegions::NormalVector> m_edgeNormals;
135  std::map<int, bool> m_negatedNormals;
136  Expansion3DWeakPtr m_elementLeft;
137  Expansion3DWeakPtr m_elementRight;
140 
142  const int dir,
143  const int shapedim,
144  const StdRegions::VarCoeffMap &varcoeffs);
145 
147  const int dir,
148  const StdRegions::VarCoeffMap &varcoeffs);
149 
151  const int dir,
152  const StdRegions::VarCoeffMap &varcoeffs);
153 
155  const StdRegions::StdMatrixKey &mkey);
156 
157  // Hybridized DG routines
158  virtual void v_DGDeriv(
159  const int dir,
160  const Array<OneD, const NekDouble> &incoeffs,
162  Array<OneD, Array<OneD, NekDouble> > &edgeCoeffs,
163  Array<OneD, NekDouble> &out_d);
164 
165  virtual void v_AddEdgeNormBoundaryInt(
166  const int edge,
167  const ExpansionSharedPtr &EdgeExp,
170  Array<OneD, NekDouble> &outarray);
171 
172  virtual void v_AddEdgeNormBoundaryInt(
173  const int edge,
174  const ExpansionSharedPtr &EdgeExp,
176  Array<OneD, NekDouble> &outarray);
177 
178  virtual void v_AddRobinMassMatrix(
179  const int edgeid,
180  const Array<OneD, const NekDouble > &primCoeffs,
181  DNekMatSharedPtr &inoutmat);
182 
183  virtual void v_AddRobinEdgeContribution(
184  const int edgeid,
185  const Array<OneD, const NekDouble> &primCoeffs,
186  Array<OneD, NekDouble> &coeffs);
187 
189  const DNekScalMatSharedPtr &r_bnd);
190 
192  const int edge,
193  ExpansionSharedPtr &EdgeExp,
194  const Array<OneD, const NekDouble> &varcoeff,
195  Array<OneD,NekDouble> &outarray);
196 
198  const int dir,
199  const int edge,
200  ExpansionSharedPtr &EdgeExp_e,
201  const Array<OneD, const Array<OneD, NekDouble> > &normals,
202  const StdRegions::VarCoeffMap &varcoeffs);
203 
205  const StdRegions::Orientation orient,
206  const int nq0,
207  Array<OneD, int> &idmap);
208 
210 
211  virtual void v_NegateEdgeNormal (const int edge);
212  virtual bool v_EdgeNormalNegated(const int edge);
213  virtual void v_SetUpPhysNormals (const int edge);
215  const int edge) const;
217  const int id) const;
218  virtual NekDouble v_VectorFlux(
219  const Array<OneD, Array<OneD, NekDouble > > &vec);
220  };
221 
223  int edge,
224  bool SetUpNormal)
225  {
226  boost::ignore_unused(SetUpNormal);
227  ASSERTL1(edge < GetNedges(), "Edge out of range.");
228  return m_edgeExp[edge].lock();
229  }
230 
232  const int edge,
234  {
235  unsigned int nEdges = GetNedges();
236  ASSERTL1(edge < nEdges, "Edge out of range.");
237  if (m_edgeExp.size() < nEdges)
238  {
239  m_edgeExp.resize(nEdges);
240  }
241  m_edgeExp[edge] = e;
242  }
243 
244  inline Expansion3DSharedPtr Expansion2D::
246  {
247  ASSERTL1(m_elementLeft.lock().get(),
248  "Left adjacent element not set.");
249  return m_elementLeft.lock();
250  }
251 
252  inline Expansion3DSharedPtr Expansion2D::
254  {
255  ASSERTL1(m_elementLeft.lock().get(),
256  "Right adjacent element not set.");
257 
258  return m_elementRight.lock();
259  }
260 
262  {
263  return m_elementFaceLeft;
264  }
265 
267  {
268  return m_elementFaceRight;
269  }
270 
272  int face,
273  Expansion3DSharedPtr &f)
274  {
275  if (m_elementLeft.lock().get())
276  {
277  ASSERTL1(!m_elementRight.lock().get(),
278  "Both adjacent elements already set.");
279 
280  m_elementRight = f;
281  m_elementFaceRight = face;
282  }
283  else
284  {
285  m_elementLeft = f;
286  m_elementFaceLeft = face;
287  }
288  }
289 
292  {
293  return std::dynamic_pointer_cast<SpatialDomains::
294  Geometry2D>(m_geom);
295  }
296  } //end of namespace
297 } //end of namespace
298 
299 #endif
virtual Array< OneD, NekDouble > v_GetMFMag(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Expansion3DSharedPtr GetLeftAdjacentElementExp() const
Definition: Expansion2D.h:245
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry.h:65
Expansion3DWeakPtr m_elementRight
Definition: Expansion2D.h:137
void SetAdjacentElementExp(int face, Expansion3DSharedPtr &f)
Definition: Expansion2D.h:271
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
void GetPhysEdgeVarCoeffsFromElement(const int edge, ExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &varcoeff, Array< OneD, NekDouble > &outarray)
void AddNormTraceInt(const int dir, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &edgeCoeffs, Array< OneD, NekDouble > &outarray)
Array< OneD, NekDouble > v_GetnEdgecdotMF(const int dir, const int edge, ExpansionSharedPtr &EdgeExp_e, const Array< OneD, const Array< OneD, NekDouble > > &normals, const StdRegions::VarCoeffMap &varcoeffs)
std::map< int, bool > m_negatedNormals
Definition: Expansion2D.h:135
std::map< int, StdRegions::NormalVector > m_edgeNormals
Definition: Expansion2D.h:134
Expansion3DSharedPtr GetRightAdjacentElementExp() const
Definition: Expansion2D.h:253
void SetTraceToGeomOrientation(Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, NekDouble > &inout)
virtual void v_AddRobinEdgeContribution(const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, Array< OneD, NekDouble > &coeffs)
virtual DNekMatSharedPtr v_BuildVertexMatrix(const DNekScalMatSharedPtr &r_bnd)
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
SpatialDomains::GeometrySharedPtr m_geom
Definition: Expansion.h:127
virtual void v_AddRobinMassMatrix(const int edgeid, const Array< OneD, const NekDouble > &primCoeffs, DNekMatSharedPtr &inoutmat)
void AddEdgeBoundaryInt(const int edge, ExpansionSharedPtr &EdgeExp, Array< OneD, NekDouble > &edgePhys, Array< OneD, NekDouble > &outarray, const StdRegions::VarCoeffMap &varcoeffs=StdRegions::NullVarCoeffMap)
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:49
virtual void v_NegateEdgeNormal(const int edge)
std::vector< Expansion2DSharedPtr > Expansion2DVector
Definition: Expansion2D.h:56
std::vector< bool > m_requireNeg
Definition: Expansion2D.h:133
virtual Array< OneD, NekDouble > v_GetMF(const int dir, const int shapedim, const StdRegions::VarCoeffMap &varcoeffs)
SpatialDomains::Geometry2DSharedPtr GetGeom2D() const
Definition: Expansion2D.h:291
Expansion3DWeakPtr m_elementLeft
Definition: Expansion2D.h:136
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
virtual Array< OneD, NekDouble > v_GetMFDiv(const int dir, const StdRegions::VarCoeffMap &varcoeffs)
Expansion1DSharedPtr GetEdgeExp(int edge, bool SetUpNormal=true)
Definition: Expansion2D.h:222
virtual void v_AddEdgeNormBoundaryInt(const int edge, const ExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Definition: Expansion2D.cpp:59
double NekDouble
int GetNedges() const
This function returns the number of edges of the expansion domain.
Definition: StdExpansion.h:271
void AddHDGHelmholtzEdgeTerms(const NekDouble tau, const int edge, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, NekDouble > &edgePhys, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
std::weak_ptr< Expansion3D > Expansion3DWeakPtr
Definition: Expansion2D.h:51
Expansion2D(SpatialDomains::Geometry2DSharedPtr pGeom)
Definition: Expansion2D.cpp:52
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey)
virtual bool v_EdgeNormalNegated(const int edge)
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:65
void AddHDGHelmholtzTraceTerms(const NekDouble tau, const Array< OneD, const NekDouble > &inarray, Array< OneD, ExpansionSharedPtr > &EdgeExp, const StdRegions::VarCoeffMap &dirForcing, Array< OneD, NekDouble > &outarray)
std::weak_ptr< Expansion2D > Expansion2DWeakPtr
Definition: Expansion1D.h:49
void ReOrientQuadEdgePhysMap(const StdRegions::Orientation orient, const int nq0, Array< OneD, int > &idmap)
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:47
virtual void v_DGDeriv(const int dir, const Array< OneD, const NekDouble > &incoeffs, Array< OneD, ExpansionSharedPtr > &EdgeExp, Array< OneD, Array< OneD, NekDouble > > &edgeCoeffs, Array< OneD, NekDouble > &out_d)
std::vector< Expansion1DWeakPtr > m_edgeExp
Definition: Expansion2D.h:132
void SetEdgeExp(const int edge, Expansion1DSharedPtr &e)
Definition: Expansion2D.h:231
const StdRegions::NormalVector & v_GetSurfaceNormal(const int id) const
const StdRegions::NormalVector & v_GetEdgeNormal(const int edge) const
virtual void v_SetUpPhysNormals(const int edge)
#define LOCAL_REGIONS_EXPORT
virtual NekDouble v_VectorFlux(const Array< OneD, Array< OneD, NekDouble > > &vec)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
std::shared_ptr< Expansion1D > Expansion1DSharedPtr
Definition: Expansion1D.h:51
Array< OneD, unsigned int > v_GetEdgeInverseBoundaryMap(int eid)
void ReOrientEdgePhysMap(const int nvert, const StdRegions::Orientation orient, const int nq0, Array< OneD, int > &idmap)
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:265