Nektar++
FilterAeroForces.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: FilterAeroForces.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: Outputs values at specific points during time-stepping.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERUTILS_FILTERS_FILTERFORCES_H
36#define NEKTAR_SOLVERUTILS_FILTERS_FILTERFORCES_H
37
42#include <boost/numeric/ublas/matrix.hpp>
43#include <boost/numeric/ublas/vector.hpp>
44
45namespace Nektar
46{
47namespace bnu = boost::numeric::ublas;
48
49namespace SolverUtils
50{
52{
53public:
54 friend class MemoryManager<FilterAeroForces>;
55
56 /// Creates an instance of this class
59 const std::weak_ptr<EquationSystem> &pEquation,
60 const std::map<std::string, std::string> &pParams)
61 {
63 pSession, pEquation, pParams);
64 return p;
65 }
66
67 /// Name of the class
68 static std::string className;
69
72 const std::weak_ptr<EquationSystem> &pEquation,
73 const std::map<std::string, std::string> &pParams);
74
76
79 Array<OneD, NekDouble> &Aeroforces, const NekDouble &time);
80
83 Array<OneD, NekDouble> &moments, const NekDouble &time);
84
85protected:
86 void v_Initialise(
88 const NekDouble &time) override;
89 void v_Update(
91 const NekDouble &time) override;
92 void v_Finalise(
94 const NekDouble &time) override;
95 bool v_IsTimeDependent() override;
96
97private:
98 /// ID's of boundary regions where we want the forces
99 std::vector<unsigned int> m_boundaryRegionsIdList;
100 /// Determines if a given Boundary Region is in
101 /// m_boundaryRegionsIdList
102 std::vector<bool> m_boundaryRegionIsInList;
103 unsigned int m_index;
104 unsigned int m_outputFrequency;
105 /// if using a homogeneous1D expansion, determine if should output
106 /// all planes or just the average
109 std::string m_outputFile;
110 std::ofstream m_outputStream;
112 std::string m_BoundaryString;
115 /// number of planes for homogeneous1D expansion
118 // Time when we start calculating the forces
120 // Directions on which the forces will be projected
123 // Point around which we compute the moments
125
126 // Arrays storing the last forces that were calculated
133 // Arrays storing the last moments that were calculated
140
143
144 void CalculateForces(
146 const NekDouble &time);
147
150 const NekDouble &time);
151};
152
153typedef std::shared_ptr<FilterAeroForces> FilterAeroForcesSharedPtr;
154} // namespace SolverUtils
155} // namespace Nektar
156
157#endif /* NEKTAR_SOLVERUTILS_FILTERS_FILTERCHECKPOINT_H */
#define SOLVER_UTILS_EXPORT
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.
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Array< OneD, Array< OneD, NekDouble > > m_Fvplane
void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
void CalculateForces(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
int m_nPlanes
number of planes for homogeneous1D expansion
SOLVER_UTILS_EXPORT ~FilterAeroForces() override
Array< OneD, NekDouble > m_pivotPoint
bool m_outputAllPlanes
if using a homogeneous1D expansion, determine if should output all planes or just the average
void CalculateForcesMapping(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
std::vector< unsigned int > m_boundaryRegionsIdList
ID's of boundary regions where we want the forces.
Array< OneD, Array< OneD, NekDouble > > m_directions
std::vector< bool > m_boundaryRegionIsInList
Determines if a given Boundary Region is in m_boundaryRegionsIdList.
static std::string className
Name of the class.
SOLVER_UTILS_EXPORT FilterAeroForces(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const std::map< std::string, std::string > &pParams)
Array< OneD, Array< OneD, NekDouble > > m_Mpplane
SOLVER_UTILS_EXPORT void GetMoments(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, Array< OneD, NekDouble > &moments, const NekDouble &time)
Array< OneD, Array< OneD, NekDouble > > m_directions0
GlobalMapping::MappingSharedPtr m_mapping
Array< OneD, Array< OneD, NekDouble > > m_Ftplane
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
LibUtilities::BasisSharedPtr m_homogeneousBasis
SOLVER_UTILS_EXPORT void GetForces(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, Array< OneD, NekDouble > &Aeroforces, const NekDouble &time)
Array< OneD, Array< OneD, NekDouble > > m_Mtplane
Array< OneD, Array< OneD, NekDouble > > m_Fpplane
Array< OneD, Array< OneD, NekDouble > > m_Mvplane
GLOBAL_MAPPING_EXPORT typedef std::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
Definition: Mapping.h:51
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:51
std::shared_ptr< FilterAeroForces > FilterAeroForcesSharedPtr
double NekDouble