Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
75  inline const Array<OneD,const MultiRegions::ExpListSharedPtr>& GetBndCondExpansions()
76  {
77  return m_bndCondExpansions;
78  }
79 
80  /// This function return the boundary conditions expansion.
81  inline const Array<OneD,const MultiRegions::ExpListSharedPtr>
82  &GetBndCondExp();
83 
85  const GlobalLinSysKey &key,
86  Array<OneD, NekDouble> &inout,
87  Array<OneD, NekDouble> &outarray);
88 
89  inline void GlobalToLocal(
90  const Array<OneD, const NekDouble> &inarray,
91  Array<OneD,NekDouble> &outarray);
92 
93  inline void LocalToGlobal(
94  const Array<OneD, const NekDouble> &inarray,
95  Array<OneD,NekDouble> &outarray);
96 
97  inline void Assemble();
98 
99  inline void Assemble(
100  const Array<OneD, const NekDouble> &inarray,
101  Array<OneD,NekDouble> &outarray);
102 
104  const;
105 
107 
108 
109  protected:
111 
112  /// (A shared pointer to) a list which collects all the global
113  /// matrices being assembled, such that they should be constructed
114  /// only once.
116 
117  /// (A shared pointer to) a list which collects all the global
118  /// linear system being assembled, such that they should be
119  /// constructed only once.
121 
122  /// Performs the backward transformation of the spectral/hp
123  /// element expansion.
124  virtual void v_BwdTrans(
125  const Array<OneD, const NekDouble> &inarray,
126  Array<OneD, NekDouble> &outarray,
127  CoeffState coeffstate = eLocal);
128 
129  /// Calculates the inner product of a function
130  /// \f$f(\boldsymbol{x})\f$ with respect to all <em>global</em>
131  /// expansion modes \f$\phi_n^e(\boldsymbol{x})\f$.
132  virtual void v_IProductWRTBase(
133  const Array<OneD, const NekDouble> &inarray,
134  Array<OneD, NekDouble> &outarray,
135  CoeffState coeffstate = eLocal);
136 
137  virtual void v_FwdTrans(
138  const Array<OneD, const NekDouble> &inarray,
139  Array<OneD, NekDouble> &outarray,
140  CoeffState coeffstate);
141 
142 
143  private:
145 
147 
148  /// Returns the global matrix specified by \a mkey.
150 
151 
152  void GlobalSolve(const GlobalLinSysKey &key,
153  const Array<OneD, const NekDouble> &rhs,
154  Array<OneD, NekDouble> &inout,
155  const Array<OneD, const NekDouble> &dirForcing
157 
158  /// Impose the Dirichlet Boundary Conditions on outarray
159  virtual void v_ImposeDirichletConditions(Array<OneD,NekDouble>& outarray);
160 
161  virtual void v_FillBndCondFromField();
162 
163  virtual void v_LocalToGlobal(void);
164 
165 
166  virtual void v_GlobalToLocal(void);
167 
168 
169  virtual void v_MultiplyByInvMassMatrix(
170  const Array<OneD, const NekDouble> &inarray,
171  Array<OneD, NekDouble> &outarray,
172  CoeffState coeffstate);
173 
174  virtual void v_HelmSolve(
175  const Array<OneD, const NekDouble> &inarray,
176  Array<OneD, NekDouble> &outarray,
177  const FlagList &flags,
178  const StdRegions::ConstFactorMap &factors,
179  const StdRegions::VarCoeffMap &varcoeff,
180  const Array<OneD, const NekDouble> &dirForcing);
181 
182  virtual void v_GeneralMatrixOp(
183  const GlobalMatrixKey &gkey,
184  const Array<OneD,const NekDouble> &inarray,
185  Array<OneD, NekDouble> &outarray,
186  CoeffState coeffstate);
187 
188 
189  };
190  typedef boost::shared_ptr<ContField3D> ContField3DSharedPtr;
191 
192  inline const Array<OneD,const MultiRegions::ExpListSharedPtr>
194  {
195  return m_bndCondExpansions;
196  }
197 
198 
199 
201  const Array<OneD, const NekDouble> &inarray,
202  Array<OneD,NekDouble> &outarray)
203  {
204  m_locToGloMap->GlobalToLocal(inarray, outarray);
205  }
206 
207 
209  const Array<OneD, const NekDouble> &inarray,
210  Array<OneD,NekDouble> &outarray)
211  {
212  m_locToGloMap->LocalToGlobal(inarray, outarray);
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  } //end of namespace
234 } //end of namespace
235 
236 #endif // MULTIERGIONS_CONTFIELD3D_H