Nektar++
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 // 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: Abstract base class for advection.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <boost/core/ignore_unused.hpp>
36 
38 
39 namespace Nektar
40 {
41 namespace SolverUtils
42 {
43 
44 /**
45  * @returns The advection factory.
46  */
48 {
49  static AdvectionFactory instance;
50  return instance;
51 }
52 
53 
54 /**
55  * @param pSession Session configuration data.
56  * @param pFields Array of ExpList objects.
57  */
61 {
62  v_InitObject(pSession, pFields);
63 }
64 
65 
66 /**
67  * @param nConvectiveFields Number of velocity components.
68  * @param pFields Expansion lists for scalar fields.
69  * @param pAdvVel Advection velocity.
70  * @param pInarray Scalar data to advect.
71  * @param pOutarray Advected scalar data.
72  * @param pTime Simulation time.
73  */
75  const int nConvectiveFields,
77  const Array<OneD, Array<OneD, NekDouble> > &pAdvVel,
78  const Array<OneD, Array<OneD, NekDouble> > &pInarray,
79  Array<OneD, Array<OneD, NekDouble> > &pOutarray,
80  const NekDouble &pTime,
81  const Array<OneD, Array<OneD, NekDouble> > &pFwd,
82  const Array<OneD, Array<OneD, NekDouble> > &pBwd)
83 {
84  v_Advect(nConvectiveFields, pFields, pAdvVel, pInarray,
85  pOutarray, pTime, pFwd, pBwd);
86 }
87 
88 
89 /**
90  * This function should be overridden in derived classes to initialise the
91  * specific advection data members. However, this base class function should
92  * be called as the first statement of the overridden function to ensure the
93  * base class is correctly initialised in order.
94  *
95  * @param pSession Session information.
96  * @param pFields Expansion lists for scalar fields.
97  */
101 {
102  m_spaceDim = pFields[0]->GetCoordim(0);
103 
104  if (pSession->DefinesSolverInfo("HOMOGENEOUS"))
105  {
106  std::string HomoStr = pSession->GetSolverInfo("HOMOGENEOUS");
107  if (HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
108  HomoStr == "1D" || HomoStr == "Homo1D" ||
109  HomoStr == "HOMOGENEOUS2D" || HomoStr == "Homogeneous2D" ||
110  HomoStr == "2D" || HomoStr == "Homo2D")
111  {
112  m_spaceDim++;
113  }
114  else
115  {
117  "Only 1D homogeneous dimension supported.");
118  }
119  }
120 }
121 
122 
123 /**
124  *
125  */
127  const Array<OneD, Array<OneD, NekDouble> > &inarray,
129 {
130  boost::ignore_unused(inarray, fields);
132  "A baseflow is not appropriate for this advection type.");
133 }
134 
135 }
136 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
SOLVER_UTILS_EXPORT void InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Interface function to initialise the advection object.
Definition: Advection.cpp:58
virtual SOLVER_UTILS_EXPORT void v_Advect(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &advVel, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)=0
Advects a vector field.
virtual SOLVER_UTILS_EXPORT void v_SetBaseFlow(const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Overrides the base flow used during linearised advection.
Definition: Advection.cpp:126
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:47
double NekDouble
SOLVER_UTILS_EXPORT void Advect(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &advVel, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
Interface function to advect the vector field.
Definition: Advection.cpp:74
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
Definition: Advection.h:145
std::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
Definition: Advection.cpp:98
Provides a generic Factory class.
Definition: NekFactory.hpp:103