Nektar++
SmoothedProfileMethod.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File SmoothedProfileMethod.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: Smoothed Profile Method header
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERS_SMOOTHEDPROFILEMETHOD_H
37 #define NEKTAR_SOLVERS_SMOOTHEDPROFILEMETHOD_H
38 
40 #include <fstream>
41 
42 namespace Nektar
43 {
45  {
46  public:
47  /// Creates an instance of this class
51  {
54  pSession, pGraph);
55  p->InitObject();
56  return p;
57  }
58 
59  /// Name of class
60  static std::string className;
61 
62  //Constructor
66 
67  // Destructor
68  virtual ~SmoothedProfileMethod();
69 
70  virtual void v_InitObject();
71 
73 
74  // Solves the linear part of the velocity correction scheme incluiding
75  // the SPM method calculation for 'fs'
77  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
78  Array<OneD, Array<OneD, NekDouble> > &outarray,
79  const NekDouble time,
80  const NekDouble a_iixDt)
81  {
82  v_SolveUnsteadyStokesSystem(inarray, outarray, time, a_iixDt);
83  }
84 
85  protected:
86  /// Correction pressure field for SPM
88  /// Velocity of the immersed body(ies)
91  /// Vector storing the names of the components of \u_p
92  std::vector<std::string> m_velName;
93  /// Flag signaling if \f$\u_p\f$ depends on time
95  /// Stiffly-stable scheme \f$\gamma_0\f$ coefficient
97  /// Forcing function 'f_s'
99  /// Shape function 'phi' as expansion list
101  /// Function that evaluates the values of \Phi
103  /// Flag that is true when phi depends on time
105  /// Flag indicating that phi was defined in a file
106  bool m_filePhi;
107  /// Position of "AeroForcesSPM" filter in 'm_session->GetFilters()'
109 
110  // Interface for 'v_SolveUnsteadyStokesSystem'
111  virtual void v_SolveUnsteadyStokesSystem(
112  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
113  Array<OneD, Array<OneD, NekDouble> > &outarray,
114  NekDouble time,
115  NekDouble a_iixDt);
116  // Sets the parameters and BCs for the Poisson equation
118  const Array<OneD, const Array<OneD, NekDouble> > &fields,
120  // Solves the Poisson equation for the correction pressure
123  // Explicitly corrects the velocity by using the force 'fs'
126  Array<OneD, Array<OneD, NekDouble> > &fields,
127  NekDouble dt);
128  // Set proper BCs for the corrected pressure 'p_p'
130  // Calculates the shape function values
131  // (only for non-moving boundaries)
132  void UpdatePhiUp(NekDouble time);
133  // Calculates the virtual force 'fs'
134  void UpdateForcing(
135  const Array<OneD, const Array<OneD, NekDouble> > &fields,
136  NekDouble dt);
137  // Gets time-dependence information from the first elment of 'name'
138  bool GetVarTimeDependence(std::string funcName,
139  std::string attrName);
140  // Returns a Tinyxml handle of the requested function element
141  TiXmlElement* GetFunctionHdl(std::string functionName);
142  // Reads and set the values of Phi from an analyitic func. or a file
143  void ReadPhi();
144 
145  /// Initialises the expansions for the intermediate pressure, the 'Phi'
146  /// function and the IB forcing
147  template <typename T>
148  void SetUpExpansions(int nvel)
149  {
150  int iVel = m_velocity[0];
152  *std::dynamic_pointer_cast<T>(m_pressure));
154  *std::dynamic_pointer_cast<T>(m_fields[iVel]));
155 
157  for (int i = 0; i < nvel; ++i)
158  {
160  *std::dynamic_pointer_cast<T>(m_fields[iVel]));
161  }
162 
163  // Set to wave space if homogeneous case
165  {
166  m_pressureP->SetWaveSpace(true);
167  m_phi->SetWaveSpace(true);
168  for (int i = 0; i < nvel; ++i)
169  {
170  m_fs[i]->SetWaveSpace(true);
171  }
172  }
173  }
174 
175  private:
176  };
177 
178  typedef std::shared_ptr<SmoothedProfileMethod>
180 
181 } // end of namespace
182 
183 #endif // SMOOTHEDPROFILEMETHOD_H
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void UpdateForcing(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble dt)
For a body with a velocity , the force applied to the fluid ensures that the IBC are met:
bool m_filePhi
Flag indicating that phi was defined in a file.
void SetCorrectionPressureBCs()
Updates the BCs for boundaries with Neumann or periodic BCs in the pressure:
Array< OneD, Array< OneD, NekDouble > > m_up
Velocity of the immersed body(ies)
virtual void v_InitObject()
Init object for UnsteadySystem class.
std::vector< std::string > m_velName
Vector storing the names of the components of \u_p.
NekDouble m_gamma0
Stiffly-stable scheme coefficient.
int m_forcesFilter
Position of "AeroForcesSPM" filter in 'm_session->GetFilters()'.
virtual ~SmoothedProfileMethod()
Destroy the Smoothed Profile Method object.
bool m_timeDependentPhi
Flag that is true when phi depends on time.
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
SmoothedProfileMethod(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Construct a new Smoothed Profile Method object.
void UpdatePhiUp(NekDouble time)
Calculates the values of the shape function.
SolverUtils::SessionFunctionSharedPtr m_phiEvaluator
Function that evaluates the values of \Phi.
void SolveCorrectedVelocity(Array< OneD, Array< OneD, NekDouble > > &Forcing, Array< OneD, Array< OneD, NekDouble > > &fields, NekDouble dt)
Corrects the velocity field so that the IBs are taken into account. Solves the explicit equation:
TiXmlElement * GetFunctionHdl(std::string functionName)
Returns a handle to the requested function. Returns NULL if it does not exist.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Generates the summary of the current simulation.
static std::string className
Name of class.
virtual void v_SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, NekDouble time, NekDouble a_iixDt)
Linear terms due to pressure and visosity are calculated here. After solving the velocity filed witho...
bool m_timeDependentUp
Flag signaling if depends on time.
MultiRegions::ExpListSharedPtr m_pressureP
Correction pressure field for SPM.
void SetUpExpansions(int nvel)
Initialises the expansions for the intermediate pressure, the 'Phi' function and the IB forcing.
bool GetVarTimeDependence(std::string funcName, std::string attrName)
True if the function is timedependent, false otherwise.
Array< OneD, Array< OneD, NekDouble > > m_upPrev
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble a_iixDt)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fs
Forcing function 'f_s'.
MultiRegions::ExpListSharedPtr m_phi
Shape function 'phi' as expansion list.
void SolveCorrectionPressure(const Array< OneD, NekDouble > &Forcing)
Solves the Poisson equation for the correction pressure :
void SetUpCorrectionPressure(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing)
Sets the forcing term of the equation for the correction pressure :
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
enum HomogeneousType m_HomogeneousType
Defines a forcing term to be explicitly applied.
Definition: Forcing.h:73
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< SmoothedProfileMethod > SmoothedProfileMethodSharedPtr
double NekDouble