Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DisContField3DHomogeneous1D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File DisContField3DHomogeneous1D.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 three-dimensions for a discontinuous
33 // LDG-H expansion with a homogeneous direction in 1D
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3DHOMO1D_H
38 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3DHOMO1D_H
39 
43 #include <MultiRegions/ExpList2D.h>
47 
48 
49 namespace Nektar
50 {
51  namespace MultiRegions
52  {
54  {
55  public:
57 
60  const LibUtilities::BasisKey &HomoBasis,
61  const NekDouble lhom,
62  const bool useFFT,
63  const bool dealiasing);
64 
67  const LibUtilities::BasisKey &HomoBasis,
68  const NekDouble lhom,
69  const bool useFFT,
70  const bool dealiasing,
72  const std::string &variable);
73 
74  /// Copy constructor.
76  const DisContField3DHomogeneous1D &In,
77  const bool DeclarePlanesSetCoeffPhys = true);
78 
79  /// Destructor.
81 
83  const LibUtilities::BasisKey &HomoBasis,
84  const NekDouble lhom,
86  const std::string variable);
87 
88  /**
89  * \brief This function evaluates the boundary conditions
90  * at a certaintime-level.
91  *
92  * Based on the boundary condition \f$g(\boldsymbol{x},t)\f$
93  * evaluated at a given time-level \a t, this function transforms
94  * the boundary conditions onto the coefficients of the
95  * (one-dimensional) boundary expansion.
96  * Depending on the type of boundary conditions, these expansion
97  * coefficients are calculated in different ways:
98  * - <b>Dirichlet boundary conditions</b><BR>
99  * In order to ensure global \f$C^0\f$ continuity of the
100  * spectral/hp approximation, the Dirichlet boundary conditions
101  * are projected onto the boundary expansion by means of a
102  * modified \f$C^0\f$ continuous Galerkin projection.
103  * This projection can be viewed as a collocation projection at the
104  * vertices, followed by an \f$L^2\f$ projection on the interior
105  * modes of the edges. The resulting coefficients
106  * \f$\boldsymbol{\hat{u}}^{\mathcal{D}}\f$ will be stored for the
107  * boundary expansion.
108  * - <b>Neumann boundary conditions</b>
109  * In the discrete Galerkin formulation of the problem to be
110  * solved, the Neumann boundary conditions appear as the set of
111  * surface integrals: \f[\boldsymbol{\hat{g}}=\int_{\Gamma}
112  * \phi^e_n(\boldsymbol{x})g(\boldsymbol{x})d(\boldsymbol{x})\quad
113  * \forall n \f]
114  * As a result, it are the coefficients \f$\boldsymbol{\hat{g}}\f$
115  * that will be stored in the boundary expansion
116  *
117  * \param time The time at which the boundary conditions should be
118  * evaluated
119  */
121  const NekDouble time = 0.0,
122  const std::string varName = "");
123 
124  inline const Array<OneD,const MultiRegions::ExpListSharedPtr>
126 
127  inline const Array<OneD,const SpatialDomains::
129 
130  inline boost::shared_ptr<ExpList> &UpdateBndCondExpansion(int i);
131 
132  inline Array<OneD, SpatialDomains::BoundaryConditionShPtr>&
134 
135  /// \brief Set up a list of element ids and edge ids the link to the
136  /// boundary conditions
138  Array<OneD, int> &ElmtID,
139  Array<OneD,int> &EdgeID);
140 
141  /// This funtion extract form a vector containing a full
142  /// 3D-homogenous-1D field the value associated with a
143  /// specific boundary conditions.
144  /// TotField is the full field contaning all the physical values
145  /// BndVals is the vector where the boundary physical values are
146  /// stored BndID is the identifier of the boundary region
148  Array<OneD, NekDouble> &BndVals,
149  const Array<OneD, NekDouble> &TotField,
150  int BndID);
151 
152  /// This function calculate the inner product of two vectors
153  /// (V1 and V2) respect to the basis along a boundary region.
154  /// outarray is the inner product result multiplied by the normal to
155  /// the edge (specified by the BndID)
157  Array<OneD, const NekDouble> &V1,
158  Array<OneD, const NekDouble> &V2,
159  Array<OneD, NekDouble> &outarray,
160  int BndID);
161 
162  /// Storage space for the boundary to element and boundary to trace
163  /// map. This member variable is really allocated just in case
164  /// a boundary expansion recasting is required at the solver level.
165  /// Otherwise is the 2 vectors are not filled up.
166  /// If is needed all the funcitons whihc require to use this map
167  /// do not have to recalculate it anymore.
168  Array<OneD, int> m_BCtoElmMap;
169  Array<OneD, int> m_BCtoEdgMap;
170 
171  protected:
172  /**
173  * \brief An object which contains the discretised
174  * boundary conditions.
175  *
176  * It is an array of size equal to the number of boundary
177  * regions and consists of entries of the type
178  * MultiRegions#ExpList1D. Every entry corresponds to the
179  * one-dimensional spectral/hp expansion on a single
180  * boundary region. The values of the boundary conditions
181  * are stored as the coefficients of the one-dimensional
182  * expansion.
183  */
184 
185  Array<OneD, MultiRegions::ExpListSharedPtr> m_bndCondExpansions;
186 
188 
189  Array<OneD, int> m_traceBndMap;
190 
191  /**
192  * \brief An array which contains the information about
193  * the boundary condition on the different boundary
194  * regions.
195  */
196  Array<OneD,SpatialDomains::BoundaryConditionShPtr> m_bndConditions;
197 
199  Array<OneD,int> &ElmtID,
200  Array<OneD,int> &EdgeID)
201  {
202  GetBoundaryToElmtMap(ElmtID, EdgeID);
203  }
204 
205  virtual void v_GetBCValues(
206  Array<OneD, NekDouble> &BndVals,
207  const Array<OneD, NekDouble> &TotField,
208  int BndID)
209  {
210  GetBCValues(BndVals, TotField, BndID);
211  }
212 
214  Array<OneD, const NekDouble> &V1,
215  Array<OneD, const NekDouble> &V2,
216  Array<OneD, NekDouble> &outarray,
217  int BndID)
218  {
219  NormVectorIProductWRTBase(V1,V2,outarray,BndID);
220  }
221 
222  /// Set up all DG member variables and maps
224 
225  /// @todo Fix in another way considering all the planes
227  {
228  return m_trace;
229  }
230 
231  /// @todo Fix in another way considering all the planes
233  {
234  return m_planes[0]->GetTraceMap();
235  }
236 
237  virtual const Array<OneD,const MultiRegions::ExpListSharedPtr>
239  {
240  return GetBndCondExpansions();
241  }
242 
243  virtual const
244  Array<OneD,const SpatialDomains::BoundaryConditionShPtr>
246  {
247  return GetBndConditions();
248  }
249 
250  /// @todo Fix Robin BCs for homogeneous case
251  virtual map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo()
252  {
253  return map<int, RobinBCInfoSharedPtr>();
254  }
255 
256  virtual void v_ExtractTracePhys(
257  const Array<OneD, const NekDouble> &inarray,
258  Array<OneD, NekDouble> &outarray);
259 
260  virtual void v_ExtractTracePhys(
261  Array<OneD, NekDouble> &outarray);
262 
263  private:
264  // virtual functions
265  virtual void v_HelmSolve(
266  const Array<OneD, const NekDouble> &inarray,
267  Array<OneD, NekDouble> &outarray,
268  const FlagList &flags,
269  const StdRegions::ConstFactorMap &factors,
270  const StdRegions::VarCoeffMap &varcoeff,
271  const Array<OneD, const NekDouble> &dirForcing);
272 
273  virtual void v_EvaluateBoundaryConditions(
274  const NekDouble time = 0.0,
275  const std::string varName = "",
278 
279  virtual boost::shared_ptr<ExpList> &v_UpdateBndCondExpansion(int i);
280 
281  virtual Array<OneD, SpatialDomains::BoundaryConditionShPtr>
283 
284  virtual const Array<OneD, const int> &v_GetTraceBndMap()
285  {
286  return m_traceBndMap;
287  }
288  };
289 
290  typedef boost::shared_ptr<DisContField3DHomogeneous1D>
292 
293  inline const Array<OneD,const MultiRegions::ExpListSharedPtr>
295  {
296  return m_bndCondExpansions;
297  }
298 
299  inline const Array<OneD,const SpatialDomains::BoundaryConditionShPtr>
301  {
302  return m_bndConditions;
303  }
304 
307  {
308  return m_bndCondExpansions[i];
309  }
310 
311  inline Array<OneD, SpatialDomains::BoundaryConditionShPtr>
313  {
314  return m_bndConditions;
315  }
316  } //end of namespace
317 } //end of namespace
318 
319 #endif // MULTIERGIONS_DISCONTFIELD3DHOMO1D_H