Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Field definition in two-dimensions for a discontinuous LDG-H
33 // expansion.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD2D_H
38 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD2D_H
39 
42 #include <MultiRegions/ExpList2D.h>
47 
48 namespace Nektar
49 {
50  namespace MultiRegions
51  {
52  class DisContField2D : public ExpList2D
53  {
54  public:
56 
60  const std::string &variable,
61  const bool SetUpJustDG = true,
62  const bool DeclareCoeffPhysArrays = true,
65 
67  const DisContField2D &In,
69  const std::string &variable,
70  const bool SetUpJustDG = false,
71  const bool DeclareCoeffPhysArrays = true);
72 
74  const DisContField2D &In,
75  const bool DeclareCoeffPhysArrays = true);
76 
78 
80  const GlobalLinSysKey &mkey);
81 
83  const int dir,
84  const Array<OneD, const NekDouble> &soln);
85 
87  Array<OneD, NekDouble> &outarray);
88 
90  {
92  {
93  SetUpDG();
94  }
95 
96  return m_trace;
97  }
98 
101 
102  protected:
103 
104  Array<OneD, LibUtilities::BasisSharedPtr> m_base; /**< Bases needed for the expansion */
105 
106  /** \brief This function gets the shared point to basis
107  *
108  * \return returns the shared pointer to the bases
109  */
111  {
112  return(m_base);
113  }
114 
115  /** \brief This function returns the type of basis used in the \a dir
116  * direction
117  *
118  * The different types of bases implemented in the code are defined
119  * in the LibUtilities::BasisType enumeration list. As a result, the
120  * function will return one of the types of this enumeration list.
121  *
122  * \param dir the direction
123  * \return returns the type of basis used in the \a dir direction
124  */
125  inline LibUtilities::BasisType GetBasisType(const int dir) const
126  {
127  ASSERTL1(dir < m_base.num_elements(), "dir is larger than m_numbases");
128  return(m_base[dir]->GetBasisType());
129  }
130 
131  /**
132  * @brief An object which contains the discretised boundary
133  * conditions.
134  *
135  * It is an array of size equal to the number of boundary regions
136  * and consists of entries of the type MultiRegions#ExpList1D. Every
137  * entry corresponds to the one-dimensional spectral/hp expansion on
138  * a single boundary region. The values of the boundary conditions
139  * are stored as the coefficients of the one-dimensional expansion.
140  */
142 
143  /**
144  * @brief An array which contains the information about
145  * the boundary condition on the different boundary regions.
146  */
148 
152 
153  /**
154  * Map of local trace (the points at the face of
155  * the element) to the trace space discretisation
156  */
158 
162 
163  /**
164  * @brief A set storing the global IDs of any boundary edges.
165  */
166  std::set<int> m_boundaryEdges;
167 
168  /**
169  * @brief A map which identifies groups of periodic vertices.
170  */
172 
173  /**
174  * @brief A map which identifies pairs of periodic edges.
175  */
177 
178 
179  /**
180  * @brief A vector indicating degress of freedom which need to be
181  * copied from forwards to backwards space in case of a periodic
182  * boundary condition.
183  */
184  std::vector<int> m_periodicFwdCopy;
185  std::vector<int> m_periodicBwdCopy;
186 
187  /*
188  * @brief A map identifying which edges are left- and right-adjacent
189  * for DG.
190  */
191  std::vector<bool> m_leftAdjacentEdges;
192 
193  void SetUpDG(const std::string = "DefaultVar");
194  bool SameTypeOfBoundaryConditions(const DisContField2D &In);
196  const SpatialDomains::MeshGraphSharedPtr &graph2D,
198  const std::string &variable,
199  const bool DeclareCoeffPhysArrays = true);
200  void FindPeriodicEdges(
202  const std::string &variable);
203 
204  bool IsLeftAdjacentEdge(const int n, const int e);
205 
206  virtual void v_GetFwdBwdTracePhys(
207  const Array<OneD, const NekDouble> &field,
210  virtual void v_GetFwdBwdTracePhys(
213  virtual void v_AddTraceIntegral(
216  Array<OneD, NekDouble> &outarray);
217  virtual void v_AddTraceIntegral(
219  Array<OneD, NekDouble> &outarray);
220  virtual void v_AddFwdBwdTraceIntegral(
221  const Array<OneD, const NekDouble> &Fwd,
222  const Array<OneD, const NekDouble> &Bwd,
223  Array<OneD, NekDouble> &outarray);
224  virtual void v_ExtractTracePhys(
225  const Array<OneD, const NekDouble> &inarray,
226  Array<OneD, NekDouble> &outarray);
227  virtual void v_ExtractTracePhys(
228  Array<OneD, NekDouble> &outarray);
229  virtual void v_HelmSolve(
230  const Array<OneD, const NekDouble> &inarray,
231  Array<OneD, NekDouble> &outarray,
232  const FlagList &flags,
233  const StdRegions::ConstFactorMap &factors,
234  const StdRegions::VarCoeffMap &varcoeff,
235  const Array<OneD, const NekDouble> &dirForcing,
236  const bool PhysSpaceForcing);
237  virtual void v_GeneralMatrixOp(
238  const GlobalMatrixKey &gkey,
239  const Array<OneD,const NekDouble> &inarray,
240  Array<OneD, NekDouble> &outarray,
241  CoeffState coeffstate = eLocal);
242  virtual void v_GetBoundaryToElmtMap(
243  Array<OneD, int> &ElmtID,
244  Array<OneD, int> &EdgeID);
245  virtual void v_GetBndElmtExpansion(int i,
246  boost::shared_ptr<ExpList> &result,
247  const bool DeclareCoeffPhysArrays);
248  virtual void v_Reset();
249 
250  /**
251  * @brief Obtain a copy of the periodic edges and vertices for this
252  * field.
253  */
254  virtual void v_GetPeriodicEntities(
255  PeriodicMap &periodicVerts,
256  PeriodicMap &periodicEdges,
257  PeriodicMap &periodicFaces)
258  {
259  periodicVerts = m_periodicVerts;
260  periodicEdges = m_periodicEdges;
261  }
262 
263 
265  {
266  return m_traceMap;
267  }
268 
271  {
272  return m_bndCondExpansions;
273  }
274 
275  virtual const
278  {
279  return m_bndConditions;
280  }
281 
284  {
285  return m_bndCondExpansions[i];
286  }
287 
290  {
291  return m_bndConditions;
292  }
293 
294  virtual void v_EvaluateBoundaryConditions(
295  const NekDouble time = 0.0,
296  const std::string varName = "",
299 
300  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo();
301  };
302 
303  typedef boost::shared_ptr<DisContField2D> DisContField2DSharedPtr;
304  } //end of namespace
305 } //end of namespace
306 
307 #endif // MULTIERGIONS_DISCONTFIELD2D_H
boost::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:49
virtual AssemblyMapDGSharedPtr & v_GetTraceMap()
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...
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:1477
virtual void v_GetPeriodicEntities(PeriodicMap &periodicVerts, PeriodicMap &periodicEdges, PeriodicMap &periodicFaces)
Obtain a copy of the periodic edges and vertices for this field.
Array< OneD, Array< OneD, unsigned int > > m_mapEdgeToElmn
const Array< OneD, const LibUtilities::BasisSharedPtr > & GetBase() const
This function gets the shared point to basis.
LibUtilities::BasisType GetBasisType(const int dir) const
This function returns the type of basis used in the dir direction.
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
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)
PeriodicMap m_periodicEdges
A map which identifies pairs of periodic edges.
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:252
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.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
virtual std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
Search through the edge expansions and identify which ones have Robin/Mixed type boundary conditions...
boost::shared_ptr< LocTraceToTraceMap > LocTraceToTraceMapSharedPtr
virtual void v_GetBndElmtExpansion(int i, boost::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
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:227
virtual MultiRegions::ExpListSharedPtr & v_UpdateBndCondExpansion(int i)
std::set< int > m_boundaryEdges
A set storing the global IDs of any boundary edges.
virtual ExpListSharedPtr & v_GetTrace()
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)
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< DisContField2D > DisContField2DSharedPtr
boost::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
Definition: GlobalLinSys.h:59
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.
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Definition: ExpList2D.h:60
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.
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:52
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:228
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:442
NekDouble L2_DGDeriv(const int dir, const Array< OneD, const NekDouble > &soln)
Calculate the error of the derivative using the consistent DG evaluation of .