Nektar++
DisContField3D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File DisContField3D.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 three-dimensions for a discontinuous
32 // LDG-H expansion
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3D_H
37 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3D_H
38 
41 #include <MultiRegions/ExpList3D.h>
46 
47 namespace Nektar
48 {
49  namespace MultiRegions
50  {
51  class AssemblyMapDG;
52 
53 
54  class DisContField3D : public ExpList3D
55  {
56  public:
58 
62  const std::string &variable,
63  const bool SetUpJustDG = true,
66 
68  const DisContField3D &In,
70  const std::string &variable,
71  const bool SetUpJustDG = false);
72 
73  /// Constructs a global discontinuous field based on another
74  /// discontinuous field.
75  MULTI_REGIONS_EXPORT DisContField3D(const DisContField3D &In);
76 
77  /// Destructor.
79 
81  const GlobalLinSysKey &mkey);
82 
83 
85  Array<OneD, NekDouble> &outarray);
86 
88  {
89  return m_leftAdjacentFaces[cnt];
90  }
91 
94 
95  protected:
96  /**
97  * @brief An object which contains the discretised boundary
98  * conditions.
99  *
100  * It is an array of size equal to the number of boundary regions
101  * and consists of entries of the type MultiRegions#ExpList2D. Every
102  * entry corresponds to the two-dimensional spectral/hp expansion on
103  * a single boundary region. The values of the boundary conditions
104  * are stored as the coefficients of the two-dimensional expansion.
105  */
107 
108  /**
109  * @brief An array which contains the information about
110  * the boundary condition on the different boundary regions.
111  */
113 
117  /// Map of local trace (the points at the face of the
118  /// element) to the trace space discretisation
120 
121  /**
122  * @brief A set storing the global IDs of any boundary faces.
123  */
124  std::set<int> m_boundaryFaces;
125 
126  /**
127  * @brief A map which identifies pairs of periodic faces.
128  */
130 
131  /**
132  * @brief A map which identifies groups of periodic edges.
133  */
135 
136  /**
137  * @brief A map which identifies groups of periodic vertices.
138  */
140 
141  /*
142  * @brief A map identifying which faces are left- and right-adjacent
143  * for DG.
144  */
145  std::vector<bool> m_leftAdjacentFaces;
146 
147  /**
148  * @brief A vector indicating degress of freedom which need to be
149  * copied from forwards to backwards space in case of a periodic
150  * boundary condition.
151  */
152  std::vector<int> m_periodicFwdCopy;
153  std::vector<int> m_periodicBwdCopy;
154 
155  void SetUpDG(const std::string = "DefaultVar");
156  bool SameTypeOfBoundaryConditions(const DisContField3D &In);
158  const SpatialDomains::MeshGraphSharedPtr &graph3D,
160  const std::string &variable);
161  void FindPeriodicFaces(
163  const std::string &variable);
164 
165  bool IsLeftAdjacentFace(const int n, const int e);
166 
167  virtual void v_GetFwdBwdTracePhys(
169  Array<OneD,NekDouble> &Bwd);
170  virtual void v_GetFwdBwdTracePhys(
171  const Array<OneD,const NekDouble> &field,
174  virtual const std::vector<bool> &v_GetLeftAdjacentFaces(void) const;
175  virtual void v_ExtractTracePhys(
176  Array<OneD, NekDouble> &outarray);
177  virtual void v_ExtractTracePhys(
178  const Array<OneD, const NekDouble> &inarray,
179  Array<OneD, NekDouble> &outarray);
180  virtual void v_AddTraceIntegral(
182  Array<OneD, NekDouble> &outarray);
183  virtual void v_AddFwdBwdTraceIntegral(
184  const Array<OneD, const NekDouble> &Fwd,
185  const Array<OneD, const NekDouble> &Bwd,
186  Array<OneD, NekDouble> &outarray);
187  virtual void v_HelmSolve(
188  const Array<OneD, const NekDouble> &inarray,
189  Array<OneD, NekDouble> &outarray,
190  const FlagList &flags,
191  const StdRegions::ConstFactorMap &factors,
192  const StdRegions::VarCoeffMap &varcoeff,
193  const MultiRegions::VarFactorsMap &varfactors,
194  const Array<OneD, const NekDouble> &dirForcing,
195  const bool PhysSpaceForcing);
196 
197  virtual void v_GeneralMatrixOp(
198  const GlobalMatrixKey &gkey,
199  const Array<OneD,const NekDouble> &inarray,
200  Array<OneD, NekDouble> &outarray,
201  CoeffState coeffstate = eLocal);
202  virtual void v_GetBoundaryToElmtMap(
203  Array<OneD, int> &ElmtID,
204  Array<OneD, int> &FaceID);
205  virtual void v_GetBndElmtExpansion(int i,
206  std::shared_ptr<ExpList> &result,
207  const bool DeclareCoeffPhysArrays);
208  virtual void v_Reset();
209 
210  /*
211  * @brief Obtain a copy of the periodic edges and vertices for this
212  * field.
213  */
214  virtual void v_GetPeriodicEntities(
215  PeriodicMap &periodicVerts,
216  PeriodicMap &periodicEdges,
217  PeriodicMap &periodicFaces)
218  {
219  periodicVerts = m_periodicVerts;
220  periodicEdges = m_periodicEdges;
221  periodicFaces = m_periodicFaces;
222  }
223 
225  {
226  if(m_trace == NullExpListSharedPtr)
227  {
228  SetUpDG();
229  }
230 
231  return m_trace;
232  }
233 
235  {
236  return m_traceMap;
237  }
238 
241  {
242  return m_bndCondExpansions;
243  }
244 
245  virtual const
248  {
249  return m_bndConditions;
250  }
251 
254  {
255  return m_bndCondExpansions[i];
256  }
257 
260  {
261  return m_bndConditions;
262  }
263 
264  virtual void v_EvaluateBoundaryConditions(
265  const NekDouble time = 0.0,
266  const std::string varName = "",
269 
270  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo();
271  };
272 
273  typedef std::shared_ptr<DisContField3D> DisContField3DSharedPtr;
274  } //end of namespace
275 } //end of namespace
276 
277 #endif // MULTIERGIONS_DISCONTFIELD3D_H
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
std::shared_ptr< DisContField3D > DisContField3DSharedPtr
virtual void v_ExtractTracePhys(Array< OneD, NekDouble > &outarray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
Local coefficients.
static ExpListSharedPtr NullExpListSharedPtr
Definition: ExpList.h:1550
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
bool IsLeftAdjacentFace(const int n, const int e)
std::shared_ptr< LocTraceToTraceMap > LocTraceToTraceMapSharedPtr
virtual const std::vector< bool > & v_GetLeftAdjacentFaces(void) const
#define MULTI_REGIONS_EXPORT
std::set< int > m_boundaryFaces
A set storing the global IDs of any boundary faces.
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:50
virtual Array< OneD, SpatialDomains::BoundaryConditionShPtr > & v_UpdateBndConditions()
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
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...
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
void EvaluateHDGPostProcessing(Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
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 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.
virtual MultiRegions::ExpListSharedPtr & v_UpdateBndCondExpansion(int i)
virtual AssemblyMapDGSharedPtr & v_GetTraceMap()
void FindPeriodicFaces(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic faces, edges and vertices for the given graph.
virtual std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
DisContField3D()
Default constructor.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
std::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
Definition: GlobalLinSys.h:57
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph3D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
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...
double NekDouble
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
bool SameTypeOfBoundaryConditions(const DisContField3D &In)
Defines a list of flags.
virtual void v_GetBndElmtExpansion(int i, std::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
static const NekDouble kNekUnsetDouble
Describe a linear system.
Describes a matrix with ordering defined by a local to global map.
virtual ExpListSharedPtr & v_GetTrace()
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
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.
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
Abstraction of a three-dimensional multi-elemental expansion which is merely a collection of local ex...
Definition: ExpList3D.h:48
std::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:48
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
virtual void v_GetPeriodicEntities(PeriodicMap &periodicVerts, PeriodicMap &periodicEdges, PeriodicMap &periodicFaces)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
Add trace contributions into elemental coefficient spaces.
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
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)