Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Advection.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Advection.cpp
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: Abstract base class for advection.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
37 
38 namespace Nektar
39 {
40 namespace SolverUtils
41 {
42 
43 /**
44  * @returns The advection factory.
45  */
47 {
48  typedef Loki::SingletonHolder<AdvectionFactory,
49  Loki::CreateUsingNew,
50  Loki::NoDestroy > Type;
51  return Type::Instance();
52 }
53 
54 
55 /**
56  * @param pSession Session configuration data.
57  * @param pFields Array of ExpList objects.
58  */
61  Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
62 {
63  v_InitObject(pSession, pFields);
64 }
65 
66 
67 /**
68  * @param nConvectiveFields Number of velocity components.
69  * @param pFields Expansion lists for scalar fields.
70  * @param pAdvVel Advection velocity.
71  * @param pInarray Scalar data to advect.
72  * @param pOutarray Advected scalar data.
73  * @param pTime Simulation time.
74  */
76  const int nConvectiveFields,
77  const Array<OneD, MultiRegions::ExpListSharedPtr> &pFields,
78  const Array<OneD, Array<OneD, NekDouble> > &pAdvVel,
79  const Array<OneD, Array<OneD, NekDouble> > &pInarray,
80  Array<OneD, Array<OneD, NekDouble> > &pOutarray,
81  const NekDouble &pTime)
82 {
83  v_Advect(nConvectiveFields, pFields, pAdvVel, pInarray, pOutarray, pTime);
84 }
85 
86 
87 /**
88  * This function should be overridden in derived classes to initialise the
89  * specific advection data members. However, this base class function should
90  * be called as the first statement of the overridden function to ensure the
91  * base class is correctly initialised in order.
92  *
93  * @param pSession Session information.
94  * @param pFields Expansion lists for scalar fields.
95  */
98  Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
99 {
100  m_spaceDim = pFields[0]->GetCoordim(0);
101 
102  if (pSession->DefinesSolverInfo("HOMOGENEOUS"))
103  {
104  std::string HomoStr = pSession->GetSolverInfo("HOMOGENEOUS");
105  if (HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
106  HomoStr == "1D" || HomoStr == "Homo1D")
107  {
108  m_spaceDim++;
109  }
110  else
111  {
112  ASSERTL0(false, "Only 1D homogeneous dimension supported.");
113  }
114  }
115 }
116 
117 
118 /**
119  *
120  */
122  const Array<OneD, Array<OneD, NekDouble> > &inarray)
123 {
124  ASSERTL0(false,
125  "A baseflow is not appropriate for this advection type.");
126 }
127 
128 }
129 }