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,
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 {
84  v_Advect(nConvectiveFields, pFields, pAdvVel, pInarray, pOutarray, pTime);
85 }
86 
87 
88 /**
89  * This function should be overridden in derived classes to initialise the
90  * specific advection data members. However, this base class function should
91  * be called as the first statement of the overridden function to ensure the
92  * base class is correctly initialised in order.
93  *
94  * @param pSession Session information.
95  * @param pFields Expansion lists for scalar fields.
96  */
100 {
101  m_spaceDim = pFields[0]->GetCoordim(0);
102 
103  if (pSession->DefinesSolverInfo("HOMOGENEOUS"))
104  {
105  std::string HomoStr = pSession->GetSolverInfo("HOMOGENEOUS");
106  if (HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
107  HomoStr == "1D" || HomoStr == "Homo1D" ||
108  HomoStr == "HOMOGENEOUS2D" || HomoStr == "Homogeneous2D" ||
109  HomoStr == "2D" || HomoStr == "Homo2D")
110  {
111  m_spaceDim++;
112  }
113  else
114  {
115  ASSERTL0(false, "Only 1D homogeneous dimension supported.");
116  }
117  }
118 }
119 
120 
121 /**
122  *
123  */
125  const Array<OneD, Array<OneD, NekDouble> > &inarray)
126 {
127  ASSERTL0(false,
128  "A baseflow is not appropriate for this advection type.");
129 }
130 
131 }
132 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
LibUtilities::NekFactory< std::string, Advection, std::string > AdvectionFactory
Datatype of the NekFactory used to instantiate classes derived from the Advection class...
Definition: Advection.h:163
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)=0
Advects a vector field.
SOLVER_UTILS_EXPORT void InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Interface function to initialise the advection object.
Definition: Advection.cpp:60
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)
Interface function to advect the vector field.
Definition: Advection.cpp:76
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:46
double NekDouble
virtual SOLVER_UTILS_EXPORT void v_SetBaseFlow(const Array< OneD, Array< OneD, NekDouble > > &inarray)
Overrides the base flow used during linearised advection.
Definition: Advection.cpp:124
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
Definition: Advection.h:136
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
Definition: Advection.cpp:97
Provides a generic Factory class.
Definition: NekFactory.hpp:116