Nektar++
ContField3D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File ContField3D.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
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_LIBS_MULTIREGIONS_CONTFIELD3D_H
36 #define NEKTAR_LIBS_MULTIREGIONS_CONTFIELD3D_H
37 
45 
46 namespace Nektar
47 {
48  namespace MultiRegions
49  {
51  {
52  public:
54 
55  /// Construct a global continuous field.
59  const std::string &variable = "DefaultVar",
60  const bool CheckIfSingularSystem = false,
63 
64  /// Construct a global continuous field with solution type based on
65  /// another field but using a separate input mesh and boundary
66  /// conditions.
67  MULTI_REGIONS_EXPORT ContField3D(const ContField3D &In,
69  const std::string &variable,
70  const bool CheckIfSingularSystem = false);
71 
72  MULTI_REGIONS_EXPORT ContField3D(const ContField3D &In);
73 
75 
77  {
78  return m_bndCondExpansions;
79  }
80 
81  /// This function return the boundary conditions expansion.
83  &GetBndCondExp();
84 
86  const GlobalLinSysKey &key,
88  Array<OneD, NekDouble> &outarray);
89 
90  inline void Assemble();
91 
92  inline void Assemble(
93  const Array<OneD, const NekDouble> &inarray,
94  Array<OneD,NekDouble> &outarray);
95 
97  const;
98 
100 
101 
102  protected:
104 
105  /// (A shared pointer to) a list which collects all the global
106  /// matrices being assembled, such that they should be constructed
107  /// only once.
109 
110  /// (A shared pointer to) a list which collects all the global
111  /// linear system being assembled, such that they should be
112  /// constructed only once.
114 
115  /// Performs the backward transformation of the spectral/hp
116  /// element expansion.
117  virtual void v_BwdTrans(
118  const Array<OneD, const NekDouble> &inarray,
119  Array<OneD, NekDouble> &outarray,
120  CoeffState coeffstate = eLocal);
121 
122  /// Calculates the inner product of a function
123  /// \f$f(\boldsymbol{x})\f$ with respect to all <em>global</em>
124  /// expansion modes \f$\phi_n^e(\boldsymbol{x})\f$.
125  virtual void v_IProductWRTBase(
126  const Array<OneD, const NekDouble> &inarray,
127  Array<OneD, NekDouble> &outarray,
128  CoeffState coeffstate = eLocal);
129 
130  virtual void v_FwdTrans(
131  const Array<OneD, const NekDouble> &inarray,
132  Array<OneD, NekDouble> &outarray,
133  CoeffState coeffstate);
134 
135 
136  private:
138 
140 
141  /// Returns the global matrix specified by \a mkey.
143 
144 
145  void GlobalSolve(const GlobalLinSysKey &key,
147  Array<OneD, NekDouble> &inout,
148  const Array<OneD, const NekDouble> &dirForcing
150 
151  /// Impose the Dirichlet Boundary Conditions on outarray
152  virtual void v_ImposeDirichletConditions(Array<OneD,NekDouble>& outarray);
153 
154  virtual void v_FillBndCondFromField();
155 
156  virtual void v_FillBndCondFromField(const int nreg);
157 
158  virtual void v_LocalToGlobal(bool useComm);
159 
160 
161  virtual void v_LocalToGlobal(
162  const Array<OneD, const NekDouble> &inarray,
163  Array<OneD,NekDouble> &outarray,
164  bool useComm);
165 
166 
167  virtual void v_GlobalToLocal(void);
168 
169 
170  virtual void v_GlobalToLocal(
171  const Array<OneD, const NekDouble> &inarray,
172  Array<OneD,NekDouble> &outarray);
173 
174 
175  virtual void v_MultiplyByInvMassMatrix(
176  const Array<OneD, const NekDouble> &inarray,
177  Array<OneD, NekDouble> &outarray,
178  CoeffState coeffstate);
179 
180  virtual void v_HelmSolve(
181  const Array<OneD, const NekDouble> &inarray,
182  Array<OneD, NekDouble> &outarray,
183  const FlagList &flags,
184  const StdRegions::ConstFactorMap &factors,
185  const StdRegions::VarCoeffMap &varcoeff,
186  const MultiRegions::VarFactorsMap &varfactors,
187  const Array<OneD, const NekDouble> &dirForcing,
188  const bool PhysSpaceForcing);
189  virtual void v_GeneralMatrixOp(
190  const GlobalMatrixKey &gkey,
191  const Array<OneD,const NekDouble> &inarray,
192  Array<OneD, NekDouble> &outarray,
193  CoeffState coeffstate);
194 
195  // Solve the linear advection problem assuming that m_coeffs
196  // vector contains an intial estimate for solution
198  const Array<OneD, Array<OneD, NekDouble> > &velocity,
199  const Array<OneD, const NekDouble> &inarray,
200  Array<OneD, NekDouble> &outarray,
201  const NekDouble lambda,
202  CoeffState coeffstate = eLocal,
204 
205  virtual void v_ClearGlobalLinSysManager(void);
206 
207  };
208  typedef std::shared_ptr<ContField3D> ContField3DSharedPtr;
209 
212  {
213  return m_bndCondExpansions;
214  }
215 
216 
217  inline void ContField3D::Assemble()
218  {
219  m_locToGloMap->Assemble(m_coeffs, m_coeffs);
220  }
221 
223  const Array<OneD, const NekDouble> &inarray,
224  Array<OneD,NekDouble> &outarray)
225  {
226  m_locToGloMap->Assemble(inarray, outarray);
227  }
228 
229  inline const AssemblyMapCGSharedPtr&
231  {
232  return m_locToGloMap;
233  }
234 
235 
236  } //end of namespace
237 } //end of namespace
238 
239 #endif // MULTIERGIONS_CONTFIELD3D_H
virtual void v_LinearAdvectionDiffusionReactionSolve(const Array< OneD, Array< OneD, NekDouble > > &velocity, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble lambda, CoeffState coeffstate=eLocal, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
const Array< OneD, const MultiRegions::ExpListSharedPtr > & GetBndCondExpansions()
Definition: ContField3D.h:76
GlobalMatrixSharedPtr GetGlobalMatrix(const GlobalMatrixKey &mkey)
Returns the global matrix specified by mkey.
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
Local coefficients.
std::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
Definition: AssemblyMapCG.h:51
static Array< OneD, NekDouble > NullNekDouble1DArray
const AssemblyMapCGSharedPtr & GetLocalToGlobalMap() const
Definition: ContField3D.h:230
const Array< OneD, const MultiRegions::ExpListSharedPtr > & GetBndCondExp()
This function return the boundary conditions expansion.
Definition: ContField3D.h:211
int GetGlobalMatrixNnz(const GlobalMatrixKey &gkey)
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Calculates the inner product of a function with respect to all global expansion modes ...
#define MULTI_REGIONS_EXPORT
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:50
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
virtual void v_GlobalToLocal(void)
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
Definition: ExpList.h:1052
virtual void v_ImposeDirichletConditions(Array< OneD, NekDouble > &outarray)
Impose the Dirichlet Boundary Conditions on outarray.
std::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:208
GlobalLinSysSharedPtr GenGlobalLinSys(const GlobalLinSysKey &mkey)
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
std::shared_ptr< GlobalMatrix > GlobalMatrixSharedPtr
Shared pointer to a GlobalMatrix object.
Definition: GlobalMatrix.h:88
double NekDouble
Defines a list of flags.
virtual void v_GeneralMatrixOp(const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
Calculates the result of the multiplication of a global matrix of type specified by mkey with a vecto...
Describe a linear system.
Describes a matrix with ordering defined by a local to global map.
AssemblyMapCGSharedPtr m_locToGloMap
Definition: ContField3D.h:103
GlobalLinSysSharedPtr GetGlobalLinSys(const GlobalLinSysKey &mkey)
void GenerateDirBndCondForcing(const GlobalLinSysKey &key, Array< OneD, NekDouble > &inout, Array< OneD, NekDouble > &outarray)
virtual void v_MultiplyByInvMassMatrix(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
std::shared_ptr< GlobalMatrixMap > GlobalMatrixMapShPtr
Shared pointer to a global matrix map.
Definition: GlobalMatrix.h:92
void GlobalSolve(const GlobalLinSysKey &key, const Array< OneD, const NekDouble > &rhs, Array< OneD, NekDouble > &inout, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
GlobalMatrixMapShPtr m_globalMat
(A shared pointer to) a list which collects all the global matrices being assembled, such that they should be constructed only once.
Definition: ContField3D.h:108
LibUtilities::NekManager< GlobalLinSysKey, GlobalLinSys > m_globalLinSysManager
(A shared pointer to) a list which collects all the global linear system being assembled, such that they should be constructed only once.
Definition: ContField3D.h:113
virtual void v_LocalToGlobal(bool useComm)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Performs the backward transformation of the spectral/hp element expansion.
virtual void v_ClearGlobalLinSysManager(void)
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)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap