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{
50
51class FileFieldInterpolator;
52typedef std::shared_ptr<FileFieldInterpolator> FileFieldInterpolatorSharedPtr;
54{
55public:
57
58 void InitObject(
59 const std::string functionName,
62 std::set<std::string> &variables, std::map<std::string, int> &series,
63 std::map<std::string, NekDouble> &time);
64
65 void InterpolateField(const std::string variable,
66 Array<OneD, NekDouble> &outarray, NekDouble time);
67
68 void InterpolateField(const int v, Array<OneD, NekDouble> &outarray,
69 const NekDouble time);
70
72
73protected:
75 /// number of slices
77 int m_skip;
79 /// period length
84 /// interpolation vector
85 std::map<int, Array<OneD, NekDouble>> m_interp;
86 /// variables
87 std::map<std::string, int> m_variableMap;
88
90
92
94
95 void DFT(const std::string file,
97 const bool timefromfile);
98
99 /// Import Base flow
101 std::string pInfile,
103 int slice, std::map<std::string, NekDouble> &params);
104};
105
106/**
107 * \brief This class is the base class for Navier Stokes problems
108 *
109 */
112{
113public:
114 friend class MemoryManager<FileSolution>;
115
116 /// Creates an instance of this class
120 {
123 p->InitObject();
124 return p;
125 }
126
127 /// Name of class
128 static std::string className;
129
130protected:
133
134 ~FileSolution() override = default;
135
136 /// Initialise the object
137 void v_InitObject(bool DeclareField = true) override;
138
139 void v_GetVelocity(
140 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
141 Array<OneD, Array<OneD, NekDouble>> &velocity) override;
142
143 void v_GetPressure(
144 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
146
148
149 void v_GetDensity(
150 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
151 Array<OneD, NekDouble> &density) override;
152
153 bool v_HasConstantDensity() override;
154
155 /// Compute the RHS
156 void DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble>> &inarray,
158 const NekDouble time);
159
160 /// Compute the projection
161 void DoOdeProjection(
162 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
163 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
164
165 void DoImplicitSolve(
166 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
167 Array<OneD, Array<OneD, NekDouble>> &outarray, NekDouble time,
168 NekDouble lambda);
169
170 bool v_PostIntegrate(int step) override;
171
172 bool v_RequireFwdTrans() override;
173
174 void v_DoInitialise(bool dumpInitialConditions) override;
175
176 void UpdateField(NekDouble time);
177
178private:
180 std::set<std::string> m_variableFile;
182 std::map<std::string, LibUtilities::EquationSharedPtr> m_solutionFunction;
183};
184
185} // namespace Nektar::SolverUtils
186
187#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:74
std::map< std::string, int > m_variableMap
variables
Definition: FileSolution.h:87
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:85
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:112
static std::string className
Name of class.
Definition: FileSolution.h:128
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:117
FileFieldInterpolatorSharedPtr m_solutionFile
Definition: FileSolution.h:179
void UpdateField(NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_coord
Definition: FileSolution.h:181
std::set< std::string > m_variableFile
Definition: FileSolution.h:180
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)
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:182
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.
~FileSolution() override=default
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< FileFieldInterpolator > FileFieldInterpolatorSharedPtr
Definition: FileSolution.h:52
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
double NekDouble