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 
126 
127  inline const Array<OneD,const SpatialDomains::
129 
130  inline boost::shared_ptr<ExpList> &UpdateBndCondExpansion(int i);
131 
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  virtual void v_GetBndElmtExpansion(int i,
142  boost::shared_ptr<ExpList> &result);
143 
144  /// This funtion extract form a vector containing a full
145  /// 3D-homogenous-1D field the value associated with a
146  /// specific boundary conditions.
147  /// TotField is the full field contaning all the physical values
148  /// BndVals is the vector where the boundary physical values are
149  /// stored BndID is the identifier of the boundary region
151  Array<OneD, NekDouble> &BndVals,
152  const Array<OneD, NekDouble> &TotField,
153  int BndID);
154 
155  /// This function calculate the inner product of two vectors
156  /// (V1 and V2) respect to the basis along a boundary region.
157  /// outarray is the inner product result multiplied by the normal to
158  /// the edge (specified by the BndID)
162  Array<OneD, NekDouble> &outarray,
163  int BndID);
164 
165  /// Storage space for the boundary to element and boundary to trace
166  /// map. This member variable is really allocated just in case
167  /// a boundary expansion recasting is required at the solver level.
168  /// Otherwise is the 2 vectors are not filled up.
169  /// If is needed all the funcitons whihc require to use this map
170  /// do not have to recalculate it anymore.
173 
174  protected:
175  /**
176  * \brief An object which contains the discretised
177  * boundary conditions.
178  *
179  * It is an array of size equal to the number of boundary
180  * regions and consists of entries of the type
181  * MultiRegions#ExpList1D. Every entry corresponds to the
182  * one-dimensional spectral/hp expansion on a single
183  * boundary region. The values of the boundary conditions
184  * are stored as the coefficients of the one-dimensional
185  * expansion.
186  */
187 
189 
191 
193 
194  /**
195  * \brief An array which contains the information about
196  * the boundary condition on the different boundary
197  * regions.
198  */
200 
202  Array<OneD,int> &ElmtID,
203  Array<OneD,int> &EdgeID)
204  {
205  GetBoundaryToElmtMap(ElmtID, EdgeID);
206  }
207 
208  virtual void v_GetBCValues(
209  Array<OneD, NekDouble> &BndVals,
210  const Array<OneD, NekDouble> &TotField,
211  int BndID)
212  {
213  GetBCValues(BndVals, TotField, BndID);
214  }
215 
219  Array<OneD, NekDouble> &outarray,
220  int BndID)
221  {
222  NormVectorIProductWRTBase(V1,V2,outarray,BndID);
223  }
224 
225  /// Set up all DG member variables and maps
227 
228  /// @todo Fix in another way considering all the planes
230  {
231  return m_trace;
232  }
233 
234  /// @todo Fix in another way considering all the planes
236  {
237  return m_planes[0]->GetTraceMap();
238  }
239 
242  {
243  return GetBndCondExpansions();
244  }
245 
246  virtual const
249  {
250  return GetBndConditions();
251  }
252 
253  /// @todo Fix Robin BCs for homogeneous case
254  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo()
255  {
256  return std::map<int, RobinBCInfoSharedPtr>();
257  }
258 
259  virtual void v_ExtractTracePhys(
260  const Array<OneD, const NekDouble> &inarray,
261  Array<OneD, NekDouble> &outarray);
262 
263  virtual void v_ExtractTracePhys(
264  Array<OneD, NekDouble> &outarray);
265 
266  virtual void v_GetBoundaryNormals(int i,
267  Array<OneD, Array<OneD, NekDouble> > &normals);
268 
269  private:
270  // virtual functions
271  virtual void v_HelmSolve(
272  const Array<OneD, const NekDouble> &inarray,
273  Array<OneD, NekDouble> &outarray,
274  const FlagList &flags,
275  const StdRegions::ConstFactorMap &factors,
276  const StdRegions::VarCoeffMap &varcoeff,
277  const Array<OneD, const NekDouble> &dirForcing);
278 
279  virtual void v_EvaluateBoundaryConditions(
280  const NekDouble time = 0.0,
281  const std::string varName = "",
284 
285  virtual boost::shared_ptr<ExpList> &v_UpdateBndCondExpansion(int i);
286 
289 
291  {
292  return m_traceBndMap;
293  }
294  };
295 
296  typedef boost::shared_ptr<DisContField3DHomogeneous1D>
298 
301  {
302  return m_bndCondExpansions;
303  }
304 
307  {
308  return m_bndConditions;
309  }
310 
313  {
314  return m_bndCondExpansions[i];
315  }
316 
319  {
320  return m_bndConditions;
321  }
322  } //end of namespace
323 } //end of namespace
324 
325 #endif // MULTIERGIONS_DISCONTFIELD3DHOMO1D_H
boost::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:49
virtual void v_GetBCValues(Array< OneD, NekDouble > &BndVals, const Array< OneD, NekDouble > &TotField, int BndID)
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
void SetUpDG()
Set up all DG member variables and maps.
boost::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
boost::shared_ptr< ExpList > & UpdateBndCondExpansion(int i)
#define MULTI_REGIONS_EXPORT
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)
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:251
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
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 boost::shared_ptr< ExpList > & v_UpdateBndCondExpansion(int i)
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:226
virtual void v_GetBoundaryNormals(int i, Array< OneD, Array< OneD, NekDouble > > &normals)
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
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.
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions(void)
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition: Conditions.h:208
virtual void v_GetBndElmtExpansion(int i, boost::shared_ptr< ExpList > &result)
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="")
This function evaluates the boundary conditions at a certaintime-level.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:442
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:50
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...