Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // 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
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_MULTIREGIONS_CONTFIELD3D_H
37 #define NEKTAR_LIBS_MULTIREGIONS_CONTFIELD3D_H
38 
46 
47 namespace Nektar
48 {
49  namespace MultiRegions
50  {
52  {
53  public:
55 
56  /// Construct a global continuous field.
60  const std::string &variable = "DefaultVar",
61  const bool CheckIfSingularSystem = false,
64 
65  /// Construct a global continuous field with solution type based on
66  /// another field but using a separate input mesh and boundary
67  /// conditions.
68  MULTI_REGIONS_EXPORT ContField3D(const ContField3D &In,
70  const std::string &variable,
71  const bool CheckIfSingularSystem = false);
72 
73  MULTI_REGIONS_EXPORT ContField3D(const ContField3D &In);
74 
76 
78  {
79  return m_bndCondExpansions;
80  }
81 
82  /// This function return the boundary conditions expansion.
84  &GetBndCondExp();
85 
87  const GlobalLinSysKey &key,
89  Array<OneD, NekDouble> &outarray);
90 
91  inline void Assemble();
92 
93  inline void Assemble(
94  const Array<OneD, const NekDouble> &inarray,
95  Array<OneD,NekDouble> &outarray);
96 
98  const;
99 
101 
102 
103  protected:
105 
106  /// (A shared pointer to) a list which collects all the global
107  /// matrices being assembled, such that they should be constructed
108  /// only once.
110 
111  /// (A shared pointer to) a list which collects all the global
112  /// linear system being assembled, such that they should be
113  /// constructed only once.
115 
116  /// Performs the backward transformation of the spectral/hp
117  /// element expansion.
118  virtual void v_BwdTrans(
119  const Array<OneD, const NekDouble> &inarray,
120  Array<OneD, NekDouble> &outarray,
121  CoeffState coeffstate = eLocal);
122 
123  /// Calculates the inner product of a function
124  /// \f$f(\boldsymbol{x})\f$ with respect to all <em>global</em>
125  /// expansion modes \f$\phi_n^e(\boldsymbol{x})\f$.
126  virtual void v_IProductWRTBase(
127  const Array<OneD, const NekDouble> &inarray,
128  Array<OneD, NekDouble> &outarray,
129  CoeffState coeffstate = eLocal);
130 
131  virtual void v_FwdTrans(
132  const Array<OneD, const NekDouble> &inarray,
133  Array<OneD, NekDouble> &outarray,
134  CoeffState coeffstate);
135 
136 
137  private:
139 
141 
142  /// Returns the global matrix specified by \a mkey.
144 
145 
146  void GlobalSolve(const GlobalLinSysKey &key,
147  const Array<OneD, const NekDouble> &rhs,
148  Array<OneD, NekDouble> &inout,
149  const Array<OneD, const NekDouble> &dirForcing
151 
152  /// Impose the Dirichlet Boundary Conditions on outarray
153  virtual void v_ImposeDirichletConditions(Array<OneD,NekDouble>& outarray);
154 
155  virtual void v_FillBndCondFromField();
156 
157  virtual void v_FillBndCondFromField(const int nreg);
158 
159  virtual void v_LocalToGlobal(bool useComm);
160 
161 
162  virtual void v_LocalToGlobal(
163  const Array<OneD, const NekDouble> &inarray,
164  Array<OneD,NekDouble> &outarray,
165  bool useComm);
166 
167 
168  virtual void v_GlobalToLocal(void);
169 
170 
171  virtual void v_GlobalToLocal(
172  const Array<OneD, const NekDouble> &inarray,
173  Array<OneD,NekDouble> &outarray);
174 
175 
176  virtual void v_MultiplyByInvMassMatrix(
177  const Array<OneD, const NekDouble> &inarray,
178  Array<OneD, NekDouble> &outarray,
179  CoeffState coeffstate);
180 
181  virtual void v_HelmSolve(
182  const Array<OneD, const NekDouble> &inarray,
183  Array<OneD, NekDouble> &outarray,
184  const FlagList &flags,
185  const StdRegions::ConstFactorMap &factors,
186  const StdRegions::VarCoeffMap &varcoeff,
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 boost::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)
const Array< OneD, const MultiRegions::ExpListSharedPtr > & GetBndCondExpansions()
Definition: ContField3D.h:77
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.
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::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:252
virtual void v_GlobalToLocal(void)
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
Definition: ExpList.h:998
boost::shared_ptr< GlobalMatrix > GlobalMatrixSharedPtr
Shared pointer to a GlobalMatrix object.
Definition: GlobalMatrix.h:89
virtual void v_ImposeDirichletConditions(Array< OneD, NekDouble > &outarray)
Impose the Dirichlet Boundary Conditions on outarray.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
GlobalLinSysSharedPtr GenGlobalLinSys(const GlobalLinSysKey &mkey)
boost::shared_ptr< GlobalMatrixMap > GlobalMatrixMapShPtr
Shared pointer to a global matrix map.
Definition: GlobalMatrix.h:93
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:227
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:104
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)
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:109
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:114
virtual void v_LocalToGlobal(bool useComm)
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:52
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, const bool PhysSpaceForcing)
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
boost::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:208
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)
boost::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
Definition: AssemblyMapCG.h:52
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:442