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);
62 
63  /// Construct a global continuous field with solution type based on
64  /// another field but using a separate input mesh and boundary
65  /// conditions.
66  MULTI_REGIONS_EXPORT ContField3D(const ContField3D &In,
68  const std::string &variable,
69  const bool CheckIfSingularSystem = false);
70 
71  MULTI_REGIONS_EXPORT ContField3D(const ContField3D &In);
72 
74 
76  {
77  return m_bndCondExpansions;
78  }
79 
80  /// This function return the boundary conditions expansion.
82  &GetBndCondExp();
83 
85  const GlobalLinSysKey &key,
87  Array<OneD, NekDouble> &outarray);
88 
89  inline void Assemble();
90 
91  inline void Assemble(
92  const Array<OneD, const NekDouble> &inarray,
93  Array<OneD,NekDouble> &outarray);
94 
96  const;
97 
99 
100 
101  protected:
103 
104  /// (A shared pointer to) a list which collects all the global
105  /// matrices being assembled, such that they should be constructed
106  /// only once.
108 
109  /// (A shared pointer to) a list which collects all the global
110  /// linear system being assembled, such that they should be
111  /// constructed only once.
113 
114  /// Performs the backward transformation of the spectral/hp
115  /// element expansion.
116  virtual void v_BwdTrans(
117  const Array<OneD, const NekDouble> &inarray,
118  Array<OneD, NekDouble> &outarray,
119  CoeffState coeffstate = eLocal);
120 
121  /// Calculates the inner product of a function
122  /// \f$f(\boldsymbol{x})\f$ with respect to all <em>global</em>
123  /// expansion modes \f$\phi_n^e(\boldsymbol{x})\f$.
124  virtual void v_IProductWRTBase(
125  const Array<OneD, const NekDouble> &inarray,
126  Array<OneD, NekDouble> &outarray,
127  CoeffState coeffstate = eLocal);
128 
129  virtual void v_FwdTrans(
130  const Array<OneD, const NekDouble> &inarray,
131  Array<OneD, NekDouble> &outarray,
132  CoeffState coeffstate);
133 
134 
135  private:
137 
139 
140  /// Returns the global matrix specified by \a mkey.
142 
143 
144  void GlobalSolve(const GlobalLinSysKey &key,
145  const Array<OneD, const NekDouble> &rhs,
146  Array<OneD, NekDouble> &inout,
147  const Array<OneD, const NekDouble> &dirForcing
149 
150  /// Impose the Dirichlet Boundary Conditions on outarray
151  virtual void v_ImposeDirichletConditions(Array<OneD,NekDouble>& outarray);
152 
153  virtual void v_FillBndCondFromField();
154 
155  virtual void v_FillBndCondFromField(const int nreg);
156 
157  virtual void v_LocalToGlobal(bool useComm);
158 
159 
160  virtual void v_LocalToGlobal(
161  const Array<OneD, const NekDouble> &inarray,
162  Array<OneD,NekDouble> &outarray,
163  bool useComm);
164 
165 
166  virtual void v_GlobalToLocal(void);
167 
168 
169  virtual void v_GlobalToLocal(
170  const Array<OneD, const NekDouble> &inarray,
171  Array<OneD,NekDouble> &outarray);
172 
173 
174  virtual void v_MultiplyByInvMassMatrix(
175  const Array<OneD, const NekDouble> &inarray,
176  Array<OneD, NekDouble> &outarray,
177  CoeffState coeffstate);
178 
179  virtual void v_HelmSolve(
180  const Array<OneD, const NekDouble> &inarray,
181  Array<OneD, NekDouble> &outarray,
182  const FlagList &flags,
183  const StdRegions::ConstFactorMap &factors,
184  const StdRegions::VarCoeffMap &varcoeff,
185  const Array<OneD, const NekDouble> &dirForcing,
186  const bool PhysSpaceForcing);
187  virtual void v_GeneralMatrixOp(
188  const GlobalMatrixKey &gkey,
189  const Array<OneD,const NekDouble> &inarray,
190  Array<OneD, NekDouble> &outarray,
191  CoeffState coeffstate);
192 
193  // Solve the linear advection problem assuming that m_coeffs
194  // vector contains an intial estimate for solution
196  const Array<OneD, Array<OneD, NekDouble> > &velocity,
197  const Array<OneD, const NekDouble> &inarray,
198  Array<OneD, NekDouble> &outarray,
199  const NekDouble lambda,
200  CoeffState coeffstate = eLocal,
202 
203  virtual void v_ClearGlobalLinSysManager(void);
204 
205  };
206  typedef boost::shared_ptr<ContField3D> ContField3DSharedPtr;
207 
210  {
211  return m_bndCondExpansions;
212  }
213 
214 
215  inline void ContField3D::Assemble()
216  {
217  m_locToGloMap->Assemble(m_coeffs, m_coeffs);
218  }
219 
221  const Array<OneD, const NekDouble> &inarray,
222  Array<OneD,NekDouble> &outarray)
223  {
224  m_locToGloMap->Assemble(inarray, outarray);
225  }
226 
227  inline const AssemblyMapCGSharedPtr&
229  {
230  return m_locToGloMap;
231  }
232 
233 
234  } //end of namespace
235 } //end of namespace
236 
237 #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:75
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:228
const Array< OneD, const MultiRegions::ExpListSharedPtr > & GetBndCondExp()
This function return the boundary conditions expansion.
Definition: ContField3D.h:209
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:102
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:107
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:112
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:206
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