Nektar++
DisContField2D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File DisContField2D.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: Field definition in two-dimensions for a discontinuous LDG-H
32 // expansion.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD2D_H
37 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD2D_H
38 
39 #include <boost/core/ignore_unused.hpp>
40 
43 #include <MultiRegions/ExpList2D.h>
48 
49 namespace Nektar
50 {
51  namespace MultiRegions
52  {
53  class DisContField2D : public ExpList2D
54  {
55  public:
57 
61  const std::string &variable,
62  const bool SetUpJustDG = true,
63  const bool DeclareCoeffPhysArrays = true,
66 
68  const DisContField2D &In,
70  const std::string &variable,
71  const bool SetUpJustDG = false,
72  const bool DeclareCoeffPhysArrays = true);
73 
75  const DisContField2D &In,
76  const bool DeclareCoeffPhysArrays = true);
77 
79 
81  const GlobalLinSysKey &mkey);
82 
84  const int dir,
85  const Array<OneD, const NekDouble> &soln);
86 
88  Array<OneD, NekDouble> &outarray);
89 
91  {
93  {
94  SetUpDG();
95  }
96 
97  return m_trace;
98  }
99 
102 
103  protected:
104 
105  Array<OneD, LibUtilities::BasisSharedPtr> m_base; /**< Bases needed for the expansion */
106 
107  /** \brief This function gets the shared point to basis
108  *
109  * \return returns the shared pointer to the bases
110  */
112  {
113  return(m_base);
114  }
115 
116  /** \brief This function returns the type of basis used in the \a dir
117  * direction
118  *
119  * The different types of bases implemented in the code are defined
120  * in the LibUtilities::BasisType enumeration list. As a result, the
121  * function will return one of the types of this enumeration list.
122  *
123  * \param dir the direction
124  * \return returns the type of basis used in the \a dir direction
125  */
126  inline LibUtilities::BasisType GetBasisType(const int dir) const
127  {
128  ASSERTL1(dir < m_base.num_elements(), "dir is larger than m_numbases");
129  return(m_base[dir]->GetBasisType());
130  }
131 
132  /**
133  * @brief An object which contains the discretised boundary
134  * conditions.
135  *
136  * It is an array of size equal to the number of boundary regions
137  * and consists of entries of the type MultiRegions#ExpList1D. Every
138  * entry corresponds to the one-dimensional spectral/hp expansion on
139  * a single boundary region. The values of the boundary conditions
140  * are stored as the coefficients of the one-dimensional expansion.
141  */
143 
144  /**
145  * @brief An array which contains the information about
146  * the boundary condition on the different boundary regions.
147  */
149 
153 
154  /**
155  * Map of local trace (the points at the face of
156  * the element) to the trace space discretisation
157  */
159 
163 
164  /**
165  * @brief A set storing the global IDs of any boundary edges.
166  */
167  std::set<int> m_boundaryEdges;
168 
169  /**
170  * @brief A map which identifies groups of periodic vertices.
171  */
173 
174  /**
175  * @brief A map which identifies pairs of periodic edges.
176  */
178 
179 
180  /**
181  * @brief A vector indicating degress of freedom which need to be
182  * copied from forwards to backwards space in case of a periodic
183  * boundary condition.
184  */
185  std::vector<int> m_periodicFwdCopy;
186  std::vector<int> m_periodicBwdCopy;
187 
188  /*
189  * @brief A map identifying which edges are left- and right-adjacent
190  * for DG.
191  */
192  std::vector<bool> m_leftAdjacentEdges;
193 
194  void SetUpDG(const std::string = "DefaultVar");
195  bool SameTypeOfBoundaryConditions(const DisContField2D &In);
197  const SpatialDomains::MeshGraphSharedPtr &graph2D,
199  const std::string &variable,
200  const bool DeclareCoeffPhysArrays = true);
201  void FindPeriodicEdges(
203  const std::string &variable);
204 
205  bool IsLeftAdjacentEdge(const int n, const int e);
206 
207  virtual void v_GetFwdBwdTracePhys(
208  const Array<OneD, const NekDouble> &field,
211  virtual void v_GetFwdBwdTracePhys(
214  virtual void v_AddTraceIntegral(
217  Array<OneD, NekDouble> &outarray);
218  virtual void v_AddTraceIntegral(
220  Array<OneD, NekDouble> &outarray);
221  virtual void v_AddFwdBwdTraceIntegral(
222  const Array<OneD, const NekDouble> &Fwd,
223  const Array<OneD, const NekDouble> &Bwd,
224  Array<OneD, NekDouble> &outarray);
225  virtual void v_ExtractTracePhys(
226  const Array<OneD, const NekDouble> &inarray,
227  Array<OneD, NekDouble> &outarray);
228  virtual void v_ExtractTracePhys(
229  Array<OneD, NekDouble> &outarray);
230  virtual void v_HelmSolve(
231  const Array<OneD, const NekDouble> &inarray,
232  Array<OneD, NekDouble> &outarray,
233  const FlagList &flags,
234  const StdRegions::ConstFactorMap &factors,
235  const StdRegions::VarCoeffMap &varcoeff,
236  const MultiRegions::VarFactorsMap &varfactors,
237  const Array<OneD, const NekDouble> &dirForcing,
238  const bool PhysSpaceForcing);
239  virtual void v_GeneralMatrixOp(
240  const GlobalMatrixKey &gkey,
241  const Array<OneD,const NekDouble> &inarray,
242  Array<OneD, NekDouble> &outarray,
243  CoeffState coeffstate = eLocal);
244  virtual void v_GetBoundaryToElmtMap(
245  Array<OneD, int> &ElmtID,
246  Array<OneD, int> &EdgeID);
247  virtual void v_GetBndElmtExpansion(int i,
248  std::shared_ptr<ExpList> &result,
249  const bool DeclareCoeffPhysArrays);
250  virtual void v_Reset();
251 
252  /**
253  * @brief Obtain a copy of the periodic edges and vertices for this
254  * field.
255  */
256  virtual void v_GetPeriodicEntities(
257  PeriodicMap &periodicVerts,
258  PeriodicMap &periodicEdges,
259  PeriodicMap &periodicFaces)
260  {
261  boost::ignore_unused(periodicFaces);
262  periodicVerts = m_periodicVerts;
263  periodicEdges = m_periodicEdges;
264  }
265 
266 
268  {
269  return m_traceMap;
270  }
271 
274  {
275  return m_bndCondExpansions;
276  }
277 
278  virtual const
281  {
282  return m_bndConditions;
283  }
284 
287  {
288  return m_bndCondExpansions[i];
289  }
290 
293  {
294  return m_bndConditions;
295  }
296 
297  virtual void v_EvaluateBoundaryConditions(
298  const NekDouble time = 0.0,
299  const std::string varName = "",
302 
303  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo();
304  };
305 
306  typedef std::shared_ptr<DisContField2D> DisContField2DSharedPtr;
307  } //end of namespace
308 } //end of namespace
309 
310 #endif // MULTIERGIONS_DISCONTFIELD2D_H
virtual AssemblyMapDGSharedPtr & v_GetTraceMap()
std::shared_ptr< DisContField2D > DisContField2DSharedPtr
virtual void v_ExtractTracePhys(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This method extracts the trace (edges in 2D) from the field inarray and puts the values in outarray...
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
void FindPeriodicEdges(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic edges and vertices for the given graph.
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
Local coefficients.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1550
virtual void v_GetPeriodicEntities(PeriodicMap &periodicVerts, PeriodicMap &periodicEdges, PeriodicMap &periodicFaces)
Obtain a copy of the periodic edges and vertices for this field.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Array< OneD, Array< OneD, unsigned int > > m_mapEdgeToElmn
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
std::shared_ptr< LocTraceToTraceMap > LocTraceToTraceMapSharedPtr
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 MultiRegions::VarFactorsMap &varfactors, const Array< OneD, const NekDouble > &dirForcing, const bool PhysSpaceForcing)
Array< OneD, Array< OneD, unsigned int > > m_signEdgeToElmn
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
#define MULTI_REGIONS_EXPORT
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:50
PeriodicMap m_periodicEdges
A map which identifies pairs of periodic edges.
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
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.
virtual std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
Search through the edge expansions and identify which ones have Robin/Mixed type boundary conditions...
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
virtual Array< OneD, SpatialDomains::BoundaryConditionShPtr > & v_UpdateBndConditions()
Array< OneD, LibUtilities::BasisSharedPtr > m_base
bool SameTypeOfBoundaryConditions(const DisContField2D &In)
DisContField2D()
Default constructor.
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
Array< OneD, StdRegions::Orientation > m_edgedir
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)
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions()
virtual ~DisContField2D()
Default destructor.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
virtual MultiRegions::ExpListSharedPtr & v_UpdateBndCondExpansion(int i)
std::set< int > m_boundaryEdges
A set storing the global IDs of any boundary edges.
std::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
Definition: GlobalLinSys.h:57
virtual ExpListSharedPtr & v_GetTrace()
double NekDouble
Defines a list of flags.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
bool IsLeftAdjacentEdge(const int n, const int e)
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
static const NekDouble kNekUnsetDouble
Describe a linear system.
Describes a matrix with ordering defined by a local to global map.
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
virtual void v_GetBndElmtExpansion(int i, std::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Definition: ExpList2D.h:57
const Array< OneD, const LibUtilities::BasisSharedPtr > & GetBase() const
This function gets the shared point to basis.
virtual void v_GetFwdBwdTracePhys(const Array< OneD, const NekDouble > &field, 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...
void EvaluateHDGPostProcessing(Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
std::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:48
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 vecto...
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph2D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable, const bool DeclareCoeffPhysArrays=true)
This function discretises the boundary conditions by setting up a list of one-dimensional boundary ex...
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Set up a list of element IDs and edge IDs that link to the boundary conditions.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
NekDouble L2_DGDeriv(const int dir, const Array< OneD, const NekDouble > &soln)
Calculate the error of the derivative using the consistent DG evaluation of .
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap