Nektar++
FileSolution.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File FileSolution.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// 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: load discrete check-point files and interpolate them into a
32// continuous field
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_SOLVERS_FILESOLUTION_H
37#define NEKTAR_SOLVERS_FILESOLUTION_H
38
46#include <complex>
47
48namespace Nektar::SolverUtils
49{
50class FileFieldInterpolator;
51typedef std::shared_ptr<FileFieldInterpolator> FileFieldInterpolatorSharedPtr;
53{
54public:
56 void InitObject(
57 const std::string functionName,
60 std::set<std::string> &variables, std::map<std::string, int> &series,
61 std::map<std::string, NekDouble> &time);
62
63 void InterpolateField(const std::string variable,
64 Array<OneD, NekDouble> &outarray, NekDouble time);
65
66 void InterpolateField(const int v, Array<OneD, NekDouble> &outarray,
67 const NekDouble time);
68
70
71protected:
73 /// number of slices
75 int m_skip;
77 /// period length
82 /// interpolation vector
83 std::map<int, Array<OneD, NekDouble>> m_interp;
84 /// variables
85 std::map<std::string, int> m_variableMap;
86
88
90
92
93 void DFT(const std::string file,
95 const bool timefromfile);
96
97 /// Import Base flow
99 std::string pInfile,
101 int slice, std::map<std::string, NekDouble> &params);
102};
103
104/**
105 * \brief This class is the base class for Navier Stokes problems
106 *
107 */
110{
111public:
112 friend class MemoryManager<FileSolution>;
113
114 /// Creates an instance of this class
118 {
121 p->InitObject();
122 return p;
123 }
124 /// Name of class
125 static std::string className;
126
127 /// Destructor
128 ~FileSolution() override;
129
130protected:
131 void v_GetVelocity(
132 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
134
135 void v_GetPressure(
136 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
138
140
141 void v_GetDensity(
142 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
143 Array<OneD, NekDouble> &density) override;
144
145 bool v_HasConstantDensity() override;
146
147 /// Session reader
150
151 /// Compute the RHS
152 void DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble>> &inarray,
154 const NekDouble time);
155
156 /// Compute the projection
157 void DoOdeProjection(
158 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
159 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
160
161 void DoImplicitSolve(
162 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
163 Array<OneD, Array<OneD, NekDouble>> &outarray, NekDouble time,
164 NekDouble lambda);
165
166 /// Initialise the object
167 void v_InitObject(bool DeclareField = true) override;
168
169 bool v_PostIntegrate(int step) override;
170
171 bool v_RequireFwdTrans() override;
172
173 void v_DoInitialise(bool dumpInitialConditions) override;
174
175 void UpdateField(NekDouble time);
176
177private:
179 std::set<std::string> m_variableFile;
181 std::map<std::string, LibUtilities::EquationSharedPtr> m_solutionFunction;
182};
183} // namespace Nektar::SolverUtils
184
185#endif // NEKTAR_SOLVERS_INCNAVIERSTOKES_H
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
A base class for PDEs which include an advection component.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
LibUtilities::SessionReaderSharedPtr m_session
Definition: FileSolution.h:72
std::map< std::string, int > m_variableMap
variables
Definition: FileSolution.h:85
void ImportFldBase(std::string pInfile, const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, int slice, std::map< std::string, NekDouble > &params)
Import Base flow.
std::map< int, Array< OneD, NekDouble > > m_interp
interpolation vector
Definition: FileSolution.h:83
void InterpolateField(const std::string variable, Array< OneD, NekDouble > &outarray, NekDouble time)
void DFT(const std::string file, const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const bool timefromfile)
void InitObject(const std::string functionName, LibUtilities::SessionReaderSharedPtr pSession, const Array< OneD, const MultiRegions::ExpListSharedPtr > pFields, std::set< std::string > &variables, std::map< std::string, int > &series, std::map< std::string, NekDouble > &time)
DNekBlkMatSharedPtr GetFloquetBlockMatrix(int nexp)
This class is the base class for Navier Stokes problems.
Definition: FileSolution.h:110
void v_GetDensity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
Definition: FileSolution.h:115
FileFieldInterpolatorSharedPtr m_solutionFile
Definition: FileSolution.h:178
void UpdateField(NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_coord
Definition: FileSolution.h:180
std::set< std::string > m_variableFile
Definition: FileSolution.h:179
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, NekDouble time, NekDouble lambda)
bool v_PostIntegrate(int step) override
void v_DoInitialise(bool dumpInitialConditions) override
Sets up initial conditions.
FileSolution(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Session reader.
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection.
std::map< std::string, LibUtilities::EquationSharedPtr > m_solutionFunction
Definition: FileSolution.h:181
void v_GetVelocity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity) override
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the RHS.
void v_InitObject(bool DeclareField=true) override
Initialise the object.
static std::string className
Name of class.
Definition: FileSolution.h:125
~FileSolution() override
Destructor.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
const std::vector< NekDouble > velocity
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< FileFieldInterpolator > FileFieldInterpolatorSharedPtr
Definition: FileSolution.h:51
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
double NekDouble