Nektar++
DisContField1D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File DisContField1D.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 one-dimension for a discontinuous
33 // LDG-H expansion
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
38 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
39 
42 #include <MultiRegions/ExpList1D.h>
46 
47 
48 namespace Nektar
49 {
50  namespace MultiRegions
51  {
52  /// This class is the abstraction of a global discontinuous two-
53  /// dimensional spectral/hp element expansion which approximates the
54  /// solution of a set of partial differential equations.
55  class DisContField1D: public ExpList1D
56  {
57  public:
58  /// Default constructor.
60 
61  /// Constructs a 1D discontinuous field based on a mesh and boundary
62  /// conditions.
66  const std::string &variable,
67  const bool SetUpJustDG = true);
68 
69  /// Constructor for a DisContField1D from a List of subdomains
70  /// New Constructor for arterial network
74  const SpatialDomains::CompositeMap& domain,
76  const std::string &variable,
77  bool SetToOneSpaceDimensions = false);
78 
79  /// Constructs a 1D discontinuous field based on an existing field.
80  MULTI_REGIONS_EXPORT DisContField1D(const DisContField1D &In);
81 
82  /// Constructs a 1D discontinuous field based on an existing field.
83  /// (needed in order to use ContField( const ExpList1D &In) constructor
85 
86  /// Destructor.
88 
89  /// For a given key, returns the associated global linear system.
91  const GlobalLinSysKey &mkey);
92 
93 
94  // Return the internal vector which directs whether the normal flux
95  // at the trace defined by Left and Right Adjacent elements
96  // is negated with respect to the segment normal
97  MULTI_REGIONS_EXPORT vector<bool> &GetNegatedFluxNormal(void);
98 
99  protected:
100  /// The number of boundary segments on which Dirichlet boundary
101  /// conditions are imposed.
103 
104  /// Discretised boundary conditions.
105  /**
106  * It is an array of size equal to the number of boundary points
107  * and consists of entries of the type LocalRegions#PointExp. Every
108  * entry corresponds to a point on a single boundary region.
109  */
111 
112  /// An array which contains the information about the boundary
113  /// condition on the different boundary regions.
115 
116  /// Global boundary matrix.
118 
119  /// Trace space storage for points between elements.
121 
122  /// Local to global DG mapping for trace space.
124 
125  /**
126  * @brief A set storing the global IDs of any boundary edges.
127  */
128  std::set<int> m_boundaryVerts;
129 
130 
131  /**
132  * @brief A map which identifies groups of periodic vertices.
133  */
135 
136 
137  /**
138  * @brief A vector indicating degress of freedom which need to be
139  * copied from forwards to backwards space in case of a periodic
140  * boundary condition.
141  */
142  vector<int> m_periodicFwdCopy;
143  vector<int> m_periodicBwdCopy;
144 
145 
146  /*
147  * @brief A map identifying which verts are left- and right-adjacent
148  * for DG.
149  */
150  vector<bool> m_leftAdjacentVerts;
151 
152 
153  /// Discretises the boundary conditions.
155  const SpatialDomains::MeshGraphSharedPtr &graph1D,
157  const std::string variable);
158 
159 
160  /// Generate a associative map of periodic vertices in a mesh.
162  const std::string variable);
163 
165  {
166  return m_trace;
167  }
168 
170  {
171  return m_traceMap;
172  }
173 
174  virtual void v_AddTraceIntegral(
176  Array<OneD, NekDouble> &outarray);
177  virtual void v_GetFwdBwdTracePhys(
180  virtual void v_GetFwdBwdTracePhys(
181  const Array<OneD, const NekDouble> &field,
184  virtual void v_ExtractTracePhys(
185  Array<OneD, NekDouble> &outarray);
186  virtual void v_ExtractTracePhys(
187  const Array<OneD, const NekDouble> &inarray,
188  Array<OneD, NekDouble> &outarray);
189 
190  /// Populates the list of boundary condition expansions.
192  const SpatialDomains::MeshGraphSharedPtr &graph1D,
194  const std::string variable,
196  &bndCondExpansions,
197  Array<OneD, SpatialDomains
198  ::BoundaryConditionShPtr> &bndConditions);
199 
200  /// Populates the list of boundary condition expansions in multidomain case.
202  const SpatialDomains::MeshGraphSharedPtr &graph1D,
204  const std::string variable,
206  &bndCondExpansions,
207  Array<OneD, SpatialDomains
208  ::BoundaryConditionShPtr> &bndConditions,
209  int subdomain);
210 
211  void GenerateFieldBnd1D(
213  const std::string variable);
214 
215  virtual map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo();
216 
219  {
220  return m_bndCondExpansions;
221  }
222 
225  {
226  return m_bndConditions;
227  }
228 
231  {
232  return m_bndCondExpansions[i];
233  }
234 
237  {
238  return m_bndConditions;
239  }
240 
241  virtual void v_GetBoundaryToElmtMap(
242  Array<OneD,int> &ElmtID, Array<OneD,int> &VertID);
243  virtual void v_Reset();
244 
245  /// Evaluate all boundary conditions at a given time..
246  virtual void v_EvaluateBoundaryConditions(
247  const NekDouble time = 0.0,
248  const std::string varName = "",
251 
252  /// Solve the Helmholtz equation.
253  virtual void v_HelmSolve(
254  const Array<OneD, const NekDouble> &inarray,
255  Array<OneD, NekDouble> &outarray,
256  const FlagList &flags,
257  const StdRegions::ConstFactorMap &factors,
258  const StdRegions::VarCoeffMap &varcoeff,
259  const Array<OneD, const NekDouble> &dirForcing);
260 
261  private:
262  void SetUpDG(const std::string &variable);
263 
264  bool IsLeftAdjacentVertex(const int n, const int e);
265 
266  vector<bool> m_negatedFluxNormal;
267 
270  const std::string &variable);
271  };
272 
273  typedef boost::shared_ptr<DisContField1D> DisContField1DSharedPtr;
274  } //end of namespace
275 } //end of namespace
276 
277 #endif // MULTIERGIONS_DISCONTFIELD1D_H
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions()
boost::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:49
int m_numDirBndCondExpansions
The number of boundary segments on which Dirichlet boundary conditions are imposed.
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)
Evaluate all boundary conditions at a given time..
std::map< int, vector< PeriodicEntity > > PeriodicMap
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
virtual map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
void FindPeriodicVertices(const SpatialDomains::BoundaryConditions &bcs, const std::string variable)
Generate a associative map of periodic vertices in a mesh.
#define MULTI_REGIONS_EXPORT
SpatialDomains::BoundaryConditionsSharedPtr GetDomainBCs(const SpatialDomains::CompositeMap &domain, const SpatialDomains::BoundaryConditions &Allbcs, const std::string &variable)
vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:248
void SetUpDG(const std::string &variable)
void GenerateFieldBnd1D(SpatialDomains::BoundaryConditions &bcs, const std::string variable)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
virtual void v_GetFwdBwdTracePhys(Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
virtual AssemblyMapDGSharedPtr & v_GetTraceMap(void)
virtual MultiRegions::ExpListSharedPtr & v_UpdateBndCondExpansion(int i)
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
For a given key, returns the associated global linear system.
void SetBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph1D, const SpatialDomains::BoundaryConditions &bcs, const std::string variable, Array< OneD, MultiRegions::ExpListSharedPtr > &bndCondExpansions, Array< OneD, SpatialDomains::BoundaryConditionShPtr > &bndConditions)
Populates the list of boundary condition expansions.
virtual void v_ExtractTracePhys(Array< OneD, NekDouble > &outarray)
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
DisContField1D()
Default constructor.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:225
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Definition: ExpList.h:1340
boost::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
Definition: GlobalLinSys.h:58
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph1D, const SpatialDomains::BoundaryConditions &bcs, const std::string variable)
Discretises the boundary conditions.
AssemblyMapDGSharedPtr m_traceMap
Local to global DG mapping for trace space.
double NekDouble
Defines a list of flags.
boost::shared_ptr< DisContField1D > DisContField1DSharedPtr
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)
Solve the Helmholtz equation.
static const NekDouble kNekUnsetDouble
Describe a linear system.
std::map< int, Composite > CompositeMap
Definition: MeshGraph.h:112
virtual ExpListSharedPtr & v_GetTrace()
bool IsLeftAdjacentVertex(const int n, const int e)
GlobalLinSysMapShPtr m_globalBndMat
Global boundary matrix.
vector< bool > & GetNegatedFluxNormal(void)
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
Discretised boundary conditions.
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
std::set< int > m_boundaryVerts
A set storing the global IDs of any boundary edges.
boost::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:269
This class is the abstraction of a one-dimensional multi-elemental expansions which is merely a colle...
Definition: ExpList1D.h:61
ExpListSharedPtr m_trace
Trace space storage for points between elements.
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:51
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:206
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:432
void SetMultiDomainBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph1D, const SpatialDomains::BoundaryConditions &bcs, const std::string variable, Array< OneD, MultiRegions::ExpListSharedPtr > &bndCondExpansions, Array< OneD, SpatialDomains::BoundaryConditionShPtr > &bndConditions, int subdomain)
Populates the list of boundary condition expansions in multidomain case.
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &VertID)