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 // 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 one-dimension for a discontinuous
32 // LDG-H expansion
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
37 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
38 
41 #include <MultiRegions/ExpList1D.h>
45 
46 
47 namespace Nektar
48 {
49  namespace MultiRegions
50  {
51  /// This class is the abstraction of a global discontinuous two-
52  /// dimensional spectral/hp element expansion which approximates the
53  /// solution of a set of partial differential equations.
54  class DisContField1D: public ExpList1D
55  {
56  public:
57  /// Default constructor.
59 
60  /// Constructs a 1D discontinuous field based on a mesh and boundary
61  /// conditions.
65  const std::string &variable,
66  const bool SetUpJustDG = true,
69 
70  /// Constructor for a DisContField1D from a List of subdomains
71  /// New Constructor for arterial network
75  const SpatialDomains::CompositeMap& domain,
77  const std::string &variable,
78  bool SetToOneSpaceDimensions = false,
81 
82  /// Constructs a 1D discontinuous field based on an existing field.
83  MULTI_REGIONS_EXPORT DisContField1D(const DisContField1D &In);
84 
85  /// Constructs a 1D discontinuous field based on an existing field.
86  /// (needed in order to use ContField( const ExpList1D &In) constructor
88 
89  /// Destructor.
91 
92  /// For a given key, returns the associated global linear system.
94  const GlobalLinSysKey &mkey);
95 
96 
97  // Return the internal vector which directs whether the normal flux
98  // at the trace defined by Left and Right Adjacent elements
99  // is negated with respect to the segment normal
100  MULTI_REGIONS_EXPORT std::vector<bool> &GetNegatedFluxNormal(void);
101 
102  protected:
103  /// The number of boundary segments on which Dirichlet boundary
104  /// conditions are imposed.
106 
107  /// Discretised boundary conditions.
108  /**
109  * It is an array of size equal to the number of boundary points
110  * and consists of entries of the type LocalRegions#PointExp. Every
111  * entry corresponds to a point on a single boundary region.
112  */
114 
115  /// An array which contains the information about the boundary
116  /// condition on the different boundary regions.
118 
119  /// Global boundary matrix.
121 
122  /// Trace space storage for points between elements.
124 
125  /// Local to global DG mapping for trace space.
127 
128  /**
129  * @brief A set storing the global IDs of any boundary edges.
130  */
131  std::set<int> m_boundaryVerts;
132 
133 
134  /**
135  * @brief A map which identifies groups of periodic vertices.
136  */
138 
139 
140  /**
141  * @brief A vector indicating degress of freedom which need to be
142  * copied from forwards to backwards space in case of a periodic
143  * boundary condition.
144  */
145  std::vector<int> m_periodicFwdCopy;
146  std::vector<int> m_periodicBwdCopy;
147 
148 
149  /*
150  * @brief A map identifying which verts are left- and right-adjacent
151  * for DG.
152  */
153  std::vector<bool> m_leftAdjacentVerts;
154 
155 
156  /// Discretises the boundary conditions.
158  const SpatialDomains::MeshGraphSharedPtr &graph1D,
160  const std::string variable);
161 
162 
163  /// Generate a associative map of periodic vertices in a mesh.
165  const std::string variable);
166 
168  {
169  return m_trace;
170  }
171 
173  {
174  return m_traceMap;
175  }
176 
177  virtual void v_AddTraceIntegral(
179  Array<OneD, NekDouble> &outarray);
180  virtual void v_GetFwdBwdTracePhys(
183  virtual void v_GetFwdBwdTracePhys(
184  const Array<OneD, const NekDouble> &field,
187  virtual void v_ExtractTracePhys(
188  Array<OneD, NekDouble> &outarray);
189  virtual void v_ExtractTracePhys(
190  const Array<OneD, const NekDouble> &inarray,
191  Array<OneD, NekDouble> &outarray);
192 
193  /// Populates the list of boundary condition expansions.
195  const SpatialDomains::MeshGraphSharedPtr &graph1D,
197  const std::string variable,
199  &bndCondExpansions,
200  Array<OneD, SpatialDomains
201  ::BoundaryConditionShPtr> &bndConditions);
202 
203  /// Populates the list of boundary condition expansions in multidomain case.
205  const SpatialDomains::MeshGraphSharedPtr &graph1D,
207  const std::string variable,
209  &bndCondExpansions,
210  Array<OneD, SpatialDomains
211  ::BoundaryConditionShPtr> &bndConditions,
212  int subdomain);
213 
214  void GenerateFieldBnd1D(
216  const std::string variable);
217 
218  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo();
219 
222  {
223  return m_bndCondExpansions;
224  }
225 
228  {
229  return m_bndConditions;
230  }
231 
234  {
235  return m_bndCondExpansions[i];
236  }
237 
240  {
241  return m_bndConditions;
242  }
243 
244  virtual void v_GetBoundaryToElmtMap(
245  Array<OneD,int> &ElmtID, Array<OneD,int> &VertID);
246  virtual void v_GetBndElmtExpansion(int i,
247  std::shared_ptr<ExpList> &result,
248  const bool DeclareCoeffPhysArrays);
249  virtual void v_Reset();
250 
251  /// Evaluate all boundary conditions at a given time..
252  virtual void v_EvaluateBoundaryConditions(
253  const NekDouble time = 0.0,
254  const std::string varName = "",
257 
258  /// Solve the Helmholtz equation.
259  virtual void v_HelmSolve(
260  const Array<OneD, const NekDouble> &inarray,
261  Array<OneD, NekDouble> &outarray,
262  const FlagList &flags,
263  const StdRegions::ConstFactorMap &factors,
264  const StdRegions::VarCoeffMap &varcoeff,
265  const MultiRegions::VarFactorsMap &varfactors,
266  const Array<OneD, const NekDouble> &dirForcing,
267  const bool PhysSpaceForcing);
268 
269  private:
270  void SetUpDG(const std::string &variable);
271 
272  bool IsLeftAdjacentVertex(const int n, const int e);
273 
274  std::vector<bool> m_negatedFluxNormal;
275 
278  const std::string &variable);
279  };
280 
281  typedef std::shared_ptr<DisContField1D> DisContField1DSharedPtr;
282  } //end of namespace
283 } //end of namespace
284 
285 #endif // MULTIERGIONS_DISCONTFIELD1D_H
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions()
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)
Solve the Helmholtz equation.
int m_numDirBndCondExpansions
The number of boundary segments on which Dirichlet boundary conditions are imposed.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
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 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::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:289
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
virtual std::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
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:50
SpatialDomains::BoundaryConditionsSharedPtr GetDomainBCs(const SpatialDomains::CompositeMap &domain, const SpatialDomains::BoundaryConditions &Allbcs, const std::string &variable)
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:137
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
void SetUpDG(const std::string &variable)
virtual void v_GetBndElmtExpansion(int i, std::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
void GenerateFieldBnd1D(SpatialDomains::BoundaryConditions &bcs, const std::string variable)
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.
virtual void v_ExtractTracePhys(Array< OneD, NekDouble > &outarray)
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
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.
DisContField1D()
Default constructor.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
std::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
Definition: GlobalLinSys.h:57
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.
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
static const NekDouble kNekUnsetDouble
Describe a linear system.
std::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:219
virtual ExpListSharedPtr & v_GetTrace()
bool IsLeftAdjacentVertex(const int n, const int e)
GlobalLinSysMapShPtr m_globalBndMat
Global boundary matrix.
std::shared_ptr< DisContField1D > DisContField1DSharedPtr
std::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.
This class is the abstraction of a one-dimensional multi-elemental expansions which is merely a colle...
Definition: ExpList1D.h:58
ExpListSharedPtr m_trace
Trace space storage for points between elements.
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< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:48
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &VertID)