Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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,
51  Loki::SingleThreaded> Type;
52  return Type::Instance();
53 }
54 
55 
56 /**
57  * @param pSession Session configuration data.
58  * @param pFields Array of ExpList objects.
59  */
63 {
64  v_InitObject(pSession, pFields);
65 }
66 
67 
68 /**
69  * @param nConvectiveFields Number of velocity components.
70  * @param pFields Expansion lists for scalar fields.
71  * @param pAdvVel Advection velocity.
72  * @param pInarray Scalar data to advect.
73  * @param pOutarray Advected scalar data.
74  * @param pTime Simulation time.
75  */
77  const int nConvectiveFields,
79  const Array<OneD, Array<OneD, NekDouble> > &pAdvVel,
80  const Array<OneD, Array<OneD, NekDouble> > &pInarray,
81  Array<OneD, Array<OneD, NekDouble> > &pOutarray,
82  const NekDouble &pTime,
83  const Array<OneD, Array<OneD, NekDouble> > &pFwd,
84  const Array<OneD, Array<OneD, NekDouble> > &pBwd)
85 {
86  v_Advect(nConvectiveFields, pFields, pAdvVel, pInarray,
87  pOutarray, pTime, pFwd, pBwd);
88 }
89 
90 
91 /**
92  * This function should be overridden in derived classes to initialise the
93  * specific advection data members. However, this base class function should
94  * be called as the first statement of the overridden function to ensure the
95  * base class is correctly initialised in order.
96  *
97  * @param pSession Session information.
98  * @param pFields Expansion lists for scalar fields.
99  */
103 {
104  m_spaceDim = pFields[0]->GetCoordim(0);
105 
106  if (pSession->DefinesSolverInfo("HOMOGENEOUS"))
107  {
108  std::string HomoStr = pSession->GetSolverInfo("HOMOGENEOUS");
109  if (HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
110  HomoStr == "1D" || HomoStr == "Homo1D" ||
111  HomoStr == "HOMOGENEOUS2D" || HomoStr == "Homogeneous2D" ||
112  HomoStr == "2D" || HomoStr == "Homo2D")
113  {
114  m_spaceDim++;
115  }
116  else
117  {
118  ASSERTL0(false, "Only 1D homogeneous dimension supported.");
119  }
120  }
121 }
122 
123 
124 /**
125  *
126  */
128  const Array<OneD, Array<OneD, NekDouble> > &inarray,
130 {
131  ASSERTL0(false,
132  "A baseflow is not appropriate for this advection type.");
133 }
134 
135 }
136 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
LibUtilities::NekFactory< std::string, Advection, std::string > AdvectionFactory
Datatype of the NekFactory used to instantiate classes derived from the Advection class...
Definition: Advection.h:170
SOLVER_UTILS_EXPORT void InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Interface function to initialise the advection object.
Definition: Advection.cpp:60
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:127
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:46
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:76
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
Definition: Advection.h:140
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
Definition: Advection.cpp:100
Provides a generic Factory class.
Definition: NekFactory.hpp:116