Nektar++
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 // 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 three-dimensions for a discontinuous
32 // LDG-H expansion with a homogeneous direction in 1D
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3DHOMO1D_H
37 #define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD3DHOMO1D_H
38 
42 #include <MultiRegions/ExpList2D.h>
46 
47 
48 namespace Nektar
49 {
50  namespace MultiRegions
51  {
53  {
54  public:
56 
59  const LibUtilities::BasisKey &HomoBasis,
60  const NekDouble lhom,
61  const bool useFFT,
62  const bool dealiasing);
63 
66  const LibUtilities::BasisKey &HomoBasis,
67  const NekDouble lhom,
68  const bool useFFT,
69  const bool dealiasing,
71  const std::string &variable,
74 
75 
76  /// Copy constructor.
78  const DisContField3DHomogeneous1D &In,
79  const bool DeclarePlanesSetCoeffPhys = true);
80 
81  /// Destructor.
83 
85  const LibUtilities::BasisKey &HomoBasis,
86  const NekDouble lhom,
88  const std::string variable);
89 
90  /**
91  * \brief This function evaluates the boundary conditions
92  * at a certaintime-level.
93  *
94  * Based on the boundary condition \f$g(\boldsymbol{x},t)\f$
95  * evaluated at a given time-level \a t, this function transforms
96  * the boundary conditions onto the coefficients of the
97  * (one-dimensional) boundary expansion.
98  * Depending on the type of boundary conditions, these expansion
99  * coefficients are calculated in different ways:
100  * - <b>Dirichlet boundary conditions</b><BR>
101  * In order to ensure global \f$C^0\f$ continuity of the
102  * spectral/hp approximation, the Dirichlet boundary conditions
103  * are projected onto the boundary expansion by means of a
104  * modified \f$C^0\f$ continuous Galerkin projection.
105  * This projection can be viewed as a collocation projection at the
106  * vertices, followed by an \f$L^2\f$ projection on the interior
107  * modes of the edges. The resulting coefficients
108  * \f$\boldsymbol{\hat{u}}^{\mathcal{D}}\f$ will be stored for the
109  * boundary expansion.
110  * - <b>Neumann boundary conditions</b>
111  * In the discrete Galerkin formulation of the problem to be
112  * solved, the Neumann boundary conditions appear as the set of
113  * surface integrals: \f[\boldsymbol{\hat{g}}=\int_{\Gamma}
114  * \phi^e_n(\boldsymbol{x})g(\boldsymbol{x})d(\boldsymbol{x})\quad
115  * \forall n \f]
116  * As a result, it are the coefficients \f$\boldsymbol{\hat{g}}\f$
117  * that will be stored in the boundary expansion
118  *
119  * \param time The time at which the boundary conditions should be
120  * evaluated
121  */
123  const NekDouble time = 0.0,
124  const std::string varName = "");
125 
128 
129  inline const Array<OneD,const SpatialDomains::
130  BoundaryConditionShPtr> &GetBndConditions();
131 
132  inline std::shared_ptr<ExpList> &UpdateBndCondExpansion(int i);
133 
136 
137  /// \brief Set up a list of element ids and edge ids the link to the
138  /// boundary conditions
140  Array<OneD, int> &ElmtID,
141  Array<OneD,int> &EdgeID);
142 
143  virtual void v_GetBndElmtExpansion(int i,
144  std::shared_ptr<ExpList> &result,
145  const bool DeclareCoeffPhysArrays);
146 
147  /// This funtion extract form a vector containing a full
148  /// 3D-homogenous-1D field the value associated with a
149  /// specific boundary conditions.
150  /// TotField is the full field contaning all the physical values
151  /// BndVals is the vector where the boundary physical values are
152  /// stored BndID is the identifier of the boundary region
154  Array<OneD, NekDouble> &BndVals,
155  const Array<OneD, NekDouble> &TotField,
156  int BndID);
157 
158  /// This function calculate the inner product of two vectors
159  /// (V1 and V2) respect to the basis along a boundary region.
160  /// outarray is the inner product result multiplied by the normal to
161  /// the edge (specified by the BndID)
165  Array<OneD, NekDouble> &outarray,
166  int BndID);
167 
168  /// Storage space for the boundary to element and boundary to trace
169  /// map. This member variable is really allocated just in case
170  /// a boundary expansion recasting is required at the solver level.
171  /// Otherwise is the 2 vectors are not filled up.
172  /// If is needed all the funcitons whihc require to use this map
173  /// do not have to recalculate it anymore.
176 
177  protected:
178  /**
179  * \brief An object which contains the discretised
180  * boundary conditions.
181  *
182  * It is an array of size equal to the number of boundary
183  * regions and consists of entries of the type
184  * MultiRegions#ExpList1D. Every entry corresponds to the
185  * one-dimensional spectral/hp expansion on a single
186  * boundary region. The values of the boundary conditions
187  * are stored as the coefficients of the one-dimensional
188  * expansion.
189  */
190 
192 
194 
196 
197  /**
198  * \brief An array which contains the information about
199  * the boundary condition on the different boundary
200  * regions.
201  */
203 
205  Array<OneD,int> &ElmtID,
206  Array<OneD,int> &EdgeID)
207  {
208  GetBoundaryToElmtMap(ElmtID, EdgeID);
209  }
210 
211  virtual void v_GetBCValues(
212  Array<OneD, NekDouble> &BndVals,
213  const Array<OneD, NekDouble> &TotField,
214  int BndID)
215  {
216  GetBCValues(BndVals, TotField, BndID);
217  }
218 
222  Array<OneD, NekDouble> &outarray,
223  int BndID)
224  {
225  NormVectorIProductWRTBase(V1,V2,outarray,BndID);
226  }
227 
228  /// Set up all DG member variables and maps
230 
231  /// @todo Fix in another way considering all the planes
233  {
234  return m_trace;
235  }
236 
237  /// @todo Fix in another way considering all the planes
239  {
240  return m_planes[0]->GetTraceMap();
241  }
242 
245  {
246  return GetBndCondExpansions();
247  }
248 
249  virtual const
252  {
253  return GetBndConditions();
254  }
255 
256  /// @todo Fix Robin BCs for homogeneous case
257  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo()
258  {
259  return std::map<int, RobinBCInfoSharedPtr>();
260  }
261 
262  virtual void v_ExtractTracePhys(
263  const Array<OneD, const NekDouble> &inarray,
264  Array<OneD, NekDouble> &outarray);
265 
266  virtual void v_ExtractTracePhys(
267  Array<OneD, NekDouble> &outarray);
268 
269  virtual void v_GetBoundaryNormals(int i,
270  Array<OneD, Array<OneD, NekDouble> > &normals);
271 
272  private:
273  // virtual functions
274  virtual void v_HelmSolve(
275  const Array<OneD, const NekDouble> &inarray,
276  Array<OneD, NekDouble> &outarray,
277  const FlagList &flags,
278  const StdRegions::ConstFactorMap &factors,
279  const StdRegions::VarCoeffMap &varcoeff,
280  const MultiRegions::VarFactorsMap &varfactors,
281  const Array<OneD, const NekDouble> &dirForcing,
282  const bool PhysSpaceForcing);
283 
284  virtual void v_EvaluateBoundaryConditions(
285  const NekDouble time = 0.0,
286  const std::string varName = "",
289 
290  virtual std::shared_ptr<ExpList> &v_UpdateBndCondExpansion(int i);
291 
294 
296  {
297  return m_traceBndMap;
298  }
299  };
300 
301  typedef std::shared_ptr<DisContField3DHomogeneous1D>
303 
306  {
307  return m_bndCondExpansions;
308  }
309 
312  {
313  return m_bndConditions;
314  }
315 
318  {
319  return m_bndCondExpansions[i];
320  }
321 
324  {
325  return m_bndConditions;
326  }
327  } //end of namespace
328 } //end of namespace
329 
330 #endif // MULTIERGIONS_DISCONTFIELD3DHOMO1D_H
virtual void v_GetBCValues(Array< OneD, NekDouble > &BndVals, const Array< OneD, NekDouble > &TotField, int BndID)
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
std::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
virtual void v_GetBndElmtExpansion(int i, std::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void SetUpDG()
Set up all DG member variables and maps.
#define MULTI_REGIONS_EXPORT
Array< OneD, int > m_BCtoElmMap
Storage space for the boundary to element and boundary to trace map. This member variable is really a...
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
virtual void v_ExtractTracePhys(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This method extracts the trace (edges in 2D) for each plane from the field inarray and puts the value...
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
virtual void v_NormVectorIProductWRTBase(Array< OneD, const NekDouble > &V1, Array< OneD, const NekDouble > &V2, Array< OneD, NekDouble > &outarray, int BndID)
virtual Array< OneD, SpatialDomains::BoundaryConditionShPtr > & v_UpdateBndConditions()
virtual std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & GetBndConditions()
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
virtual void v_GetBoundaryNormals(int i, Array< OneD, Array< OneD, NekDouble > > &normals)
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)
virtual const Array< OneD, const int > & v_GetTraceBndMap()
Array< OneD, ExpListSharedPtr > m_planes
double NekDouble
Defines a list of flags.
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
static const NekDouble kNekUnsetDouble
void SetupBoundaryConditions(const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom, SpatialDomains::BoundaryConditions &bcs, const std::string variable)
Array< OneD, SpatialDomains::BoundaryConditionShPtr > & UpdateBndConditions()
const Array< OneD, const MultiRegions::ExpListSharedPtr > & GetBndCondExpansions()
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)
void GetBCValues(Array< OneD, NekDouble > &BndVals, const Array< OneD, NekDouble > &TotField, int BndID)
This funtion extract form a vector containing a full 3D-homogenous-1D field the value associated with...
void NormVectorIProductWRTBase(Array< OneD, const NekDouble > &V1, Array< OneD, const NekDouble > &V2, Array< OneD, NekDouble > &outarray, int BndID)
This function calculate the inner product of two vectors (V1 and V2) respect to the basis along a bou...
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Set up a list of element ids and edge ids the link to the boundary conditions.
std::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:48
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions(void)
virtual std::shared_ptr< ExpList > & v_UpdateBndCondExpansion(int i)
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="")
This function evaluates the boundary conditions at a certaintime-level.
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Describes the specification for a Basis.
Definition: Basis.h:49
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap