Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  */
110  Array<OneD,MultiRegions::ExpListSharedPtr> m_bndCondExpansions;
111 
112  /// An array which contains the information about the boundary
113  /// condition on the different boundary regions.
114  Array<OneD,SpatialDomains::BoundaryConditionShPtr> m_bndConditions;
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(
175  const Array<OneD, const NekDouble> &Fn,
176  Array<OneD, NekDouble> &outarray);
177  virtual void v_GetFwdBwdTracePhys(
178  Array<OneD, NekDouble> &Fwd,
179  Array<OneD, NekDouble> &Bwd);
180  virtual void v_GetFwdBwdTracePhys(
181  const Array<OneD, const NekDouble> &field,
182  Array<OneD, NekDouble> &Fwd,
183  Array<OneD, NekDouble> &Bwd);
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,
195  Array<OneD, MultiRegions::ExpListSharedPtr>
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,
205  Array<OneD, MultiRegions::ExpListSharedPtr>
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 
217  virtual const Array<OneD,const MultiRegions::ExpListSharedPtr>
219  {
220  return m_bndCondExpansions;
221  }
222 
223  virtual const Array<OneD,const SpatialDomains::BoundaryConditionShPtr>
225  {
226  return m_bndConditions;
227  }
228 
231  {
232  return m_bndCondExpansions[i];
233  }
234 
235  virtual Array<OneD, SpatialDomains::BoundaryConditionShPtr>
237  {
238  return m_bndConditions;
239  }
240 
241  virtual void v_GetBoundaryToElmtMap(
242  Array<OneD,int> &ElmtID, Array<OneD,int> &VertID);
243 
244  /// Evaluate all boundary conditions at a given time..
245  virtual void v_EvaluateBoundaryConditions(
246  const NekDouble time = 0.0,
247  const std::string varName = "",
250 
251  /// Solve the Helmholtz equation.
252  virtual void v_HelmSolve(
253  const Array<OneD, const NekDouble> &inarray,
254  Array<OneD, NekDouble> &outarray,
255  const FlagList &flags,
256  const StdRegions::ConstFactorMap &factors,
257  const StdRegions::VarCoeffMap &varcoeff,
258  const Array<OneD, const NekDouble> &dirForcing);
259 
260  private:
261  void SetUpDG(const std::string &variable);
262 
263  bool IsLeftAdjacentVertex(const int n, const int e);
264 
265  vector<bool> m_negatedFluxNormal;
266 
269  const std::string &variable);
270  };
271 
272  typedef boost::shared_ptr<DisContField1D> DisContField1DSharedPtr;
273  } //end of namespace
274 } //end of namespace
275 
276 #endif // MULTIERGIONS_DISCONTFIELD1D_H