Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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,
70 
71  /// Constructor for a DisContField1D from a List of subdomains
72  /// New Constructor for arterial network
76  const SpatialDomains::CompositeMap& domain,
78  const std::string &variable,
79  bool SetToOneSpaceDimensions = false,
82 
83  /// Constructs a 1D discontinuous field based on an existing field.
84  MULTI_REGIONS_EXPORT DisContField1D(const DisContField1D &In);
85 
86  /// Constructs a 1D discontinuous field based on an existing field.
87  /// (needed in order to use ContField( const ExpList1D &In) constructor
89 
90  /// Destructor.
92 
93  /// For a given key, returns the associated global linear system.
95  const GlobalLinSysKey &mkey);
96 
97 
98  // Return the internal vector which directs whether the normal flux
99  // at the trace defined by Left and Right Adjacent elements
100  // is negated with respect to the segment normal
101  MULTI_REGIONS_EXPORT std::vector<bool> &GetNegatedFluxNormal(void);
102 
103  protected:
104  /// The number of boundary segments on which Dirichlet boundary
105  /// conditions are imposed.
107 
108  /// Discretised boundary conditions.
109  /**
110  * It is an array of size equal to the number of boundary points
111  * and consists of entries of the type LocalRegions#PointExp. Every
112  * entry corresponds to a point on a single boundary region.
113  */
115 
116  /// An array which contains the information about the boundary
117  /// condition on the different boundary regions.
119 
120  /// Global boundary matrix.
122 
123  /// Trace space storage for points between elements.
125 
126  /// Local to global DG mapping for trace space.
128 
129  /**
130  * @brief A set storing the global IDs of any boundary edges.
131  */
132  std::set<int> m_boundaryVerts;
133 
134 
135  /**
136  * @brief A map which identifies groups of periodic vertices.
137  */
139 
140 
141  /**
142  * @brief A vector indicating degress of freedom which need to be
143  * copied from forwards to backwards space in case of a periodic
144  * boundary condition.
145  */
146  std::vector<int> m_periodicFwdCopy;
147  std::vector<int> m_periodicBwdCopy;
148 
149 
150  /*
151  * @brief A map identifying which verts are left- and right-adjacent
152  * for DG.
153  */
154  std::vector<bool> m_leftAdjacentVerts;
155 
156 
157  /// Discretises the boundary conditions.
159  const SpatialDomains::MeshGraphSharedPtr &graph1D,
161  const std::string variable);
162 
163 
164  /// Generate a associative map of periodic vertices in a mesh.
166  const std::string variable);
167 
169  {
170  return m_trace;
171  }
172 
174  {
175  return m_traceMap;
176  }
177 
178  virtual void v_AddTraceIntegral(
180  Array<OneD, NekDouble> &outarray);
181  virtual void v_GetFwdBwdTracePhys(
184  virtual void v_GetFwdBwdTracePhys(
185  const Array<OneD, const NekDouble> &field,
188  virtual void v_ExtractTracePhys(
189  Array<OneD, NekDouble> &outarray);
190  virtual void v_ExtractTracePhys(
191  const Array<OneD, const NekDouble> &inarray,
192  Array<OneD, NekDouble> &outarray);
193 
194  /// Populates the list of boundary condition expansions.
196  const SpatialDomains::MeshGraphSharedPtr &graph1D,
198  const std::string variable,
200  &bndCondExpansions,
201  Array<OneD, SpatialDomains
202  ::BoundaryConditionShPtr> &bndConditions);
203 
204  /// Populates the list of boundary condition expansions in multidomain case.
206  const SpatialDomains::MeshGraphSharedPtr &graph1D,
208  const std::string variable,
210  &bndCondExpansions,
211  Array<OneD, SpatialDomains
212  ::BoundaryConditionShPtr> &bndConditions,
213  int subdomain);
214 
215  void GenerateFieldBnd1D(
217  const std::string variable);
218 
219  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo();
220 
223  {
224  return m_bndCondExpansions;
225  }
226 
229  {
230  return m_bndConditions;
231  }
232 
235  {
236  return m_bndCondExpansions[i];
237  }
238 
241  {
242  return m_bndConditions;
243  }
244 
245  virtual void v_GetBoundaryToElmtMap(
246  Array<OneD,int> &ElmtID, Array<OneD,int> &VertID);
247  virtual void v_GetBndElmtExpansion(int i,
248  boost::shared_ptr<ExpList> &result,
249  const bool DeclareCoeffPhysArrays);
250  virtual void v_Reset();
251 
252  /// Evaluate all boundary conditions at a given time..
253  virtual void v_EvaluateBoundaryConditions(
254  const NekDouble time = 0.0,
255  const std::string varName = "",
258 
259  /// Solve the Helmholtz equation.
260  virtual void v_HelmSolve(
261  const Array<OneD, const NekDouble> &inarray,
262  Array<OneD, NekDouble> &outarray,
263  const FlagList &flags,
264  const StdRegions::ConstFactorMap &factors,
265  const StdRegions::VarCoeffMap &varcoeff,
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 boost::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_GetBndElmtExpansion(int i, boost::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
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..
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 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
SpatialDomains::BoundaryConditionsSharedPtr GetDomainBCs(const SpatialDomains::CompositeMap &domain, const SpatialDomains::BoundaryConditions &Allbcs, const std::string &variable)
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:252
void SetUpDG(const std::string &variable)
void GenerateFieldBnd1D(SpatialDomains::BoundaryConditions &bcs, const std::string variable)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
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:227
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
Definition: GlobalLinSys.h:59
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
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
static const NekDouble kNekUnsetDouble
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)
Solve the Helmholtz equation.
Describe a linear system.
std::map< int, Composite > CompositeMap
Definition: MeshGraph.h:115
virtual ExpListSharedPtr & v_GetTrace()
bool IsLeftAdjacentVertex(const int n, const int e)
GlobalLinSysMapShPtr m_globalBndMat
Global boundary matrix.
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.
boost::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition: Conditions.h:284
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.
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:52
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:219
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:442
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)