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 
40 #include <MultiRegions/ExpList.h>
46 
47 namespace Nektar
48 {
49 namespace MultiRegions
50 {
52 {
53 public:
55 
58  const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom,
59  const bool useFFT, const bool dealiasing);
60 
63  const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom,
64  const bool useFFT, const bool dealiasing,
66  const std::string &variable,
67  const Collections::ImplementationType ImpType =
69 
70  /// Copy constructor.
73  const bool DeclarePlanesSetCoeffPhys = true);
74 
75  /// Destructor.
77 
79  const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom,
80  SpatialDomains::BoundaryConditions &bcs, const std::string variable);
81 
82  /**
83  * \brief This function evaluates the boundary conditions
84  * at a certaintime-level.
85  *
86  * Based on the boundary condition \f$g(\boldsymbol{x},t)\f$
87  * evaluated at a given time-level \a t, this function transforms
88  * the boundary conditions onto the coefficients of the
89  * (one-dimensional) boundary expansion.
90  * Depending on the type of boundary conditions, these expansion
91  * coefficients are calculated in different ways:
92  * - <b>Dirichlet boundary conditions</b><BR>
93  * In order to ensure global \f$C^0\f$ continuity of the
94  * spectral/hp approximation, the Dirichlet boundary conditions
95  * are projected onto the boundary expansion by means of a
96  * modified \f$C^0\f$ continuous Galerkin projection.
97  * This projection can be viewed as a collocation projection at the
98  * vertices, followed by an \f$L^2\f$ projection on the interior
99  * modes of the edges. The resulting coefficients
100  * \f$\boldsymbol{\hat{u}}^{\mathcal{D}}\f$ will be stored for the
101  * boundary expansion.
102  * - <b>Neumann boundary conditions</b>
103  * In the discrete Galerkin formulation of the problem to be
104  * solved, the Neumann boundary conditions appear as the set of
105  * surface integrals: \f[\boldsymbol{\hat{g}}=\int_{\Gamma}
106  * \phi^e_n(\boldsymbol{x})g(\boldsymbol{x})d(\boldsymbol{x})\quad
107  * \forall n \f]
108  * As a result, it are the coefficients \f$\boldsymbol{\hat{g}}\f$
109  * that will be stored in the boundary expansion
110  *
111  * \param time The time at which the boundary conditions should be
112  * evaluated
113  */
115  const NekDouble time = 0.0, const std::string varName = "");
116 
119 
121  &GetBndConditions();
122 
123  inline std::shared_ptr<ExpList> &UpdateBndCondExpansion(int i);
124 
127 
128  /// \brief Set up a list of element ids and edge ids the link to the
129  /// boundary conditions
131  Array<OneD, int> &EdgeID);
132 
133  virtual void v_GetBndElmtExpansion(int i, std::shared_ptr<ExpList> &result,
134  const bool DeclareCoeffPhysArrays);
135 
136  /// This funtion extract form a vector containing a full
137  /// 3D-homogenous-1D field the value associated with a
138  /// specific boundary conditions.
139  /// TotField is the full field contaning all the physical values
140  /// BndVals is the vector where the boundary physical values are
141  /// stored BndID is the identifier of the boundary region
143  Array<OneD, NekDouble> &BndVals, const Array<OneD, NekDouble> &TotField,
144  int BndID);
145 
146  /// This function calculate the inner product of two vectors
147  /// (V1 and V2) respect to the basis along a boundary region.
148  /// outarray is the inner product result multiplied by the normal to
149  /// the edge (specified by the BndID)
152  Array<OneD, NekDouble> &outarray, int BndID);
153 
154  /// Storage space for the boundary to element and boundary to trace
155  /// map. This member variable is really allocated just in case
156  /// a boundary expansion recasting is required at the solver level.
157  /// Otherwise is the 2 vectors are not filled up.
158  /// If is needed all the funcitons whihc require to use this map
159  /// do not have to recalculate it anymore.
162 
163 protected:
164  /**
165  * \brief An object which contains the discretised
166  * boundary conditions.
167  *
168  * It is an array of size equal to the number of boundary
169  * regions and consists of entries of the type
170  * MultiRegions#ExpList1D. Every entry corresponds to the
171  * one-dimensional spectral/hp expansion on a single
172  * boundary region. The values of the boundary conditions
173  * are stored as the coefficients of the one-dimensional
174  * expansion.
175  */
176 
178 
180 
182 
184 
185  /**
186  * \brief An array which contains the information about
187  * the boundary condition on the different boundary
188  * regions.
189  */
191 
193  Array<OneD, int> &EdgeID)
194  {
195  GetBoundaryToElmtMap(ElmtID, EdgeID);
196  }
197 
198  virtual void v_GetBCValues(Array<OneD, NekDouble> &BndVals,
199  const Array<OneD, NekDouble> &TotField,
200  int BndID)
201  {
202  GetBCValues(BndVals, TotField, BndID);
203  }
204 
207  Array<OneD, NekDouble> &outarray,
208  int BndID)
209  {
210  NormVectorIProductWRTBase(V1, V2, outarray, BndID);
211  }
212 
213  /// Set up all DG member variables and maps
215 
216  /// @todo Fix in another way considering all the planes
218  {
219  return m_trace;
220  }
221 
222  /// @todo Fix in another way considering all the planes
224  {
225  return m_planes[0]->GetTraceMap();
226  }
227 
230  {
231  return GetBndCondExpansions();
232  }
233 
236  {
237  return GetBndConditions();
238  }
239 
240  /// @todo Fix Robin BCs for homogeneous case
241  virtual std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo()
242  {
243  return std::map<int, RobinBCInfoSharedPtr>();
244  }
245 
246  virtual void v_ExtractTracePhys(const Array<OneD, const NekDouble> &inarray,
247  Array<OneD, NekDouble> &outarray);
248 
249  virtual void v_ExtractTracePhys(Array<OneD, NekDouble> &outarray);
250 
251  virtual void v_GetBoundaryNormals(
252  int i, Array<OneD, Array<OneD, NekDouble>> &normals);
253 
254 private:
255  // virtual functions
256  virtual void v_HelmSolve(const Array<OneD, const NekDouble> &inarray,
257  Array<OneD, NekDouble> &outarray,
258  const StdRegions::ConstFactorMap &factors,
259  const StdRegions::VarCoeffMap &varcoeff,
260  const MultiRegions::VarFactorsMap &varfactors,
261  const Array<OneD, const NekDouble> &dirForcing,
262  const bool PhysSpaceForcing);
263 
264  virtual void v_EvaluateBoundaryConditions(
265  const NekDouble time = 0.0, const std::string varName = "",
268 
269  virtual std::shared_ptr<ExpList> &v_UpdateBndCondExpansion(int i);
270 
273 
275  {
276  return m_traceBndMap;
277  }
278  inline virtual void v_SetBndCondBwdWeight(const int index,
279  const NekDouble value);
280 };
281 
282 typedef std::shared_ptr<DisContField3DHomogeneous1D>
284 
287 {
288  return m_bndCondExpansions;
289 }
290 
293 {
294  return m_bndConditions;
295 }
296 
299 {
300  return m_bndCondExpansions[i];
301 }
302 
305 {
306  return m_bndConditions;
307 }
309  const int index, const NekDouble value)
310 {
311  m_bndCondBndWeight[index] = value;
312 }
313 } // namespace MultiRegions
314 } // namespace Nektar
315 
316 #endif // MULTIERGIONS_DISCONTFIELD3DHOMO1D_H
#define MULTI_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
void SetUpDG()
Set up all DG member variables and maps.
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...
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & GetBndConditions()
virtual const Array< OneD, const int > & v_GetTraceBndMap()
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...
virtual void v_GetBndElmtExpansion(int i, std::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays)
virtual std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
Array< OneD, int > m_BCtoElmMap
Storage space for the boundary to element and boundary to trace map. This member variable is really a...
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
void SetupBoundaryConditions(const LibUtilities::BasisKey &HomoBasis, const NekDouble lhom, SpatialDomains::BoundaryConditions &bcs, const std::string variable)
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="")
This function evaluates the boundary conditions at a certaintime-level.
virtual std::shared_ptr< ExpList > & v_UpdateBndCondExpansion(int i)
virtual const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions()
Array< OneD, SpatialDomains::BoundaryConditionShPtr > & UpdateBndConditions()
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
virtual void v_GetBoundaryNormals(int i, Array< OneD, Array< OneD, NekDouble >> &normals)
virtual Array< OneD, SpatialDomains::BoundaryConditionShPtr > & v_UpdateBndConditions()
virtual void v_GetBCValues(Array< OneD, NekDouble > &BndVals, const Array< OneD, NekDouble > &TotField, int BndID)
virtual void v_HelmSolve(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff, const MultiRegions::VarFactorsMap &varfactors, const Array< OneD, const NekDouble > &dirForcing, const bool PhysSpaceForcing)
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)
const Array< OneD, const MultiRegions::ExpListSharedPtr > & GetBndCondExpansions()
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 void v_SetBndCondBwdWeight(const int index, const NekDouble value)
virtual const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions(void)
virtual void v_NormVectorIProductWRTBase(Array< OneD, const NekDouble > &V1, Array< OneD, const NekDouble > &V2, Array< OneD, NekDouble > &outarray, int BndID)
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Array< OneD, ExpListSharedPtr > m_planes
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
Definition: AssemblyMapDG.h:47
std::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
static const NekDouble kNekUnsetDouble
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:240
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:282
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble